Differences between revisions 1 and 340 (spanning 339 versions)
Revision 1 as of 2005-11-14 06:49:41
Size: 5161
Comment: just starting
Revision 340 as of 2020-12-05 02:14:46
Size: 21408
Comment: Version bump for 450.80.02 in buster-backports, and upgrade HTTP links to HTTPS
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
This document explains how to make use of NVIDIA video hardware for ["Debian"] GNU/Linux users, who are the primary target. However, most (if not all) of Debian derivatives, including Libranet, Mepis, Ubuntu, and Xandros, should work in the same way. The following section shortly describes the ["free"] drivers while the rest of the document covers the non-free but 3D-accelerated drivers.

= free drivers =
Two free drivers in Debian support NVIDIA cards. You are probably reading this page using one of these drivers. The '''vesa''' driver is a generic video driver. You should get better results with the '''nv''' driver. You can see which one is in use .........................
You can simply [wiki:Self:ConfigureX configure X] to change the free driver to use.

However, both of these drivers do not support 3D acceleration. Only the ["non-free"] '''nvidia''' driver supports this. If you are willing to use this driver despite the fact that it is non-free, read the following section. If you do, keep in mind that using the non-free drivers is considerably more complex and things are much more likely to break. If this happens and you give up trying to get X working again due to the '''nvidia''' driver, remember that simply switching back to one of the free drivers should let you run X again until you find a way to get 3D acceleration working again.

= non-free drivers =
== Why a Debian-specific method? ==

To install the NVIDIA drivers, you can use either NVIDIA's official installer or the Debian driver packages. Each method has its advantages, as described below. NVIDIA's installer used to be easier to use; but with the advent of module-assistant, the Debian way is probably easier. Even if you choose to build your driver module manually, in the long run you'll probably find that the Debian way will save you work. The Debian way is of course the most reliable.

Unless you had issues with the Debian way, you probably just want to skip to the '''Installation''' section. NVIDIA's installer is already documented at other places (such as [http://www.gmpf.de/index.php/NVidia:Basic_Installation this one]), so the Installation section of this HOWTO is all about the Debian way. Either way, you may find the Troubleshooting section to be of interest.

=== Comparison of nvidia-installer and the Debian way ===
..............
The method described here is "the Debian way": you install Debian packages as usual, for your specific kernel. This method has some advantages, compared to using NVIDIA's official installer:

    * It's more automated once it's set up, so it saves you work if you rebuild your kernel very often, as I do.
    * It uses the Debian package management tools, so it's cleaner.
    * If you're already using make-kpkg to build your kernel, it fits easily into your existing build procedure.
    * It will also save you work if you build other kernel modules (e.g. lm-sensors or fuse) outside of the kernel tree, because all of the driver packages get built at the same time with a single invocation of make-kpkg.
    * module-assistant has now taken much of the grunt work out of this task, making it about as easy as using the official installer.

However, you don't have to build your drivers this way. Many people prefer just to get and run an official installer from nVidia. This method also has advantages:

    * You may get more recent versions of the NVIDIA drivers, since the Debian packages tend to lag by a month or two, which can be needed if the version in Debian didn't support your hardware. You can compare the [http://www.nvidia.com/object/unix.html current version] and the [http://packages.debian.org/nvidia-glx version in your Debian release] to see how much difference there is.
    * The official installer is easy to use, although you will probably get tired of rerunning it if you rebuild your kernel more than a few times. (Every time you rebuild your kernel you have to wait until you reboot, wait for your X server to die, navigate the installer menus, and then restart X. It gets old. That's why this guide was writen :)
    * You won't have to learn about module-assistant, or make-kpkg. Wait, is this an advantage?
    * People have occasionally reported that even after some work, they just couldn't get their drivers to work using the Debian way. Once they used the NVIDIA installer everything worked smoothly.

== Target audience ==
The following method should work with any 2.4 or 2.6 Linux kernel, with either stock or custom kernels, and with ["Sarge"], ["Etch"] and ["Sid"] (assuming Sid works). Although there are Debian packages for the drivers in ["Woody"], if you are looking to make some fun gaming, consider the fun of upgrading to Sarge first.

== Installation ==



= About this document =
The Links page has links to nVidia driver packages, support forums, other HOWTOs, and anything else I find that can help you to get your nVidia hardware working under Debian.

For problems, comments, or questions about the information in this HOWTO, you can write to me. I'm no expert, but I'll do my best to make the information useful.
#language en
~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[es/NvidiaGraphicsDrivers|Español]] - [[fr/NvidiaGraphicsDrivers|Français]] - [[it/NvidiaGraphicsDrivers|Italiano]] - [[ru/NvidiaGraphicsDrivers|Русский]] - [[zh_CN/NvidiaGraphicsDrivers|简体中文]]-~
----
= 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: https://askubuntu.com/a/613573/134848

<<TableOfContents(5)>>

== Identification ==

The NVIDIA graphics processing unit (GPU) series/codename of an installed video card can usually be identified using the {{{lspci}}} command. For example:
 {{{
$ lspci -nn | egrep -i "3d|display|vga"
07:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM206 [GeForce GTX 960] [10de:1401] (rev a1)
}}}

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 [[https://www.nvidia.com/object/optimus_technology.html|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 DebianPkg:nvidia-detect package in the [[https://www.debian.org/doc/debian-policy/ch-archive#s-non-free|non-free]] section) can also be used to identify the GPU and the recommended driver package to install:
 {{{
$ nvidia-detect
Detected NVIDIA GPUs:
07:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM206 [GeForce GTX 960] [10de:1401] (rev a1)

Checking card: NVIDIA Corporation GM206 [GeForce GTX 960] (rev a1)
Your card is supported by all driver versions.
Your card is also supported by the Tesla 440 drivers series.
Your card is also supported by the Tesla 418 drivers series.
It is recommended to install the
    nvidia-driver
package.
}}}
----
== 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 [[DebianBuster|Debian 10 "Buster"]]:

 * [[#buster-450|Version 450.80.02]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/450.80.02/README/supportedchips.html|supported devices]])
  * Supports Kepler, Maxwell, Pascal, and all current Turing GPUs. Supports Vulkan 1.2 and OpenGL 4.6.
  * Note that 450.80.02 is currently only available in buster-backports.
 * [[#buster-418|Version 418.152]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/418.113/README/supportedchips.html|supported devices]])
  * Supports Kepler, Maxwell, Pascal, and most Turing GPUs. Supports Vulkan 1.1 and OpenGL 4.6.
 * [[#buster-390|Version 390.132]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/390.132/README/supportedchips.html|supported devices]])
  * Supports Fermi, Kepler, Maxwell, and most Pascal GPUs. Supports Vulkan 1.0 on Kepler and newer, supports up to OpenGL 4.5 depending on your card.
 * [[#buster-340|Version 340.108 (legacy GPUs)]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/340.108/README/supportedchips.html|supported devices]])
  * Older legacy driver, for !GeForce 8 series through !GeForce 300 series. No Vulkan support, supports up to OpenGL 3.3 depending on your card.

Multiple precompiled driver versions are available for [[DebianStretch|Debian 9 "Stretch"]]:

 * [[#stretch-418|Version 418.152]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/418.113/README/supportedchips.html|supported devices]])
  * Supports Kepler, Maxwell, Pascal, and most Turing GPUs. Supports Vulkan 1.1 and OpenGL 4.6.
  * Note that 418.152 is currently only available in stretch-backports.
 * [[#stretch-390|Version 390.138]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/390.138/README/supportedchips.html|supported devices]])
  * Supports Fermi, Kepler, Maxwell, and most Pascal GPUs. Supports Vulkan 1.0 on Kepler and newer, supports up to OpenGL 4.5 depending on your card.
 * [[#stretch-340xx|Version 340.108 (legacy GPUs)]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/340.108/README/supportedchips.html|supported devices]])
  * Older legacy driver, for !GeForce 8 series through !GeForce 300 series. No Vulkan support, supports up to OpenGL 3.3 depending on your card.
 * [[#stretch-304xx|Version 304.137 (legacy GPUs)]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/304.137/README/supportedchips.html|supported devices]])
  * Even older legacy driver, for !GeForce 6 series and !GeForce 7 series. Only supports OpenGL 2.1.

All versions above are available only for the x86, x86-64, and 32-bit ARMv7 architectures (Debian [[i386]], [[DebianAMD64|AMD64]], and [[ArmHardFloatPort|ARMHF]] ports respectively).
----
=== Installation ===

==== Kernel ====

There were cases when just installing {{{nvidia-driver}}} package (from [[Backports|Debian Backports]]) was not sufficient.
If this is the case, then there is an option to consider upgrading the Linux kernel to [[Backports|Debian Backports]] version as well:
{{{
# apt install -t buster-backports linux-image-amd64
}}}

==== 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 [[Backports|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" ====

<<Anchor(buster-450)>>
===== Version 450.80.02 (via buster-backports) =====

For support of !GeForce 600 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/450.80.02/README/supportedchips.html|supported devices]]). For older devices, see [[#buster-390|Version 390.132 (legacy GPUs)]] and [[#buster-340|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
}}}

 1. Then we can install the package DebianPkg:nvidia-driver.{{{
# apt update
# apt install -t buster-backports nvidia-driver
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-kernel-dkms package.

 1. Reboot your system to load the updated driver.

<<Anchor(buster-418)>>

===== Version 418.152 =====

For support of !GeForce 600 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/418.113/README/supportedchips.html|supported devices]]). For older devices, see [[#buster-390|Version 390.132 (legacy GPUs)]] and [[#buster-340|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
}}}
 1. 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 DebianPkg:nvidia-kernel-dkms package.
 1. Restart your system to load the new driver.

<<Anchor(buster-390)>>
===== Version 390.132 (legacy GPUs) =====

For support of !GeForce 400 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86/390.132/README/supportedchips.html|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
}}}
 1. 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 DebianPkg:nvidia-legacy-390xx-kernel-dkms package.
 1. Restart your system to load the new driver.

<<Anchor(buster-340)>>
===== Version 340.108 (legacy GPUs) =====

For support of !GeForce 8 series through !GeForce 300 series GPUs. ([[https://us.download.nvidia.com/XFree86/Linux-x86/340.108/README/supportedchips.html|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
}}}
 1. 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 [[#configure|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 (DebianBug:922679 Xfce/lightdm/light-locker)

<<Anchor(stretch-418)>>
===== Version 418.152 (via stretch-backports) =====

For support of !GeForce 700 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/418.152/README/supportedchips.html|supported devices]]). For older devices, see [[#stretch-340xx|Version 340.102 (legacy GPUs)]] and [[#stretch-304xx|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
}}}

 1. Then we can install the package DebianPkg:nvidia-driver.{{{
# apt update
# apt install -t stretch-backports nvidia-driver
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-kernel-dkms package.

 1. Restart your system to enable the nouveau blacklist.

<<Anchor(stretch-390)>>
===== Version 390.138 =====

For support of !GeForce 400 series and higher GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/390.138/README/supportedchips.html|supported devices]]). For older devices, see [[#stretch-340xx|Version 340.105 (legacy GPUs)]] and [[#stretch-304xx|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
}}}
 1. 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 DebianPkg:nvidia-kernel-dkms package.
 1. Restart your system to enable the nouveau blacklist.

<<Anchor(stretch-340xx)>>
===== Version 340.108 (legacy GPUs) =====

For support of !GeForce 8 series through !GeForce 300 series GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86/340.108/README/supportedchips.html|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
}}}
 1. 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 DebianPkg:nvidia-legacy-340xx-kernel-dkms package.

 After, create an [[#configure|Xorg server configuration file]] and then restart your system to enable the nouveau blacklist.

<<Anchor(stretch-304xx)>>
===== Version 304.137 (legacy GPUs) =====

For support of !GeForce 6 series and !GeForce 7 series GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86/304.137/README/supportedchips.html|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
}}}
 1. Update the list of available packages. Install the appropriate NVIDIA driver package:
{{{
# apt install nvidia-legacy-304xx-driver
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-legacy-304xx-kernel-dkms package.

 After, create an [[#configure|Xorg server configuration file]] and then restart your system to enable the nouveau blacklist.

----

<<Anchor(multiarch-install)>>
=== 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 [[DebianStretch|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
}}}
Afterwards, to install the 32-bit version of the NVIDIA libraries package, run:
{{{
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 [[DebianBuster|Debian 10/Buster]], the default DebianPkg:nvidia-driver package is based on the Tesla release. This was done in order to resolve several critical security issues, but it means that there is no need to install the separate package for Tesla devices to work. If you need a newer release, the 450-series driver is available in backports via the DebianPkg:nvidia-tesla-450-driver package.

In [[DebianBullseye|Debian 11/Bullseye]], the major 418, 440, and 450 releases of the Tesla driver are available and distinct from the default driver. They can be found in the DebianPkg:nvidia-tesla-418-driver, DebianPkg:nvidia-tesla-440-driver, and DebianPkg:nvidia-tesla-450-driver packages respectively.

The 32-bit libraries can be obtained by installing {{{nvidia-tesla-418-driver-libs:i386}}}, {{{nvidia-tesla-440-driver:i386}}}, or {{{nvidia-tesla-450-driver:i386}}} based on the version of your driver. [[Multiarch/HOWTO|Multiarch]] must be enabled.

----
<<Anchor(configure)>>
== 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}}}
 {{{
Section "Device"
 Identifier "My GPU"
 Driver "nvidia"
EndSection
}}}

The configuration file above can be created using these commands:
 {{{
# mkdir -p /etc/X11/xorg.conf.d
# echo -e 'Section "Device"\n\tIdentifier "My GPU"\n\tDriver "nvidia"\nEndSection' > /etc/X11/xorg.conf.d/20-nvidia.conf
}}}

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.'''

[[/Configuration|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 DebianPkg: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 DebianPkg: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`, [[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=861878|you may need to also add]]
{{{
--compiler-options -fpie
}}}
to the {{{nvcc}}} command line.

----

== Troubleshooting ==

 * The NVIDIA driver conflicts with the nouveau DRM driver (DebianBug:580894). The nouveau kernel module is blacklisted by the DebianPkg:glx-alternative-nvidia or DebianPkg:nvidia-kernel-common packages.
  * Restart your system after [[#configure|configuring Xorg]] for the NVIDIA driver.
  * From [[DebianPkg:xserver-xorg-video-nouveau]]'s README.Debian: {{{
If you decide to switch to the proprietary driver, it is highly
recommended to reboot because it is incompatible with nouveau, and
unloading the latter is not easy and may lead to a blank console.
}}}
 * If you can't change the screen brightness, open your Xorg configuration file ({{{/etc/X11/xorg.conf}}} or {{{/etc/X11/xorg.conf.d/20-nvidia.conf}}} depending on which method you used) and add {{{
    Option "RegistryDwords" "EnableBrightnessControl=1;"
}}} to the {{{Device}}} section. In some case (eg. !GeForce GT 650M Mac Edition) it may cause screen flickering during boot time (just after grub screen), and system will not boot. In this case you should use instead add the following: {{{
setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0
}}} to the file: {{{/etc/rc.local}}}
 * You can check whether or not the kernel module for the NVIDIA driver has been loaded, in addition to what version is currently loaded, by running {{{/sbin/modinfo -F version nvidia-current}}}
 * [[/Troubleshooting|Additional troubleshooting information]] is available.

----

== 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 ==

 * [[/Configuration]]
 * [[/Troubleshooting]]
 * [[NVIDIA Optimus]]
 * [[Xorg]]

----

CategoryProprietarySoftware CategoryHardware CategoryVideo

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: https://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:

  • $ lspci -nn | egrep -i "3d|display|vga"
    07:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM206 [GeForce GTX 960] [10de:1401] (rev a1)

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:

  • $ nvidia-detect 
    Detected NVIDIA GPUs:
    07:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM206 [GeForce GTX 960] [10de:1401] (rev a1)
    
    Checking card:  NVIDIA Corporation GM206 [GeForce GTX 960] (rev a1)
    Your card is supported by all driver versions.
    Your card is also supported by the Tesla 440 drivers series.
    Your card is also supported by the Tesla 418 drivers series.
    It is recommended to install the
        nvidia-driver
    package.


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

There were cases when just installing nvidia-driver package (from Debian Backports) was not sufficient. If this is the case, then there is an option to consider upgrading the Linux kernel to Debian Backports version as well:

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

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 450.80.02 (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.152

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

Afterwards, to install the 32-bit version of the NVIDIA libraries package, run:

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, the default nvidia-driver package is based on the Tesla release. This was done in order to resolve several critical security issues, but it means that there is no need to install the separate package for Tesla devices to work. If you need a newer release, the 450-series driver is available in backports via the nvidia-tesla-450-driver package.

In Debian 11/Bullseye, the major 418, 440, and 450 releases of the Tesla driver are available and distinct from the default driver. They can be found in the nvidia-tesla-418-driver, nvidia-tesla-440-driver, and nvidia-tesla-450-driver packages respectively.

The 32-bit libraries can be obtained by installing nvidia-tesla-418-driver-libs:i386, nvidia-tesla-440-driver:i386, or nvidia-tesla-450-driver:i386 based on the version of your driver. 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

  • Section "Device"
            Identifier "My GPU"
            Driver "nvidia"
    EndSection

The configuration file above can be created using these commands:

  • # mkdir -p /etc/X11/xorg.conf.d
    # echo -e 'Section "Device"\n\tIdentifier "My GPU"\n\tDriver "nvidia"\nEndSection' > /etc/X11/xorg.conf.d/20-nvidia.conf

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

  • The NVIDIA driver conflicts with the nouveau DRM driver (580894). The nouveau kernel module is blacklisted by the glx-alternative-nvidia or nvidia-kernel-common packages.

    • Restart your system after configuring Xorg for the NVIDIA driver.

    • From xserver-xorg-video-nouveau's README.Debian:

      If you decide to switch to the proprietary driver, it is highly
      recommended to reboot because it is incompatible with nouveau, and
      unloading the latter is not easy and may lead to a blank console.
  • If you can't change the screen brightness, open your Xorg configuration file (/etc/X11/xorg.conf or /etc/X11/xorg.conf.d/20-nvidia.conf depending on which method you used) and add

        Option         "RegistryDwords" "EnableBrightnessControl=1;"

    to the Device section. In some case (eg. GeForce GT 650M Mac Edition) it may cause screen flickering during boot time (just after grub screen), and system will not boot. In this case you should use instead add the following:

    setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0

    to the file: /etc/rc.local

  • You can check whether or not the kernel module for the NVIDIA driver has been loaded, in addition to what version is currently loaded, by running /sbin/modinfo -F version nvidia-current

  • Additional troubleshooting information is available.


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