how to address apt-upgrade problem involving libglx-mesa0 and Nvidia driver
I have an Nvidia 1070 system with Ubuntu 18.04, Nvidia driver 396.37, CUDA 9.0, and then TensorFlow and Keras running on it.
Having run sudo apt update
, when I run sudo apt upgrade
, I get the following:
$ sudo 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.
libglx-mesa0 : Depends: libglapi-mesa (= 18.0.5-0ubuntu0~18.04.1) but 18.2.8-0ubuntu0~18.04.2 is installed
Breaks: libglx-mesa0:i386 (!= 18.0.5-0ubuntu0~18.04.1) but 18.2.8-0ubuntu0~18.04.2 is installed
libglx-mesa0:i386 : Breaks: libglx-mesa0 (!= 18.2.8-0ubuntu0~18.04.2) but 18.0.5-0ubuntu0~18.04.1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
When I attempt the suggested sudo apt --fix-broken install
I see the following:
$ sudo apt --fix-broken installReading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libllvm6.0 libllvm6.0:i386 x11proto-dri2-dev x11proto-gl-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libglx-mesa0
The following packages will be upgraded:
libglx-mesa0
1 to upgrade, 0 to newly install, 0 to remove and 256 not to upgrade.
155 not fully installed or removed.
Need to get 0 B/135 kB of archives.
After this operation, 9216 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 591832 files and directories currently installed.)
Preparing to unpack .../libglx-mesa0_18.2.8-0ubuntu0~18.04.2_amd64.deb ...
Unpacking libglx-mesa0:amd64 (18.2.8-0ubuntu0~18.04.2) over (18.0.5-0ubuntu0~18.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/libglx-mesa0_18.2.8-0ubuntu0~18.04.2_amd64.deb (--unpack):
trying to overwrite '/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0', which is also in package nvidia-396 396.37-0ubuntu1
Errors were encountered while processing:
/var/cache/apt/archives/libglx-mesa0_18.2.8-0ubuntu0~18.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Based on my investigating this, I am prompted by this and this, to run the following command:
sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken
However, I really would rather not screw up my setup (as it was a challenge getting compatible versions of CUDA, TensorFlow, Keras etc. working at all) so would value thoughts on whether this is a safe approach.
EDIT: Following this suggestion by @Jos, I made a backup of /usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0
and the proceeded with the --force-overwrite
approach. Following this, the infrastructure of TensorFlow, Keras and so on all seems to be working fine.
$ sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libllvm6.0 libllvm6.0:i386 x11proto-dri2-dev x11proto-gl-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libglx-mesa0
The following packages will be upgraded:
libglx-mesa0
1 to upgrade, 0 to newly install, 0 to remove and 256 not to upgrade.
155 not fully installed or removed.
Need to get 0 B/135 kB of archives.
After this operation, 9216 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 591832 files and directories currently installed.)
Preparing to unpack .../libglx-mesa0_18.2.8-0ubuntu0~18.04.2_amd64.deb ...
Unpacking libglx-mesa0:amd64 (18.2.8-0ubuntu0~18.04.2) over (18.0.5-0ubuntu0~18.04.1) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0', which is also in package nvidia-396 396.37-0ubuntu1
Solution 1:
TL;DR
Beware, the solution below uses --force-overwrite
, it'll come with caveats.
From @Jos comment:
sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken
Nvidia drivers, CUDA and libglx packaging conflict on Ubuntu is always sooo messy -_-|||