Completely removing old Nvidia drivers

Pay your attention to ubuntu-drivers devices command output - there are following lines:

driver   : nvidia-340 - third-party free
driver   : nvidia-driver-390 - third-party free
driver   : nvidia-driver-396 - third-party free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

The lines mean you can use nvidia 340, 390, 396 drivers from third-party repository and open-source nouveau driver from distro repository. Only one driver is recommended to you. The list doesn't mean all of the mentioned drivers has been installed in your system. It indicates only potential possibility to install the drivers. The list can't be changed manually as being formed with ubuntu-drivers utility designed to automate proprietary drivers detecting, inspecting and installing from available to Ubuntu repositories.

Thus, to change the list it's necessary to remove third-party repository, which is proprietary GPU drivers repo in the particular case. But it's highly unrecommended to do, since your goal is to keep nvidia 396 driver anyway and remove from automatically created list nvidia 340 and 390 drivers. If you remove the third-party repository, only distro drivers will be detected as available, which will be in the particular case only 340 and 390 - thus, you'll obtain most undesired for you situation.

My suggestion for you is to do nothing. Your system looks healthy, everything works well.

If you like experiments, follow guide below.

The described below is for experimental purposes only - if you're not sure don't do it!

Press Ctrl+Alt+F4, log in and remove all of the nvidia staff:

sudo apt remove nvidia-*

Next remove proprietary PPA GPU drivers repository. Run in terminal:

sudo add-apt-repository --remove ppa:graphics-drivers/ppa
sudo apt update

Afterwards check available drivers in terminal:

ubuntu-drivers devices

You'll see the third-party nvidia drivers have dissapeared and only distro nvidia drivers are available. Among the drivers nvidia 396 will be absent since the driver isn't a part of Ubuntu distro repository.

Add your PPA proprietary GPU drivers repository back:

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update

Install your desired nvidia 396 again:

sudo ubuntu-drivers autoinstall

Reboot:

sudo reboot

After reboot, type nvidia-smi which will show different information about your graphic card like below:

xyz@xyz-workstation:~$ nvidia-smi
Mon Apr 27 12:41:50 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64.00    Driver Version: 440.64.00    CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| 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 166...  On   | 00000000:01:00.0 Off |                  N/A |
| N/A   45C    P8     1W /  N/A |    470MiB /  5944MiB |      5%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1905      G   /usr/lib/xorg/Xorg                            28MiB |
|    0      2058      G   /usr/bin/gnome-shell                          47MiB |
|    0      2956      G   /usr/lib/xorg/Xorg                           145MiB |
|    0      3133      G   /usr/bin/gnome-shell                         120MiB |
|    0      3587      G   ...AAAAAAAAAAAACAAAAAAAAAA= --shared-files   122MiB |
+-----------------------------------------------------------------------------+

For systems having nvidia-prime, if it returns an error then type sudo prime-select intel and then reboot and then type sudo prime-select nvidia and then reboot again. Now type nvidia-smi and it should work. This method works on most of the system with kernel till 5.4

Additionally see this my post.


  1. nvidia-installer --uninstall
  2. sudo apt remove nvidia-*