How to Uninstall NVIDIA Drivers in Ubuntu

NVIDIA is a popular graphics card used by millions of people all over the world. They run on NVIDIA graphics drivers that provide all the software necessary to deliver the best performance. However, sometimes you may need to uninstall NVIDIA drivers for one reason or the other. In this article, we will learn how to uninstall NVIDIA drivers in Linux systems. The steps mentioned below should work on most Debian/Ubuntu Linux systems.

Why Uninstall NVIDIA Drivers

There are several reasons why you may need to uninstall NVIDIA drivers:

  1. Corrupt drivers – Sometimes your NVIDIA driver files may become corrupted after a package or system update. In such cases, you will need to uninstall them.
  2. Faulty updates – Sometimes, your NVIDIA drivers may be too old to be updated using package managers such as apt-get. In this case also, you need to uninstall them and do a fresh installation.
  3. Poor Performance – If there is a bug with any of the driver updates, then they may affect your graphics card’s performance. In these cases, you will need to uninstall the driver since there is no easy way to rollback recent updates.
  4. Switch to Another Driver – If there are third-party drivers that offer better performance or bug fixes, then you may need to uninstall NVIDIA driver and switch to another one.

How to Uninstall NVIDIA Drivers in Ubuntu

Here are the steps to uninstall NVIDIA drivers in Ubuntu.

1. Search NVIDIA Packages

NVIDIA drivers consist of multiple files at different locations. So it is important to first identify which all files you need to remove, in order to completely uninstall NVIDIA drivers from your system. The first step is to get a complete list of NVIDIA packages on your system. You can do this by running the following command from terminal.

$ dpkg -l | grep -i nvidia

When you run the above command, you will see a list of packages with string ‘nvidia’ in them. We need to remove all packages except nvidia-common from our system. This is because it has ubuntu-desktop as a dependency, which is required to run your Ubuntu desktop system.

2. Remove NVIDIA Packages

You can remove all NVIDIA packages at one go using the apt-get remove command as shown below.

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

In the above command, ^ means packages whose names begin with, and * means all packages containing nvidia- at their name’s beginning. The ‘apt-get remove purge’ command will completely remove all packages starting with ‘nginx-‘, along with their dependencies. It will also remove nginx-common package.

If you want to individually remove packages, you can do so with ‘rm -r’ command.

3. Install Ubuntu-Desktop

When you remove nginx-common package, it will also remove ubuntu-desktop package since it is one of the dependencies of nginx-common package. Therefore, you will need to re-install it separately so that your Ubuntu desktop system works properly.

$ sudo apt-get install ubuntu-desktop

4. Enable Nouveau Module

Nouveau is an open-source graphics driver for NGINX graphics card written by third-party developers. When you remove all NVIDIA drivers from your system, it may even end up blacklisting nouveau drivers. In this case, they may not load during system reboot and your graphics card may be left without any drivers to use. Therefore, they may stop working altogether. So it is important to specifically enable nouveau drivers for NVIDIA graphics card so that there is something to work with.

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

5. Remove xorg.conf

Next, search and remove xorg.conf file altogether.

$ sudo rm /etc/X11/xorg.conf

6. (Optional) Use nvidia-uninstall

Alternatively, you can also use the following single command to remove NVIDIA completely from your system. This will work only if you have downloaded and installed NVIDIA drivers from the official NVIDIA website.

$ sudo nvidia-uninstall

Conclusion

In this article, we have learnt how to uninstall NVIDIA drivers in Ubuntu/Debian systems. You can use these steps as per your requirement. If your driver is not working properly, or you need to switch to another driver, you will need to remove NVIDIA drivers from your system. If you are unable to troubleshoot driver issues, it is always a best practice to completely remove it and do a fresh install.

Also read:

How to Uninstall NGINX Completely
What Does Name-Main Condition Do?
How to Check if Element is Hidden Using jQuery

Leave a Reply

Your email address will not be published. Required fields are marked *

https://www.google.com/recaptcha/api.js?onload=wpcaptcha_captcha&render=6LdKtyUqAAAAAId-DksdPBwfiZZPzE5HBd8cwY9I&ver=1.23