Upgrading Nvidia Drivers on Ubuntu

While trying to get back on Deep Learning experiments, I faced the need to upgrade my nvidia drivers on my ubuntu 14.04 LTS system.

So I thought it would be a good idea to write this down here to keep track of how to do it once and for all.

The first thing to do is to check what is the version of the drivers currently installed:


⇒ In my case I had Driver Version: 390.87

Then we check what is the latest version available from that PPA: https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa

⇒ Latest package version is: nvidia-410 to install drivers version 410.79

From there, we remove the previously installed drivers:

sudo apt-get purge nvidia*

Then we add the PPA if needed:

sudo add-apt-repository ppa:graphics-drivers

And we update our apt sources:

sudo apt-get update

And finally we install the new drivers we want:

sudo apt-get install nvidia-410

Then you would normally reboot your computer to get the new drivers loaded, but I usually try to avoid this process (ie. reboot my server), so a working alternative at this point seems to be to manually force reloading the drivers with the following commands:

sudo rmmod nvidia_drm
sudo rmmod nvidia_modeset
sudo rmmod nvidia_uvm
sudo rmmod nvidia
sudo nvidia-smi
The last command above is the one that will force loading the new drivers, and the rmmod commands will remove the kernel modules from the previous version.
If you get additional messages such as: “rmmod: ERROR: Module nvidia is in use by: nvidia_modeset nvidia_uvm” this simply means you have other modules you should unload before the one you are currently trying to remove

Then you should have your new drivers version in use as shown below:

kenshin@neptune:~$ nvidia-smi
Fri Dec 28 18:32:20 2018
| NVIDIA-SMI 410.79       Driver Version: 410.79       CUDA Version: 10.0     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|   0  GeForce GTX 107...  Off  | 00000000:06:00.0 Off |                  N/A |
|  0%   51C    P0    36W / 180W |      0MiB /  8119MiB |      0%      Default |
|   1  GeForce GTX 107...  Off  | 00000000:07:00.0 Off |                  N/A |
|  0%   52C    P0    33W / 180W |      0MiB /  8117MiB |      0%      Default |