How to Uninstall NVIDIA Drivers in Ubuntu

Here are the steps to uninstall NVIDIA drivers in Ubuntu. Our approach will be to first find and list all NVIDIA packages on our system, and then use apt remove command to remove them. This may cause certain dependencies to stop working, or even remove them from your system. So we will reinstall those dependencies to ensure nothing is broken.

1. Remove Purge

If you use remove –purge command for the NVIDIA drivers it will be fine. You may need to force load nouveau module.

First, search which NVIDIA packages have been installed. For this, open terminal and run the following command.

$ dpkg -l | grep -i nvidia

You will see a list of packages with string ‘nvidia’ in their name. Except, nvidia-common package, all other packages must be purged. If you want to individually remove each package, you can do it with ‘rm -r’ command. If you are sure you want to purge all NVIDIA packages including nvidia-common, run the following command.

$ sudo apt-get remove --purge '^nvidia-.*'

In the above command, ^ means beginning with, and * at the end means all packages containing ‘nvidia- at its beginning.

2. Install Ubuntu-Desktop

Now, if you have purged all NVIDIA packages including nvidia-common, then you should know that it has ubuntu-desktop as a dependency.

So when you remove nvidia-common package, it may end up deleting ubuntu-desktop. So run the following command to reinstall ubuntu-desktop.

$ sudo apt-get install ubuntu-desktop

3. Enable nouveau module

Sometimes, when you purge all NVIDIA packages, it may end up blacklisting nouveau module. To ensure that it is loaded during boot, add it to /etc/modules, with the following command.

$ echo 'nouveau' | sudo tee -a /etc/modules

4. Remove xorg.conf

Lastly, remove xorg.conf file as well.

$ sudo rm /etc/X11/xorg.conf

That’s it. These steps should completely remove NVIDIA drivers from your system. Thy should work for all Ubuntu/Debian systems.

Alternatively, you can also directly run the following command to uninstall NVIDIA drivers from your system.

$ sudo nvidia-uninstall

Please note, the above command may not work for all systems, but mainly for drivers installed from NVIDIA website.

By default, Ubuntu systems don’t have NVIDIA drivers but they provide certain benefits such as better support for NVIDIA hardware, better performance for high intensity graphics, better cooling for certain high intensity graphics applications and more control settings as far as graphics is concerned. On the other hand, nouveau drivers offer less screen tearing while scrolling and are easier to setup in case you want to use secure boot. You can use either/both of them depending on your requirement.

 

Source: https://fedingo.com/how-to-uninstall-nvidia-drivers-in-ubuntu/