Ubuntu – Cannot install Nvidia drivers v396 on Ubuntu 18.04

driversnvidia

I am trying to install version 396 of the Nvidia drivers on Ubuntu 18.04 using this link. I got a message about unmet dependencies (see below). Actually when using ubuntu-drivers devices the recommended version is 415. I tried that but got same results. The excellent post mentioned in the link does not mention this problem. Does somebody know the cause of this problem (why doesn't apt install these dependencies) and how I can solve this?

I have a dual 1080Ti setup with driver version 390. For Cuda 9.2 I need at least version 396.

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nvidia-driver-396 : Depends: libnvidia-gl-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Depends: nvidia-dkms-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Depends: libnvidia-compute-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Depends: nvidia-compute-utils-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Depends: libnvidia-decode-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Depends: libnvidia-encode-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Depends: nvidia-utils-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Depends: libnvidia-ifr1-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Recommends: libnvidia-compute-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-decode-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-encode-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-ifr1-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-gl-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
E: Unable to correct problems, you have held broken packages.

Best Answer

I tried to install the unmet dependencies as suggested in the comment. I start with libnvidia-gl-396. That resulted in the same error message about unmet dependencies and a broken package. I tried to fix that with

sudo apt-get install --fix-broken

but that didn't work. I rebooted and ran software and updates again. To my surprise it listed all available versions from 390 onwards: 390, 396, 410 and 415, where it first listed just 390. Tried to install any of them but that didn't succeed. Got no message as to why.

As I'd figured out before the following versions were available:

$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:03.1/0000:08:00.0 ==
modalias : pci:v000010DEd00001B06sv00001458sd0000374Cbc03sc00i00
vendor   : NVIDIA Corporation
model    : GP102 [GeForce GTX 1080 Ti]
driver   : nvidia-driver-415 - third-party free recommended
driver   : nvidia-driver-396 - third-party free
driver   : nvidia-driver-390 - third-party free
driver   : nvidia-driver-410 - third-party free
driver   : xserver-xorg-video-nouveau - distro free builtin

Version 396 would be ok for now, but Cuda 10 already needs driver version 410, so I could live with the recommendation. This article suggested to remove the old drivers and install the new ones as follows:

sudo apt-get remove --purge nvidia-*
sudo ubuntu-drivers autoinstall

And it worked. I can now run Tensorflow 1.12 without it complaining about the wrong driver version.

Related Question