Nividia-396 installation blocked by libglx on 18.04

I try to install the driver package nvidia-396 on my laptop as it is required to run cuda.

When I try to do it through apt I get a kind of error I never encountered before :

trying to replace " /usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0 ",which
belong to the package libglx-mesa0:amd64 18.0.0~rc5-1ubuntu1
errors have been encountered during the execution of : 
/var/cuda-repo-9-2-local/./nvidia-396_396.26-0ubuntu1_amd64.deb

I've tried to remove the libglx-mesa0 package but it didn't change anything.

I run ubuntu 18.04. My GPU is a Nvidia Quadro K3100M.

Thank you very much for any help you could provide.


Solution 1:

This is bug in the package. Temporary solution is to force the installation by:

dpkg -i --force-overwrite /var/cache/apt/archives/nvidia-396_396.26-0ubuntu1_amd64.deb

Solution 2:

Ubuntu did recommend to me trying apt install --fix-broken to solve the issue I head with libglx-mesa0 being installed by nvidia-410.

I couldn't figure which .deb is causing the issue exactly so I just passed Dpkg::Options::="--force-overwrite" to the suggested command:

sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken