Home » Basics » How to Install Nvidia Drivers in Ubuntu 24.04

How to Install Nvidia Drivers in Ubuntu 24.04

If you have an Nvidia graphics card installed on your computer, it's better to use official drivers. The quality of the open-source Nouveau driver has greatly improved over the years and is almost on par with the proprietary one in terms of performance, but you won't be able to use technologies like CUDA, and Vulkan performance will be worse.

This guide will cover how to Install Nvidia Drivers in Ubuntu 24.04 from the official website and using a repository. Although this article is primarily targeted at Ubuntu 24.04, all the steps below will work well on other editions and versions of this distribution. However, this method works on systems that use only one Nvidia graphics card. Systems with integrated graphics have their own peculiarities.


Table of Contents

Check Current GPU Drivers

New Ubuntu installer allows you to select the checkbox "Install third-party drivers for graphics and WiFi hardware" during system installation. If you selected this option during installation, the proprietary Nvidia drivers is already installed on your system. To check this, you can use the command lspci to see which kernel module is used for the graphics card.

lspci -knn | grep VGA -A2

The kernel module is outputted after "Kernel driver in use", and in this case, it's already the Nvidia driver. If an open-source driver were being used, the kernel module would be called nouveau.

But even if the driver is already installed, you may want to update its version. To check the current version of the Nvidia driver, you can run the following command:

cat /proc/driver/nvidia/version

Now you know what's used in your system, let's take a look at how to find the right driver version and install it.

Proprietary and Open-Source Nvidia Driver Modules

Nvidia aims to make the source code of its kernel modules for its drivers open, just like AMD did. The development of the open-source module began in 2022, but the company was only able to complete the transition recently in 2024. However, the open driver is only available for modern graphics cards, specifically those with architectures: Turing, Ampere, Ada Lovelace, or Hopper. Older cards are not supported.

Opening the source code will benefit the community as a whole, increasing security and ease of installing drivers in the future. However, for end-users, practically nothing has changed at this moment. There are now simply two versions of driver packages: with the "-open" suffix and without it. If there is a package with the "-open" suffix available for your driver version, it's better to choose it. If not, you will have to continue using proprietary drivers.

Check Available Drivers for your GPU

It is recommended to install the latest Nvidia driver because drivers are constantly being improved, adding support for new features, improving performance, and correcting errors. However, the manufacturer typically removes support for outdated graphics cards from the driver. For example, at the time of writing, the latest driver version is 555. However, if you have a GTX 780 graphics card, you should use a driver version of 470, which was released in 2021.

You can choose the driver version for your graphics card using the official Nvidia website. However, you need to know the graphics card model. You can do this using the lspci command:

sudo lspci -vnn | grep -i VGA -A 12

In this example, the Nvidia RTX 3060 graphics card is used. Next, open the Nvidia driver download page and fill in the details of your graphics card.

Here, you need to select the product type, series, model, operating system, and language. The product type and series can be understood from the information obtained from lspci. In the Product Type, in most cases for video cards for home PCs, you need to select GeForce. Then, in the next field, select the exact model of your video card.

Also, pay attention to the Download Type parameter. Here you can specify which version of the driver you need - stable or the latest. To get a stable version, select Production Branch. Then, click the Search button. On the opened page, you will see the recommended driver version:

For RTX 3060, it's 550 if you choose the stable version and 555 if you choose the latest one. For older graphics cards, the driver version may be older. For example, GTX 780:

Note that a driver version has a major and minor number. Older driver versions may receive updates with bug fixes or security issues, in which case the major version remains the same, and the minor version increases. In this example, it is written that driver 470.206 was released in June 2024, but the version 470 was first released in 2021. You can use the Nvidia driver archive to get oriented on which year a certain driver version was released.

Now we know which driver is needed, we can already download the installation package and move on to the installation, but we will proceed differently. Next, I will show how to install Nvidia driver in Ubuntu 24.04 from the PPA repository.

Install Nvidia Drivers in Ubuntu

1. Install Driver from the Official Repository (stable)

In Ubuntu, there is a graphical utility called "Devices and Drivers" as well as a console utility called ubuntu-drivers for managing drivers. However, everything is intuitive there. In this article, I want to show how to install drivers manually using apt package manager. To get a list of available NVIDIA driver versions in the repositories, use the following command:

sudo apt search nvidia-driver

In the output of the command, you need packages with names in the format nvidia-driver-<version>.

In Ubuntu 24.04, version 550 of the driver is available, which is stable and recommended by the official website. You can install it using the command:

sudo apt install nvidia-driver-550

And that's it. Now you just need to restart your computer and you will get a new version of the driver. You can also check the driver version not only with the command "cat", but also with "nvidia-smi".

nvidia-smi

But if you want the latest version that is not yet in the repositories, you need to use a PPA.

2. Install Nvidia Driver From PPA (Newest)

The PPA repository graphics-drivers contains the latest versions of Nvidia drivers. We will use it for installation. To add graphics-drivers to the system, run the command:

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

Adding a repository requires confirmation by pressing the Enter key.

Now the PPA repository has been added and package lists have been updated, you can proceed with the installation. If you search the repository again, apt will find the freshest version 555, which was not there before.

sudo apt search nvidia-driver

To install version 555, use the apt command.

sudo apt install nvidia-driver-555

After completing the installation, restart your computer.

3. Install Nvidia Driver using GUI (stable)

If you don't want to use the console, you can enable the driver using the Software & Updates utility. However, please note that the utility will only work if you haven't tried installing drivers through the console or official website yet. In the opposite case, all options will be inactive or errors will occur during installation. Another feature of this utility is that it allows you to install only verified versions. For example, version 550 is not available here, although it is in the repository. To run the utility, open the main menu and type "Driver" in the search bar:

Launch the Additional Drivers application. This is part of the Software & Updates application, so it will open the Additional Drivers tab:

Select the needed driver version and click the Apply Changes button.

The utility will ask for the user's password, and then the installation process will begin. After completion, the utility will inform that the computer needs to be restarted. To do this, click the Restart button.

After rebooting, the selected driver will be activated.

Ensure Driver Installed Correctly

The simplest way to ensure that the Nvidia driver is installed and working is to use the lspci utility, as shown at the beginning of the article.

sudo lspci -k | grep -i VGA -A2

You can also check the support for hardware acceleration using the glxinfo utility.

glxinfo | grep OpenGL | grep renderer

The value of the OpenGL renderer parameter should match your graphics card model. If the word MESA is present, it means that standard drivers are still being used for hardware acceleration.

You can verify that the NVIDIA kernel module is loaded using the lsmod utility.

lsmod | grep nvidia

Let's take a look at the information about this module using modinfo.

modinfo nvidia

Nvidia Settings Utility

Along with the drivers, the Nvidia X Server Settings graphical utility is installed in the system, which can be launched from the menu or by running the command:

nvidia-settings

This utility allows you to view information about the graphics card, connected monitor, and adjust various settings.

For example, on the Thermal Settings tab, you can adjust the fan speed on your graphics card and view its temperature in real-time.

How to Remove Nvidia Drivers in Ubuntu

If something goes wrong during installation, try removing the Nvidia driver on Ubuntu in recovery mode. To open this mode, select "Additional parameters" in the Grub boot menu, then select "recovery mode" or "restore mode". The Grub menu is usually hidden, but if there was an error during the last boot, it will appear and you will be able to select the recovery mode.

In recovery mode, remount the file system for writing:

mount -o remount,rw /

Then remove all Nvidia packages:

sudo apt purge nvidia-*

This is it. You can then reboot the computer and the kernel will load the free nouveau driver.

Wrapping Up

That's it, Nvidia driver installation in Ubuntu 24.04 is complete. Now you can play games, work with artificial intelligence, or perform other tasks that require a graphics card. But be careful, because now you cannot update the kernel to a version higher than the one supported by the driver, or the system will not boot.

Also, I deliberately omitted from the article the method of installing the driver from the official website. Installing software outside of the package manager is a bad practice. It's very easy to accidentally damage your system and restore it to its original state, which will be much harder.

Creative Commons License
The article is distributed under Creative Commons ShareAlike 4.0 license. Link to the source is required .

Leave a Comment