Topics: How-to guide Graphics

Install NVIDIA drivers

If you have an NVIDIA GPU, you can install official NVIDIA drivers to improve desktop and gaming performance or support computing tasks.

Warning

NVIDIA drivers installed from sources outside of those listed in this guide might potentially overwrite those provided by Ubuntu and might break Secure Boot.

We recommend installing the drivers provided by Ubuntu packages rather than downloading drivers from NVIDIA. The Ubuntu packages ensure that you install libraries compatible with your Ubuntu release.

Driver management tools

We recommend using the ubuntu-drivers tool or the Additional Drivers app to manage drivers. They share the same logic. By default, these tools only install the pre-built, signed drivers, which are known to work with Secure Boot.

You can also install NVIDIA drivers as deb packages using the APT tool. This is useful in certain cases:

  • You’re provisioning Ubuntu on multiple machines and you want to ensure the same driver configuration on all of them.

  • You want to learn how the drivers work on a lower level.

In some scenarios, you have to install the DKMS driver package, which builds the NVIDIA driver for the exact kernel that you’re running. For example:

  • You’re running a custom kernel.

  • The NVIDIA driver for your kernel version isn’t available yet.

Driver versions and branches

NVIDIA drivers come with several different support life cycles, also known as branches.

  • Generally, we recommend that you install the Production Branch (PB) drivers. These drivers are supported for one year and provide a good balance of performance, latest features and stability.

  • If you need the latest driver, such as to support a newly released game or the latest CUDA APIs, you can opt for the New Feature Branch (NFB) drivers.

  • In a regulated enterprise environment, you might prefer the Long Term Support Branch (LTSB) drivers, which are supported for three years.

Check your driver version

To check the version of your currently running driver:

  1. Open the Additional Drivers app.

    If you can’t find the app on your system, you can install it from the software-properties-gtk package.

  2. See which driver is selected under “NVIDIA Corporation”.

    Nouveau is usually pre-selected as the default, open-source driver.

$
cat /proc/driver/nvidia/version

If you currently have a version of the NVIDIA drivers installed that conflicts with those being installed, ubuntu-drivers will uninstall your original drivers before installing the new drivers.

Check a driver’s support branch

You can use the following command to check which branch a driver belongs to:

$
apt show nvidia-driver-VERSION | grep ^Support

The output shows the acronym of the branch. For example:

$
apt show nvidia-driver-595 | grep ^Support
Support: PB

Transitional packages to new driver branches

When NVIDIA stops support on a driver branch, Ubuntu will transition you to the next supported driver branch automatically if you try to install that driver branch.

See NVIDIA’s current support matrix in their documentation.

Update your system and kernel

  1. Apply all updates.

    Open the Software Updater app and install all available updates.

    $
    sudo apt update && sudo apt upgrade
  2. After the update is complete, reboot your system.

Install the drivers for desktop and gaming use

For the generic desktop use and gaming, we package the Unified Driver Architecture (UDA) drivers. These drivers also support computing use cases such as AI and machine learning. You can also find them on the NVIDIA website.

  1. Open the Additional Drivers app.

    If you can’t find the app on your system, you can install it from the software-properties-gtk package.

  2. Under “NVIDIA Corporation”, choose your preferred driver version.

    We recommend the most recent NVIDIA driver with the “proprietary, tested” label. Avoid the “Server” drivers.

    For example, you might select Using NVIDIA driver (open kernel) metapackage from nvidia-driver-525 (proprietary, tested).

    Note

    The “open kernel” driver is a new, open-source implementation of the NVIDIA kernel driver for recent GPUs. It depends on proprietary GPU firmware and proprietary user-space libraries.

  3. Click Apply changes and enter your password.

  4. When the installation is complete, restart your system for the changes to take effect.

  1. Check the available drivers for your hardware:

    $
    sudo ubuntu-drivers list
  2. Install the drivers.

    You can rely on automatic detection, which will install the driver that is considered the best match for your hardware:

    $
    sudo ubuntu-drivers install

    Alternatively, you can specify which driver you want. You have to type the driver version (such as 535) that you saw when you used the ubuntu-drivers list command.

    Let’s assume we want to install the 535 driver:

    $
    sudo ubuntu-drivers install nvidia:535
  1. Install the metapackage for your kernel flavor (e.g. generic, lowlatency, etc.), which is specific to the driver branch (e.g. 535) that you want to install:

    $
    sudo apt install linux-modules-nvidia-${DRIVER_BRANCH}-${LINUX_FLAVOUR}

    For example, install linux-modules-nvidia-535-generic.

  2. Check that the modules for your specific kernel/ABI were installed by the metapackage:

    $
    sudo apt-cache policy linux-modules-nvidia-${DRIVER_BRANCH}-$(uname -r)

    For example:

    $
    sudo apt-cache policy linux-modules-nvidia-535-$(uname -r)
  3. If the modules were not installed for your current running kernel, upgrade to the latest kernel or install them by specifying the running kernel version:

    $
    sudo apt install linux-modules-nvidia-${DRIVER_BRANCH}-$(uname -r)

    For example:

    $
    sudo apt install linux-modules-nvidia-535-$(uname -r)

When the installation is complete, restart your system for the changes to take effect.

Troubleshooting