Broken apt, can't update libglvnd due to unmet dependencies (Nvidia)

9,299

Solution 1

@pibacco solution on question worked for me:

UPDATE I fixed it by running

sudo dpkg -i --force-overwrite /var/cache/apt/archives/libglvnd-dev_1.0.0-2ubuntu2.2_amd64.deb 
sudo dpkg -i --force-overwrite /var/cache/apt/archives/libgles1_1.0.0-2ubuntu2.2_amd64.deb 
sudo apt -f install
sudo apt update
sudo apt upgrade

Solution 2

You need to remove packages completely by

sudo dpkg --purge --force-depends "libgles1" 
sudo dpkg --purge --force-depends "libglvnd-dev"
sudo apt-get autoremove
sudo apt-get clean
sudo apt-get install -f

You can also see Can't solve unmet dependencies and sudo apt-get -f install fails

Share:
9,299

Related videos on Youtube

pibacco
Author by

pibacco

Updated on September 18, 2022

Comments

  • pibacco
    pibacco over 1 year

    I haven't installed any new packages recently or added any PPAs, just ran apt update.

    After running 'apt upgrade'

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt --fix-broken install' to correct these.
    The following packages have unmet dependencies:
     libglvnd-dev : Depends: libglvnd0 (= 1.0.0-2ubuntu2.1) but 1.0.0-2ubuntu2.2 is installed
                    Depends: libglvnd-core-dev (= 1.0.0-2ubuntu2.1) but 1.0.0-2ubuntu2.2 is installed
                    Depends: libegl1 (= 1.0.0-2ubuntu2.1) but 1.0.0-2ubuntu2.2 is installed
                    Depends: libgles2 (= 1.0.0-2ubuntu2.1) but 1.0.0-2ubuntu2.2 is installed
                    Depends: libgl1 (= 1.0.0-2ubuntu2.1) but 1.0.0-2ubuntu2.2 is installed
                    Depends: libglx0 (= 1.0.0-2ubuntu2.1) but 1.0.0-2ubuntu2.2 is installed
                    Depends: libopengl0 (= 1.0.0-2ubuntu2.1) but 1.0.0-2ubuntu2.2 is installed
    E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
    

    After running 'apt --fix-broken install' or 'apt-get install -f'

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Correcting dependencies... Done
    The following additional packages will be installed:
      libgles1 libglvnd-dev
    The following NEW packages will be installed:
      libgles1
    The following packages will be upgraded:
      libglvnd-dev
    1 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
    Need to get 0 B/14.6 kB of archives.
    After this operation, 66.6 kB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    (Reading database ... 686678 files and directories currently installed.)
    Preparing to unpack .../libgles1_1.0.0-2ubuntu2.2_amd64.deb ...
    Unpacking libgles1:amd64 (1.0.0-2ubuntu2.2) ...
    dpkg: error processing archive /var/cache/apt/archives/libgles1_1.0.0-2ubuntu2.2_amd64.deb (--unpack):
     trying to overwrite '/usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1', which is also in package nvidia-340 340.106-0ubuntu3
    Preparing to unpack .../libglvnd-dev_1.0.0-2ubuntu2.2_amd64.deb ...
    Unpacking libglvnd-dev:amd64 (1.0.0-2ubuntu2.2) over (1.0.0-2ubuntu2.1) ...
    dpkg: error processing archive /var/cache/apt/archives/libglvnd-dev_1.0.0-2ubuntu2.2_amd64.deb (--unpack):
     trying to overwrite '/usr/lib/x86_64-linux-gnu/libGLESv1_CM.so', which is also in package nvidia-340 340.106-0ubuntu3
    Errors were encountered while processing:
     /var/cache/apt/archives/libgles1_1.0.0-2ubuntu2.2_amd64.deb
     /var/cache/apt/archives/libglvnd-dev_1.0.0-2ubuntu2.2_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    I tried switching back to nouoveau temporarily but due to apt being messed up I can't. The control file asks for all the dependencies to be *-2.2 but when I try to upgrade it's asking for *-2.1.

    UPDATE I fixed it by running

    sudo dpkg -i --force-overwrite /var/cache/apt/archives/libglvnd-dev_1.0.0-2ubuntu2.2_amd64.deb
    sudo dpkg -i --force-overwrite /var/cache/apt/archives/libgles1_1.0.0-2ubuntu2.2_amd64.deb
    sudo apt -f install
    
    • Dexter Morganov
      Dexter Morganov over 5 years
      Same problem. Your recommendations is working for me. But, libgles1_1 should be installed before ibglvnd-dev
    • John P
      John P over 5 years
      bugs.launchpad.net/ubuntu/+source/libglvnd/+bug/1791542 -- I'll be posting this in the other comment change as well.
    • John P
      John P over 5 years
      Your solution works for me! You should post it as an answer and mark it, unless you think there's more to it.
  • pibacco
    pibacco over 5 years
    tried that, now I have unmet dependencies for libegl1-mesa-dev : Depends: libglvnd-dev libgl1-mesa-dev : Depends: libglvnd-dev libgles2-mesa-dev : Depends: libglvnd-dev and apt-get install -f returns the same error as before
  • nilesh_101
    nilesh_101 over 5 years
    Purge "libegl1-mesa-dev", " libgles2-mesa-dev" these packages too.
  • pibacco
    pibacco over 5 years
    did all that now i'm back to square one with egl1 and gles2 reinstalled and the initial two packages failing to process
  • pibacco
    pibacco over 5 years
    now pretty much every apt command is returning You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: libegl1-mesa-dev : Depends: libglvnd-dev but it is not installed libgl1-mesa-dev : Depends: libglvnd-dev but it is not installed libgles2-mesa-dev : Depends: libglvnd-dev but it is not installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
  • John P
    John P over 5 years
    Seconded - I also immediately run into things like SDL2, Glew, etc. that depend on Mesa, and I have quite a lot of time and work invested in some of these libraries. I may periodically uninstall all of these, get security upgrades, and reinstall them. (I'm considering a bounty, but I might not be able to use the accepted solution. Then again, my circumstances don't change the substance of the question, so I shouldn't post my own, right?)
  • John P
    John P over 5 years
    Could I move the deb files actually causing the conflicts like trying to overwrite ...libGLESv1_CM.so.1 which is also in package nvidia-340?
  • John P
    John P over 5 years
    I found a bug on Launchpad that appears to be this exact issue: bugs.launchpad.net/ubuntu/+source/libglvnd/+bug/1791542
  • dannysauer
    dannysauer over 5 years
    FWIW, you can put both file paths on one --force-overwrite command line. :) I did just that with a sudo apt update before and a sudo apt --fix-broken dist-upgrade after, thinking that maybe fixing while installing the newest packages might not be a terrible idea. Maximum variables FTW! :p