Translation(s): English - Español - Français - Italiano - Русский - 简体中文


NVIDIA Proprietary Driver

This page describes how to install the NVIDIA proprietary display driver on Debian systems.

Commands in this article prefixed with a # indicate they must be run as root. Replace this character with sudo or switch user to root in your terminal beforehand as necessary.

NOTE: For Apple systems, follow these steps first to prevent a black screen after installing the drivers: http://askubuntu.com/a/613573/134848

Identification

The NVIDIA graphics processing unit (GPU) series/codename of an installed video card can usually be identified using the lspci command. For example:

See HowToIdentifyADevice/PCI for more information. The PCI ID can be used to verify device support.

Note: if this lspci command returns more than one line of output, you have an Optimus (hybrid) graphics chipset. After you install the necessary driver package, you'll still need to choose one of the methods on the NVIDIA Optimus page in order to activate and make use of your NVIDIA card.

nvidia-detect

The nvidia-detect script (found in the nvidia-detect package in the non-free section) can also be used to identify the GPU and the recommended driver package to install:


Desktop Drivers

The proprietary "NVIDIA Accelerated Linux Graphics Driver" provides optimized hardware acceleration of OpenGL and Vulkan applications through either Xorg or Wayland. It is a binary-only driver requiring a Linux kernel module for its use.

Multiple precompiled driver versions are available for Debian 10 "Buster":

Multiple precompiled driver versions are available for Debian 9 "Stretch":

All versions above are available only for the x86, x86-64, and 32-bit ARMv7 architectures (Debian i386, AMD64, and ARMHF ports respectively).


Installation

Kernel headers

Before installing the drivers, you must obtain the proper kernel headers for the drivers to build with.

For a typical 64-bit system using the default kernel, you can simply run:

# apt install linux-headers-amd64

For 32-bit systems with the non-PAE kernel, you'd instead install:

# apt install linux-headers-686

Or, for 32-bit systems with the PAE kernel:

# apt install linux-headers-686-pae

If you're using the kernel from Debian Backports, you must run the same command but with the -t flag followed by the name of your backports source. For instance, if you're using Buster's backports on a 64-bit system, you might run:

# apt install -t buster-backports linux-headers-amd64


Debian 10 "Buster"

Version 440.100 (via buster-backports)

For support of GeForce 600 series and newer GPUs (supported devices). For older devices, see Version 390.132 (legacy GPUs) and Version 340.108 (legacy GPUs).

  1. Add buster-backports to your /etc/apt/sources.list, for example:

    # buster-backports
    deb http://deb.debian.org/debian buster-backports main contrib non-free
  2. Then we can install the package nvidia-driver.

    # apt update
    # apt install -t buster-backports nvidia-driver 

    DKMS will build the nvidia module for your system, via the nvidia-kernel-dkms package.

  3. Reboot your system to load the updated driver.

Version 418.113

For support of GeForce 600 series and newer GPUs (supported devices). For older devices, see Version 390.132 (legacy GPUs) and Version 340.108 (legacy GPUs).

  1. Add "contrib" and "non-free" components to /etc/apt/sources.list, for example:

    # Debian 10 "Buster"
    deb http://deb.debian.org/debian/ buster main contrib non-free
  2. Update the list of available packages. Install the NVIDIA driver package:

    # apt update
    # apt install nvidia-driver

    DKMS will build the nvidia module for your system, via the nvidia-kernel-dkms package.

  3. Restart your system to load the new driver.

Version 390.132 (legacy GPUs)

For support of GeForce 400 series and newer GPUs (supported devices).

  1. Add "contrib" and "non-free" components to /etc/apt/sources.list, for example:

    # Debian 10 "Buster"
    deb http://deb.debian.org/debian/ buster main contrib non-free
  2. Update the list of available packages. Install the legacy NVIDIA driver:

    # apt update
    # apt install nvidia-legacy-390xx-driver

    DKMS will build the nvidia module for your system, via the nvidia-legacy-390xx-kernel-dkms package.

  3. Restart your system to load the new driver.

Version 340.108 (legacy GPUs)

For support of GeForce 8 series through GeForce 300 series GPUs. (supported devices).

  1. Add "contrib" and "non-free" components to /etc/apt/sources.list, for example:

    # Debian 10 "Buster"
    deb http://deb.debian.org/debian/ buster main contrib non-free
  2. Update the list of available packages. Install the NVIDIA driver package:

    # apt update
    # apt install nvidia-legacy-340xx-driver

    DKMS will build the nvidia module for your system, via the nvidia-legacy-340xx-kernel-dkms package.

    After, create an Xorg server configuration file and then restart your system to enable the nouveau blacklist.


Debian 9 "Stretch"

As of stretch, you don't need nvidia-xconfig anymore, and a xorg.conf file is not needed either in most situations. Also, the 340 series has been forked into its own series of packages to support older cards.

In some situations running nvidia-xconfig is still required for screen-locking and suspend/resume to work properly (922679 Xfce/lightdm/light-locker)

Version 418.152 (via stretch-backports)

For support of GeForce 700 series and newer GPUs (supported devices). For older devices, see Version 340.102 (legacy GPUs) and Version 304.137 (legacy GPUs).

  1. Add stretch-backports to your /etc/apt/sources.list, for example:

    # stretch-backports
    deb http://deb.debian.org/debian stretch-backports main contrib non-free
  2. Then we can install the package nvidia-driver.

    # apt update
    # apt install -t stretch-backports nvidia-driver 

    DKMS will build the nvidia module for your system, via the nvidia-kernel-dkms package.

  3. Restart your system to enable the nouveau blacklist.

Version 390.138

For support of GeForce 400 series and higher GPUs (supported devices). For older devices, see Version 340.105 (legacy GPUs) and Version 304.137 (legacy GPUs).

  1. Add "contrib" and "non-free" components to /etc/apt/sources.list, for example:

    # Debian 9 "Stretch"
    deb http://deb.debian.org/debian/ stretch main contrib non-free
  2. Update the list of available packages. Install the NVIDIA driver package:

    # apt update
    # apt install nvidia-driver

    DKMS will build the nvidia module for your system, via the nvidia-kernel-dkms package.

  3. Restart your system to enable the nouveau blacklist.

Version 340.108 (legacy GPUs)

For support of GeForce 8 series through GeForce 300 series GPUs (supported devices).

  1. Add "contrib" and "non-free" components to /etc/apt/sources.list, for example:

    # Debian 9 "Stretch"
    deb http://deb.debian.org/debian/ stretch main contrib non-free
  2. Update the list of available packages. Install the appropriate NVIDIA driver package:

    # apt update
    # apt install nvidia-legacy-340xx-driver

    DKMS will build the nvidia module for your system, via the nvidia-legacy-340xx-kernel-dkms package.

    After, create an Xorg server configuration file and then restart your system to enable the nouveau blacklist.

Version 304.137 (legacy GPUs)

For support of GeForce 6 series and GeForce 7 series GPUs (supported devices).

  1. Add "contrib" and "non-free" components to /etc/apt/sources.list, for example:

    # Debian 9 "Stretch"
    deb http://deb.debian.org/debian/ stretch main contrib non-free
  2. Update the list of available packages. Install the appropriate NVIDIA driver package:

# apt install nvidia-legacy-304xx-driver


Installing 32-bit libraries on a 64-bit system

In many cases, such as when running proprietary 32-bit games from Steam or in Wine, you may need 32-bit graphics libraries on your 64-bit system in order for them to function properly. This has been made much easier since Debian 9/Stretch and now requires minimal extra work.

Note that the following instructions assume that sudo is configured on your system. If it isn't, either follow the instructions on the sudo wiki page or omit the sudo and run these commands as root.

After installing the drivers, enable 32-bit multiarch and update your repository listing by running:

sudo dpkg --add-architecture i386 && sudo apt update

The helper package nvidia-driver-libs-i386 will then help with installing all of the 32-bit NVIDIA graphics libraries necessary to run 32-bit games and applications:

sudo apt install nvidia-driver-libs-i386

Restarting the relevant applications may be necessary before they function correctly.

WARNING: If you're forced to use a legacy driver, you will want to instead install one of nvidia-legacy-390xx-driver-libs-i386, nvidia-legacy-340xx-driver-libs-i386, or nvidia-legacy-304xx-driver-libs-i386.


Tesla Drivers

The NVIDIA line-up of programmable "Tesla" devices, used primarily for simulations and large-scale calculations, also require separate driver packages to function correctly compared to the consumer-grade GeForce GPUs that are instead targeted for desktop and gaming usage.

In Debian 10/Buster, only one version of the driver is supported and you must enable backports in order to install it. Afterwards, it can be obtained by installing the nvidia-tesla-418-driver package.

In Debian 11/Bullseye, the major 418 and 440 releases of the Tesla driver are available without the need to enable backports. They can be found in the nvidia-tesla-418-driver and nvidia-tesla-440-driver packages respectively.

32-bit libraries can be found in the nvidia-tesla-418-driver-libs-i386 or nvidia-tesla-440-driver-libs-i386 package as necessary. Multiarch must be enabled.


Configuration

As the NVIDIA driver is not autodetected by Xorg, a configuration file is required to be supplied. Modern Debian packages for the NVIDIA driver should not require you to do anything listed here as they handle this automatically during installation, but if you run into issues, or are using a much older version of Debian, you may try going through these steps.

Automatic

Install the nvidia-xconfig package, then run it with sudo. It will automatically generate a Xorg configuration file at /etc/X11/xorg.conf.

Manual

For example:

/etc/X11/xorg.conf.d/20-nvidia.conf

The configuration file above can be created using these commands:

Please note that this configuration will break Xorg on Optimus systems. For such hardware, see NVIDIA Optimus instead.

Restart your system at this point to enable the nouveau driver blacklist.

Additional configuration information is available.


CUDA

Debian 10 "Buster"

CUDA 9 is available from the non-free repository:

# apt install nvidia-cuda-dev nvidia-cuda-toolkit

And, if Backports are enabled, CUDA 10 is available similarly:

# apt -t buster-backports install nvidia-cuda-dev nvidia-cuda-toolkit

This installs nvcc and friends. The visual profiler is in a separate package named nvidia-visual-profiler.

Debian 9 "Stretch"

CUDA 8 is available from the non-free repository:

# apt install nvidia-cuda-dev nvidia-cuda-toolkit 

This installs nvcc and friends. The visual profiler is in a separate package named nvidia-visual-profiler.

CUDA 8 only supports gcc 5.3.1, which is not available for Stretch. To compile you need to add -ccbin clang-3.8 to the nvcc command line.

The Debian CUDA packages unfortunately do not include the Toolkit samples. To install these yourself you need to download the "Ubuntu 16.04" .run install file for CUDA 8 from https://developer.nvidia.com/cuda-downloads. Execute the .run file and (after accepting the licence and agreeing to run on a non-supported system) skip the driver and toolkit installation and just select "Samples. Note before this step you must

export PERL5LIB=. 

To compile the samples, you first need to set

export HOST_COMPILER=clang++-3.8

Note that if you are mixed code compiled with gcc and nvcc, you may need to also add

--compiler-options -fpie 

to the nvcc command line.


Troubleshooting

Uninstallation

If you run into issues with the drivers, switch to a different card, or simply want to use the open-source Nouveau drivers instead, uninstallation is made easy with recent versions of the drivers.

Also note that if issues with the driver prevent you from accessing a desktop, you can access a full-screen TTY with Ctrl-Alt-F3 (or almost any of the "F" keys).

You can remove all packages on your system with nvidia in the name by running:

# apt purge *nvidia*

And then reboot the system with:

systemctl reboot

This should leave you with a functioning system in almost all cases. If it seems to still be having issues, you may also try running:

# apt install --reinstall xserver-xorg-core xserver-xorg-video-nouveau

Or:

# X -configure

See Also


CategoryProprietarySoftware CategoryHardware CategoryVideo