Linux Horror stories vol II: Automatic drivers update

As promised, I will tell you about another Linux Horror Story: The Nvidia driver automatic update that breaks your machine. This is a recurrent problem that I have suffered so many times that I tend to disable all Nvidia updates just to avoid it. Unfortunately, I forgot to do so on my new laptop, so it happened once more. 

It all started when I tried to connect my dual monitor to my laptop, as I have been doing for the last 8 months. But the SO did not recognize the monitor. After unplugging and plugging my monitor a few times and rebooting my machine several times, I started thinking that it may be a drivers-related problem, so I just executed the command nvidia-smi to check if the GPU drivers were working. A familiar error message confirmed my fears: 

NVIDIA-SMI has failed because it couldn’t communicate with the Nvidia driver. 

 Make sure that the latest NVIDIA driver is installed and running. 

If you are lucky enough, this is a consequence of the driver update and rebooting the machine will make it work again. Unfortunately, it was not my case, so I started the process of uninstalling and reinstalling the drivers. To do so, in an Ubuntu machine, you only need to use the following two commands.

#Remove Nvidia stuff
sudo apt remove –purge nvidia* 

#Install drivers

sudo apt install nvidia-dralliver-XXX # where XXX is the version

And after rebooting your machine your new drivers should be perfectly working. But of course, this is a horror story, so this solution didn’t work. So I need to manually purge ALL Nvidia related packages, that you can find using.

dpkg -l | grep nvidia

Once I got everythin clean, I tried to autoinstall the drivers

sudo ubuntu-drivers autoinstall

And after a reboot, my dual monitor was working again!

Author