How to Uninstall NVIDIA Drivers on Ubuntu

Ubuntu is one of the most user-friendly Linux distributions out there, and if you’re using an NVIDIA graphics card, the operating system usually takes care of driver installation pretty well. However, there are times when you might want to uninstall the NVIDIA drivers—whether it’s because you’re having issues, you want to switch to a different version, or you’d rather use the open-source Nouveau driver.

In this guide, we’ll walk you through the process of uninstalling NVIDIA drivers on Ubuntu, step-by-step, ensuring that you can troubleshoot, upgrade, or switch drivers without a hitch.

Why You Might Want to Uninstall NVIDIA Drivers

There are several reasons why you might want to remove NVIDIA drivers from your Ubuntu system:

  1. Performance Issues: Sometimes the drivers might cause problems like screen flickering, crashes, or graphical glitches. Uninstalling and reinstalling a different version might fix these issues.
  2. Switching to Open-Source Drivers: NVIDIA’s proprietary drivers aren’t the only option for Ubuntu users. The Nouveau driver, an open-source option, can be a more stable choice for some, especially if you don’t need the advanced features of NVIDIA’s official drivers.
  3. Driver Compatibility Problems: Perhaps the version of NVIDIA drivers you installed doesn’t play well with your hardware or the version of Ubuntu you’re running. Uninstalling them may help.
  4. Upgrading or Downgrading: If you want to install a different version of the NVIDIA drivers, you’ll first need to remove the current version. This allows you to upgrade or downgrade without running into conflicts.

How to Uninstall NVIDIA Drivers on Ubuntu

Now that you understand why you might need to uninstall your NVIDIA drivers, let’s dive into the process.

1. Check if NVIDIA Drivers Are Installed

Before proceeding, it’s a good idea to double-check if NVIDIA drivers are indeed installed. This is an easy step and will also confirm which driver version is currently active.

To check, open your terminal and type the following command:

nvidia-smi

This will show you the version of the NVIDIA driver in use, along with some other information about your GPU. If you see this info, it means the NVIDIA drivers are installed. If you get an error or no output, they’re either not installed or the system isn’t recognizing them.

2. Stop the Display Manager

Before we uninstall the drivers, you should stop the display manager. This will ensure that no processes are using the drivers while you’re trying to remove them. If you’re using the default GNOME desktop, the display manager is GDM, but if you’re using another desktop environment, it might be something like LightDM.

To stop the display manager, switch to a terminal by pressing Ctrl + Alt + F1 (or any other function key from F1 to F6). This will bring you to a text-based login screen.

Now, stop the display manager by typing:

sudo service gdm stop

If you’re using LightDM instead of GDM, use:

sudo service lightdm stop

This will prevent your desktop environment from running while you work in the terminal.

3. Purge the NVIDIA Drivers

Now that your display manager is stopped, we can safely remove the NVIDIA drivers from your system. Open the terminal and run the following command:

sudo apt-get purge nvidia-*

The purge command ensures that the drivers are fully removed, along with any related configuration files that were set up during the installation. This step will remove all NVIDIA driver packages from your system.

4. Remove Additional NVIDIA Tools

In addition to the drivers, you might have installed other NVIDIA-related packages like nvidia-settings or nvidia-prime to manage the GPU settings. To remove these, use:

sudo apt-get purge nvidia-settings nvidia-prime

This ensures that any tools designed to work with the NVIDIA drivers are also uninstalled.

5. Clean Up Residual Packages

Once the NVIDIA drivers and tools are removed, there might be some leftover dependencies that aren’t needed anymore. These are the packages that were installed to support the NVIDIA drivers but are no longer required. To clean them up, use the following command:

This command will automatically remove unnecessary packages from your system, making sure everything is tidy.

6. Revert to the Default Open-Source Nouveau Driver

Once the NVIDIA drivers are uninstalled, your system should automatically fall back to using the Nouveau open-source drivers. However, if for any reason the Nouveau driver isn’t active or you want to manually install it, you can do so by running:

sudo apt-get install xserver-xorg-video-nouveau

This installs the Nouveau driver, which is the default open-source driver for NVIDIA GPUs on Ubuntu.

After installing Nouveau, you can reconfigure your X server to make sure it uses the open-source drivers by running:

sudo dpkg-reconfigure xserver-xorg

This step will automatically configure your system to use Nouveau.

7. Reboot Your System

Once all the drivers and tools have been removed, it’s time to reboot your system to ensure that everything is properly applied. To reboot, run:

sudo reboot

This will restart your system and apply the changes, so the system will now be running without the NVIDIA drivers, using the Nouveau driver instead.

8. Verify the Uninstallation

To confirm that the NVIDIA drivers have been completely removed, run the following command:

lsmod | grep nvidia

If you don’t get any output, then the NVIDIA drivers have been successfully removed from your system. You can also check by running nvidia-smi again, and you should see an error message indicating that there is no NVIDIA driver installed.

What to Do if Things Don’t Work as Expected?

In some cases, the NVIDIA drivers might not uninstall properly, or you may run into issues after removing them. If that happens, here are a few things to try:

  1. Check for Running NVIDIA Processes: If the NVIDIA processes are still running, you might encounter issues while trying to remove the drivers. To check for any active NVIDIA processes, run:
ps aux | grep nvidia

If any NVIDIA-related processes are running, you can terminate them using the kill command.

Recovery Mode: If your display isn’t working after uninstalling the drivers, boot into recovery mode by selecting it from the GRUB boot menu. This will give you access to a root shell where you can remove or reinstall drivers.

Try Reinstalling Nouveau: If your system is still not using the open-source Nouveau driver after uninstalling NVIDIA drivers, you may need to manually reinstall it by running:

sudo apt-get install xserver-xorg-video-nouveau

Look at Xorg.conf: Sometimes, the Xorg configuration file (/etc/X11/xorg.conf) might still be set to use the NVIDIA driver. You can check and edit this file manually to ensure it’s using the default open-source driver.

Fixing Nvidia Driver Problems in OpenCore: The Force Injection Method

Conclusion

Uninstalling NVIDIA drivers on Ubuntu is a straightforward process that involves using Ubuntu’s built-in package manager to remove the drivers and return your system to its default configuration. Whether you’re troubleshooting issues, switching to open-source drivers, or upgrading/downgrading the driver version, these steps should help you get the job done with minimal hassle.

If you encounter any problems during the process, don’t hesitate to consult online forums or the Ubuntu community. The process may seem tricky at first, but with a little patience, you’ll have your system running smoothly again in no time.

Leave a Reply

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