Ubuntu

Install NVIDIA Drivers on Ubuntu 22.04 LTS

If you have an NVIDIA GPU installed on your computer, installing the NVIDIA GPU drivers is the first thing you would want to do after installing Ubuntu Desktop 22.04 LTS

In this article, I am going to show you how to install the proprietary NVIDIA drivers on Ubuntu Desktop 22.04 LTS.

Table of Contents:

  1. Finding Out Whether You Have NVIDIA GPU Installed
  2. Checking the GPU Drivers Currently Being Used
  3. Installing NVIDIA Drivers using the Graphical User Interface
  4. Installing NVIDIA Drivers from the Command Line
  5. Checking if NVIDIA Drivers are Installed Correctly
  6. Switching to the Nouveau Drivers
  7. Uninstalling the NVIDIA Drivers
  8. Conclusion
  9. References

Finding Out Whether You Have NVIDIA GPU Installed:

You can check whether your computer has an NVIDIA GPU installed with the following command:

$ lspci | grep VGA


As you can see, I have an NVIDIA GeForce GTX 1050 Ti GPU installed on my computer. You may have a different NVIDIA GPU installed.

Checking the GPU Drivers Currently Being Used:

You can check which NVIDIA GPU drivers (open-source Nouveau or proprietary NVIDIA) Ubuntu is using from the command line.

To check whether Ubuntu is using the open-source Nouveau drivers, run the following command:

$ lsmod | grep nouveau

As you can see, Ubuntu is using the open-source nouveau drivers by default.

As you have not installed the proprietary NVIDIA drivers yet, they are not being used.

$ lsmod | grep nvidia

Installing NVIDIA Drivers using the Graphical User Interface:

To install the proprietary NVIDIA drivers, open the Software & Updates app from the Application Menu of Ubuntu Desktop 22.04 LTS as marked in the screenshot below.

The Software & Updates app should be opened.

Navigate to the Additional Drivers tab and you should see that Nouveau drivers are being used.

To use the proprietary NVIDIA drivers, select Using NVIDIA driver metapackage from nvidia-drivers-510 (proprietary, tested) from the list and click on Apply Changes as marked in the screenshot below.

Type in your login password and click on Authenticate.

The Software & Updates app will download all the required packages from the internet and install the proprietary NVIDIA drivers on your computer. It will take a while to complete.

Once the installation is complete, you will see a Restart button as marked in the screenshot below. Click on it to restart your computer for the changes to take effect.

Click on Restart. Your computer should reboot and the NVIDIA drivers will be used on the next boot.

Installing NVIDIA Drivers from the Command Line:

You can also install the proprietary NVIDIA drivers from the command line.

To install the proprietary NVIDIA drivers from the command line, open the Terminal app and run the following command:

$ sudo apt install nvidia-driver-510

To confirm the installation, press Y and then press <Enter>.

All the required packages will be downloaded and installed. It will take a while to complete.

NVIDIA drivers are being installed…

NVIDIA drivers should be installed at this point.

For the changes to take effect, reboot your computer with the following command:

$ sudo reboot

Checking if NVIDIA Drivers are Installed Correctly:

Once the NVIDIA drivers are installed, the nouveau drives will no longer be used as you can see in the screenshot below.

$ lsmod | grep nouveau

If the NVIDIA drivers were installed correctly, the proprietary NVIDIA drives will be used instead as you can see in the screenshot below.

$ lsmod | grep nvidia

If you have installed the proprietary NVIDIA drivers, you will find the NVIDIA X Server Settings app in the Application Menu of Ubuntu Desktop 22.04 LTS. Click on the NVIDIA X Server Settings app as marked in the screenshot below.

If the NVIDIA drivers were installed correctly, the NVIDIA X Server Settings app should run without errors.

It will also show you information on your installed NVIDIA GPU as you can see in the screenshot below.

Switching to the Nouveau Drivers:

If you’re having problems with the proprietary NVIDIA drivers for some reason or you just don’t want to use the proprietary NVIDIA drivers anymore, you can switch to the open-source Nouveau drivers.

To switch to the open-source Nouveau drivers, open the Software & Updates app from the Application Menu of Ubuntu Desktop 22.04 LTS as marked in the screenshot below.

From the Additional Drivers tab1, select Using X.Org X server – Nouveau display driver from xserver-xorg-video-nouveau (open source) from the list and click on Apply Changes2 as marked in the screenshot below.

Type in your login password and click on Authenticate.

The Software & Updates app will be switching to the open-source Nouveau drivers. It will take a while to complete.

At this point, the Software & Updates app should switch to the open-source Nouveau drivers.

For the changes to take effect, open the Terminal app and reboot your computer with the following command:

$ sudo reboot

The open-source Nouveau drivers will be used the next time your computer boots.

$ lsmod | grep nouveau

Uninstalling the NVIDIA Drivers:

To uninstall the proprietary NVIDIA drivers completely, open a Terminal app and run the following command:

$ sudo apt remove --purge nvidia-*

To confirm the operation, press Y and then press <Enter>.

The proprietary NVIDIA drivers are being removed. It will take a while to complete.

At this point, most of the NVIDIA drivers packages will be removed.

To remove the dependency packages of the NVIDIA drivers, run the following command:

$ sudo apt autoremove --purge

To confirm the operation, press Y and then press <Enter>.

The dependency packages of the NVIDIA drivers are being removed. It will take a while to complete.

At this point, all the NVIDIA drivers dependency packages should be removed.

For the changes to take effect, reboot your computer with the following command:

$ sudo reboot

Conclusion:

In this article, I have shown you how to install the proprietary NVIDIA drivers on Ubuntu Desktop 22.04 LTS. I have also shown you how to check whether the NVIDIA drivers are working. I have shown you how to uninstall the proprietary NVIDIA drivers as well.

References:

  1. https://nouveau.freedesktop.org/
  2. https://www.nvidia.com/en-us/drivers/unix/

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.