How to Install and Upgrade Nvidia Drivers on Ubuntu

nvidia and ubuntu logos on green gradient background

This tutorial will take you through different methods that you can apply to update your Nvidia GPU drivers to their latest version.

Nvidia cards use an open-source Nouveau driver by default, but this driver does not harness the full power of an Nvidia GPU and can underperform.

The proprietary Nvidia drivers are required if you want your Nvidia GPU to perform to its fullest.

You can update your Nvidia drivers using several methods, and we will go through each technique one by one so that you can choose the one you prefer the most. The different ways you can update your Nvidia drivers on Ubuntu are listed below, and after going through them, you will be able to perform these tasks yourself.

Install/Update Nvidia drivers using the GUI

This is the easiest method to update Nvidia drivers on Ubuntu and is also the most recommended one. Using the GUI Software and Updates app, you can easily update your drivers to the latest version.

Step 1: Open the “Software and Updates” App

Go to the Applications menu and open the Software and Updates app.

Step 2: Go to Additional Drivers Tab

Once the application opens, click on the Additional Drivers tab and wait for the app to download a list of available driver updates for your GPU.

The driver installed on your machine will be selected by default in this list.

Step 3: Select Latest Nvidia Driver & Apply Changes

Select the latest Nvidia driver from the list that is labeled “proprietary, tested.” Proprietary and tested means that it has been tested and proven to work with your Nvidia GPU. That means it’s reliable and won’t cause any problems.

After selecting the latest version available, click on Apply Changes. Now enter your password and wait for the system to install the driver.

Step 4: Reboot your system

Restart your machine and enjoy your updated Nvidia drivers.

Install/Update Nvidia drivers using the Command Line

In case you do not have GUI enabled, this method enables you to install/update Nvidia graphics using the command line. You can also update your Nvidia drivers using the Terminal. Let’s take a step-by-step look at how this method works.

Open the terminal by pressing Ctrl+Alt+T or by searching for “Terminal” in the applications menu. Now to detect the model of your Nvidia card and the recommended driver for it, execute the following command.

ubuntu-drivers devices
Output
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001C03sv00001043sd000085ABbc03sc00i00
vendor   : NVIDIA Corporation
model    : GP106 [GeForce GTX 1060 6GB]
driver   : nvidia-driver-390 - distro non-free
driver   : nvidia-driver-435 - distro non-free
driver   : nvidia-driver-440 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

The above output shows us that the system has Nvidia GeForce GTX 1060 6GB graphic card and also the recommended driver for it, which is nvidia-driver-440.

If you agree with the recommended driver, you can install it by using the ubuntu-drivers command again. Execute the following command to install the recommended driver.

sudo ubuntu-drivers autoinstall
Note: only do this if your currently installed driver is not the same as the recommended driver.

If you wish to install some other driver and not the recommended one, you can use the apt command to install your desired Nvidia drivers. Execute the following command to install a driver of your choice.

sudo apt install nvidia-driver-440

Step 3: Reboot your system

Once the desired driver has been installed, you need to reboot your system for the changes to take effect. The following command will reboot your machine.

sudo reboot

Install/Update drivers using the PPA repository – For Beta Drivers

You can install beta Nvidia drivers to run on your system, but as these drivers are still in beta form, they are unstable and can cause issues in your machine. Using the PPA repository, users can access software that is still in development. Follow these steps to install drivers using the PPA repository.

Step 1: Add the PPA graphics repository to your system

First, you need to install the required dependencies. Execute the following code to do that.

sudo apt install software-properties-common -y

Now execute the below command to add the PPA GPU drivers repository to your system.

sudo add-apt-repository ppa:graphics-drivers/ppa

When asked: if you want to add the PPA repository to your system?. Hit Enter.

Step 2: Identify the card model and available Nvidia drivers

To identify your card model and all the available + recommended Nvidia drivers for it, execute the following command the same as we did in the above method via the command line.

ubuntu-drivers devices

The command will return the following output.

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001C03sv00001043sd000085ABbc03sc00i00
vendor   : NVIDIA Corporation
model    : GP106 [GeForce GTX 1060 6GB]
driver   : nvidia-driver-440 - distro non-free
driver   : nvidia-driver-390 - distro non-free
driver   : nvidia-driver-435 - distro non-free
driver   : nvidia-driver-460 - third-party non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

The above output shows us that the system has Nvidia GeForce GTX 1060 6GB graphic card. The output also shows a third-party driver nvidia-driver-460, which is also the latest driver in the list. But this driver is not stable; proceed at your own risk.

Step 3: Install driver

If you wish to install the recommended driver, you can execute the following command to do so.

sudo ubuntu-drivers autoinstall

By downloading the beta Nvidia drivers, you will need to update some supporting packages. If the system asks permission about it, accept it to proceed with downloading the beta Nvidia drivers.

But if you, for any reason, do not wish to install the beta driver that is recommended by this method, you can install any driver of your choice by using the below-mentioned command.

sudo apt install nvidia-driver-440

The command installs the nvidia-driver-440. If you want to install any other driver, just replace the driver name in the command and execute it.

Step 4: Reboot your system

Now reboot your machine so that the applied changes may take effect. Run the following command to reboot your system.

sudo reboot

Uninstall Nvidia drivers and roll back to default driver

In order to uninstall the Nvidia driver and roll back to the default Nouveau opensource driver, you can remove --purge the driver to remove it. Follow these steps to uninstall the Nvidia driver.

Step 1: Identify installed package

To identify which Nvidia packages are installed on your machine, execute the below-mentioned command.

dpkg -l | grep -i nvidia

The output will return a list of all the Nvidia packages installed on your system.

Step 2: Purge Nvidia packages

Run the following command to purge the installed Nvidia packages.

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

This method may also remove the ubuntu-desktop package as it is a dependency of the nvidia-common package. So you may need to reinstall it. Run the following command to reinstall ubuntu-desktop package if it gets removed.

sudo apt-get install ubuntu-desktop

Step 3: Reboot your system

Now you need to reboot your system. You can run the following command to do so.

sudo reboot

The system will automatically load the Nouveau driver during boot.

Conclusion

Now you know how to install/upgrade your Nvidia GPU drivers using the GUI, command line, and PPA repository. You also know how to remove the installed Nvidia driver package and roll back to the default Nouveau driver.

 

0 Shares:
Subscribe
Notify of
guest
Receive notifications when your comment receives a reply. (Optional)
Your username will link to your website. (Optional)

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
analogtek
analogtek
1 year ago

I run pure Debian Bullseye and use the drivers from NVIDIA. I have no problem with install. But a experimental Ubuntu virtual machine crash bad with Nvidia sourced drivers. Does that mean Debian is a smarter system.

You May Also Like
Bash Case Statement
Read More

Bash Case Statement

The bash case statement is used to simplify complex conditionals in a bash script. Bash case statements use…