Differences between revisions 141 and 374 (spanning 233 versions)
Revision 141 as of 2010-06-11 00:48:47
Size: 30089
Comment: fix link to my page
Revision 374 as of 2022-06-12 10:59:35
Size: 40431
Editor: PengouinPdt
Comment: Change all "Facultative" terms by "Note about SecureBoot", because the relevent information is not facultative.
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
||<tablewidth="100%"style="border: 0px hidden ;">~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: [[fr/NvidiaGraphicsDrivers|Français]] - [[es/NvidiaGraphicsDrivers|Español]]-~ ||
----
 . This document explains how to make use of NVIDIA video hardware on a [[Debian]] GNU/Linux system. The [[#free|following section]] shortly describes the free drivers while the [[#non-free|rest of the document]] covers the non-free but 3D-accelerated drivers.
<<TableOfContents>>

<<Anchor(free)>>

= free drivers =
Debian has two free drivers that support NVIDIA cards. The ''vesa'' driver is a generic video driver. The ''nv'' driver usually gives better results. You can see which one is in use running

{{{
$ grep -B2 'Module class: X.Org Video Driver' /var/log/Xorg.0.log
}}}
You can simply [[ConfigureX|configure X]] to change the free driver to use.

Neither of the free drivers support 3D acceleration. Only the non-free ''nvidia'' drivers support 3D. The non-free drivers are more complex and X is more likely to break. If X breaks and it seems difficult to get X to work with the non-free ''nvidia'' drivers, remember that switching back to a free driver should get X working again.

<<Anchor(non-free)>>

= non-free drivers =
== Why use a Debian-specific method? ==
NVIDIA drivers can be installed using NVIDIA's official installer or the Debian driver packages. Each method has its advantages, but the Debian way is probably easier. Even when building a driver module manually, the Debian way is more reliable and probably will save labor in the long run.

NVIDIA's installer is documented at other places such as [[NvidiaGraphicsDriversNvidiaWay|this one]].

Whichever installation method, the [[#Troubleshooting|troubleshooting section]] may help.

=== Comparison of nvidia-installer and the Debian way ===
Advantages of "the Debian way":

 * More automated, which saves work if the kernel is changed.
 * Uses Debian package management tools, so it's cleaner. If your system breaks after using the Debian way, that would be a bug which can be reported in the BTS.
 * Can be done while X is running. (X must be restarted to apply the driver change.)
 * Users of ''make-kpkg'' should find it fits easily into their existing build procedure.
 * No downloading files from ''nvidia.com'', the Debian packages contain all necessary parts.
Advantages of NVIDIA's official installer:

 * Most recent NVIDIA driver versions. Debian packages commonly lag behind a month or more. You can compare the [[http://www.nvidia.com/object/unix.html|current version]] and the [[DebianPkg:nvidia-glx|latest version in your Debian release]] to see if there's a difference.
<<Anchor(Installation)>>

== Installation ==
How to install the NVIDIA 3D drivers, the Debian way.

=== Overview ===
The NVIDIA 3D drivers consist of two parts: a kernel module, and a collection of user-space libraries and a X video driver. The libraries and the X driver (sometimes called the "binary driver" or GLX libraries) are distributed in binary form by NVIDIA, and are packaged for Debian in the DebianPkg:nvidia-glx packages. Since NVIDIA's 3D drivers are not open source, non-free APT sources are needed to install them. The kernel module (aka the "kernel interface to the binary driver") is distributed in source form (though with one binary component), and packaged for Debian in the DebianPkg:nvidia-kernel-source packages. The version numbers of the kernel module and user-space libraries and X video driver must match. User libraries only need be installed once, but the kernel module must be recompiled every time the kernel is changed. What to do:

 * 0. Make sure APT has ''non-free'' and ''contrib'' sources (consult the [[DebianMan:5/sources.list|sources.list(5)]] man page for help on doing this)
 * 1. Determine which version of the drivers should be installed.
 * 2. Install the kernel module
 * 3. Install the user-space GLX libraries and the X driver
 * 4. Configure X to use the ''nvidia'' driver
Steps 3 and 4 need only be done once, but Step 2 is required every time the kernel is changed.

=== Steps ===
<<Anchor(Legacy)>>

==== Choose a driver version ====
The current drivers do not support some legacy NVIDIA cards. Up to now, the NVIDIA drivers dropped support for some legacy cards 3 times. However, NVIDIA maintains the last driver version released before a legacy cards support drop. This means there are currently 4 drivers series maintained by NVIDIA. The first support drop happened in 2005, so the oldest legacy drivers series (71''xx'') should support cards released before 2005 but not those released after 2005. The second support drop happened in 2006, leading to the 96''xx'' legacy drivers series. The third support drop happened in 2008, leading to the 173.14 legacy drivers series.

Debian Lenny only contains 2 drivers series from the 4 available, while Squeeze only contains one. Due to the lacking versions, these suites do not officially support all NVIDIA cards, although it may be possible to install unofficial packages if your card requires a drivers series not available in your suite. Lenny contains the second oldest drivers series, 96.43, and the newest legacy series, 173.14. Squeeze only contains the current series. This means that Lenny lacks support for the newest and oldest cards, while Squeeze lacks support for any "legacy" card. The oldest drivers series, 71xx, is not in any current Debian suite (except unstable, but unusable). It is basically impossible to use the nvidia driver on cards no longer supported after 71xx on a current Debian suite.

The 71xx version is the only one to support RIVA TNT, RIVA TNT2/TNT2 Pro, RIVA TNT2 Ultra, Vanta/Vanta LT, RIVA TNT2 Model 64/Model 64 Pro, Aladdin TNT2, !GeForce 256, !GeForce DDR, Quadro, !GeForce2 GTS / !GeForce2 Pro, !GeForce2 Ti, !GeForce2 Ultra and Quadro2 Pro. The current version does not support !GeForce2 and !GeForce4 cards.

Debian distributes several versions of the drivers using several packages with different names. For example, the X driver and user-space libraries from the current series are in the ''nvidia-glx'' package. However, with time, the current drivers become legacy drivers, so the ''nvidia-glx'' package in Lenny is not current anymore.

Use current drivers if possible. You can determine which cards are supported by consulting [[http://us.download.nvidia.com/XFree86/Linux-x86/195.36.24/README/supportedchips.html|Appendix A of NVIDIA's 195.36.24 driver README]].

Set a VERSION variable, which the rest of the instructions will refer to, to "-legacy-96xx" or an empty string. If you want to install the default version from your suite, there is no need to set VERSION to the empty string. To find the name of a card, you can try ''lspci''. To determine which version you should use, you can run [[attachment:nvidia-versions.sh|this script]], which will propose to set VERSION.

==== Install the kernel module ====
===== Stock or custom kernel? =====
Some of the installation methods below depend on whether you're running a stock kernel, i.e. a prebuilt kernel from the Debian distribution. If you know which kind of kernel you have, you can skip to the [[#Methods|following section]].

By default, Debian comes with a stock kernel. If you don't know what kind of kernel you're running, then it's probably a stock kernel. If you're not sure, run

{{{
$ uname -r
}}}
and check if the output looks like 2.*.*-small number-architecture (e.g. or 2.6.18-6-486). If it does, you're most likely running a stock kernel.

<<Anchor(Methods)>>

===== Methods =====
There are four different methods for installing the kernel module.

<<Anchor(Method1)>>

===== Use module-assistant =====
This method is easy, and should work with most stock or custom kernels. For a custom kernel, you need to have its Linux headers installed.

It needs DebianPkg:module-assistant and DebianPkg:nvidia-kernel-common. To install them with apt-get:

{{{
# apt-get install module-assistant nvidia-kernel-common
}}}
Run the following command:

{{{
# m-a auto-install nvidia-kernel${VERSION}-source
}}}
And that's it. If all went well, your ''nvidia'' kernel module is now built and installed; you may [[#Libraries|proceed to step 3]]. If not, read the rest of this section.

You must use the same version of gcc to build your nvidia kernel module as was used to build your kernel. This might be a problem if you are running a stock kernel. If module-assistant fails, read its log output and look for messages suggesting that you need, for example, gcc-4.0 instead of gcc-4.1. Then install the corresponding package and retry ''auto-install''.

You also might have problems if a previous (failed) attempt at building the nvidia kernel module has left stuff at /usr/src/modules/nvidia-kernel/

If this happens, you can try removing the old files:

{{{
# rm -r /usr/src/modules/nvidia-kernel/
}}}

and running "auto-install" again.
 * This issue should be confirmed. If this solution helped you, please [[mailto:chealer@gmail.com?subject=Debian-NVIDIA|tell the maintainer]]. /* 2009-07-04 */

The ''auto-install'' step is the biggest step of the procedure, and is the most likely to fail. ''auto-install'' can be divided in smaller module-assistant steps, which can help debugging:

 * ''get''
 * ''build''
 * ''install''
If # m-a get nvidia; fails, try installing the DebianPkg:nvidia-kernel-source package. If APT fails to install nvidia-kernel-source, you should go back to step 0 and make sure you didn't miss something.

If you are unable to install the module using module-assistant, try [[#Method2|installing a pre-built module]] if you use a stock kernel or try to [[#Method3|build manually, with a custom kernel]].

<<Anchor(Method2)>>

===== Install a pre-built module =====
This method is easy if you're running a recent stock kernel for which a pre-built module is available; it will not work at all if you're running a custom kernel or Debian 4 with Linux 2.6.24. There are pre-built modules available for all the kernels installed by default by Debian Lenny. If the module-assistant method doesn't work for you and there are pre-built modules available for your kernel, use this method.

If you don't know your kernel version, run

{{{
$ uname -r
}}}
If there is a pre-built module for your kernel, install its package. The name starts with "nvidia-kernel-". This is followed by an indication of the drivers series you want (this string is empty for the default drivers series). The name ends by the identifier of your Linux image. For example, with apt-get:

{{{
# apt-get install nvidia-kernel${VERSION}-$(uname -r)
}}}
If this step succeeds, you may now [[#Libraries|proceed to step 3]]. If there are no pre-built modules for your kernel, and [[#Method1|method 1]] fails, you may want to try [[#Method4|method 4]].

<<Anchor(Method3)>>

===== Build manually, with a custom kernel =====
Use this method if you're configuring and building a custom kernel. This method is known to be possibly inexact or incomplete.

 1. Install the kernel module source. For example, with apt-get:
~-[[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:
Line 150: Line 18:
# apt-get install nvidia-kernel${VERSION}-source
}}}
 This will install a source tarball in ''/usr/src/''. Unpack it in ''/usr/src'':
$ 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:
Line 154: Line 30:
$ cd /usr/src
# tar -xf nvidia-kernel-*.tar.gz
}}}
 This will unpack the kernel module sources into ''/usr/src/modules/nvidia-kernel[something]''.

 1. Configure your kernel. This step isn't documented here; if you need to learn how, see the kernel-package documentation. But in summary, what you have to do is
$ 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 [[DebianSid|Debian Unstable "Sid"]]:
 * [[#sid-470|Version 470.103.00]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/470.103.01/README/supportedchips.html|supported devices]])
  * Supports Kepler, Maxwell, Pascal, Turing, and all current Ampere GPUs. Supports Vulkan 1.2 and OpenGL 4.6.
 * [[#sid-390|Version 390.144]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/390.144/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.
 * [[#sid-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.
  * '''Use of the 340-series driver is strongly discouraged.''' It is not included in stable releases of Debian anymore, has serious unfixable security vulnerabilities, and may not be updated for new kernels in a timely manner. You are highly recommended to use the built-in Nouveau driver if security is a priority.

Multiple precompiled driver versions are available for [[DebianBookworm|Debian 12 "Bookworm"]]:
 * [[#bookworm-470|Version 470.103.01]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/470.103.01/README/supportedchips.html|supported devices]])
  * Supports Kepler, Maxwell, Pascal, Turing, and all current Ampere GPUs. Supports Vulkan 1.2 and OpenGL 4.6.
 * [[#bookworm-390|Version 390.144]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/390.144/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.

Multiple precompiled driver versions are available for [[DebianBullseye|Debian 11 "Bullseye"]]:
 * [[#bullseye-470|Version 470.103.01]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/470.103.01/README/supportedchips.html|supported devices]])
  * Supports Kepler, Maxwell, Pascal, Turing, and all current Ampere GPUs. Supports Vulkan 1.2 and OpenGL 4.6.
 * [[#bullseye-460|Version 460.91.03]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/460.91.03/README/supportedchips.html|supported devices]])
  * Supports Kepler, Maxwell, Pascal, Turing, and all current Ampere GPUs. Supports Vulkan 1.2 and OpenGL 4.6.
 * [[#bullseye-390|Version 390.144]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/390.144/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.
  
Multiple precompiled driver versions are available for [[DebianBuster|Debian 10 "Buster"]]:

 * [[#buster-460|Version 460.73.01]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/460.73.01/README/supportedchips.html|supported devices]])
  * Supports Kepler, Maxwell, Pascal, Turing, and all current Ampere GPUs. Supports Vulkan 1.2 and OpenGL 4.6.
  * Note that 460.73.01 is only available in buster-backports.
 * [[#buster-418|Version 418.197.02]] ([[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.143]] ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/390.143/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 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 driver versions up to, and including, the 418-series, are only available for the x86, x86-64, and 32-bit ARMv7 architectures (Debian [[i386]], [[DebianAMD64|AMD64]], and [[ArmHardFloatPort|ARMHF]] ports respectively).

The 450-series and newer has dropped support for 32-bit architectures, now only supporting x86-64 and ARMv8 (Debian [[DebianAMD64|AMD64]] and [[Arm64Port|ARM64]] ports respectively).
----
=== Prerequisites ===

==== Kernel headers ====

Before installing the drivers, you '''must''' obtain the proper kernel headers for the NVIDIA driver 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 backports on a 64-bit Debian 10 system, you might run:
{{{
# apt install -t buster-backports linux-headers-amd64
}}}

----

==== Kernel ====

In some cases, if you're aiming to install the bleeding-edge version of the NVIDIA driver from Debian Backports, you may
also need to install the kernel from backports to match it. For Debian 10, you might do this with:
{{{
# apt install -t buster-backports linux-image-amd64
}}}
Exchange "buster-backports" with your own version's backports repository as necessary.

----

=== Installation ===
==== Debian Unstable "Sid" ====

<<Anchor(sid-470)>>
===== Version 470.103.01 =====
For support of !GeForce 600 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/470.103.01/README/supportedchips.html|supported devices]]). For older devices, see [[#sid-390|Version 390 (legacy GPUs]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian Sid
deb http://deb.debian.org/debian/ sid main contrib non-free
}}}
 1. Update the list of available packages, then we can install the DebianPkg:nvidia-driver package, plus the necessary firmware: {{{
# apt update
# apt install nvidia-driver firmware-misc-nonfree
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-kernel-dkms package.
  * ''Note about Secureboot'': if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. Restart your system to load the new driver.

<<Anchor(sid-390)>>
===== Version 390.144 =====
For support of !GeForce 400 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86/390.144/README/supportedchips.html|supported devices]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian Sid
deb http://deb.debian.org/debian/ sid main contrib non-free
}}}
 1. Update the list of available packages, then we can install the DebianPkg:nvidia-legacy-390xx-driver package, plus the necessary firmware: {{{
# apt update
# apt install nvidia-legacy-390xx-driver firmware-misc-nonfree
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-legacy-390xx-kernel-dkms package.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. Restart your system to load the new driver.

<<Anchor(sid-340)>>
===== Version 340.108 =====
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]]).

'''Use of the 340-series driver is strongly discouraged.''' It is not included in stable releases of Debian anymore, has serious unfixable security vulnerabilities, and may not be updated for new kernels in a timely manner. You are highly recommended to use the built-in Nouveau driver if security is a priority.

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian Sid
deb http://deb.debian.org/debian/ sid main contrib non-free
}}}
 1. Update the list of available packages, then we can install the DebianPkg:nvidia-legacy-340xx-driver package, plus the necessary firmware: {{{
# apt update
# apt install nvidia-legacy-340xx-driver firmware-misc-nonfree
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-legacy-340xx-kernel-dkms package.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. Restart your system to load the new driver.

----

==== Debian 12 "Bookworm" ====

<<Anchor(bookworm-470)>>
===== Version 470.103.01 =====
For support of !GeForce 600 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/470.103.01/README/supportedchips.html|supported devices]]). For older devices, see [[#bookworm-390|Version 390 (legacy GPUs]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian Bookworm
deb http://deb.debian.org/debian/ bookworm main contrib non-free
}}}
 1. Update the list of available packages, then we can install the DebianPkg:nvidia-driver package, plus the necessary firmware: {{{
# apt update
# apt install nvidia-driver firmware-misc-nonfree
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-kernel-dkms package.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. Restart your system to load the new driver.

<<Anchor(bookworm-390)>>
===== Version 390.144 =====
For support of !GeForce 400 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86/390.144/README/supportedchips.html|supported devices]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian Bookworm
deb http://deb.debian.org/debian/ bookworm main contrib non-free
}}}
 1. Update the list of available packages, then we can install the DebianPkg:nvidia-legacy-390xx-driver package, plus the necessary firmware: {{{
# apt update
# apt install nvidia-legacy-390xx-driver firmware-misc-nonfree
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-legacy-390xx-kernel-dkms package.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. Restart your system to load the new driver.

----

==== Debian 11 "Bullseye" ====
<<Anchor(bullseye-470)>>
===== Version 470.103.01 =====
For support of !GeForce 600 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/470.103.01/README/supportedchips.html|supported devices]]). For older devices, see [[#bullseye-390|Version 390 (legacy GPUs]]).


 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian Bullseye
deb http://deb.debian.org/debian/ bullseye main contrib non-free
}}}

 1. Add bullseye-backports as an additional new line to your /etc/apt/sources.list, for example: {{{
# bullseye-backports
deb http://deb.debian.org/debian bullseye-backports main contrib non-free
}}}

 1. Update the list of available packages, then we can install the DebianPkg:nvidia-driver package, plus the necessary firmware, from the backports repository:{{{
# apt update
# apt install -t bullseye-backports nvidia-driver firmware-misc-nonfree
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-kernel-dkms package.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. Reboot your system to load the updated driver.

<<Anchor(bullseye-460)>>
===== Version 460.91.03 =====
For support of !GeForce 600 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86_64/460.91.03/README/supportedchips.html|supported devices]]). For older devices, see [[#bullseye-390|Version 390 (legacy GPUs]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 11 "Bullseye"
deb http://deb.debian.org/debian/ bullseye main contrib non-free
}}}
 1. Update the list of available packages, then we can install the DebianPkg:nvidia-driver package, plus the necessary firmware: {{{
# apt update
# apt install nvidia-driver firmware-misc-nonfree
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-kernel-dkms package.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. Restart your system to load the new driver.

<<Anchor(bullseye-390)>>
===== Version 390.144 =====
For support of !GeForce 400 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86/390.144/README/supportedchips.html|supported devices]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 11 "Bullseye"
deb http://deb.debian.org/debian/ bullseye main contrib non-free
}}}
 1. Update the list of available packages, then we can install the DebianPkg:nvidia-legacy-390xx-driver package, plus the necessary firmware: {{{
# apt update
# apt install nvidia-legacy-390xx-driver firmware-misc-nonfree
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-legacy-390xx-kernel-dkms package.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. Restart your system to load the new driver.

----

==== Debian 10 "Buster" ====

<<Anchor(buster-460)>>
===== Version 460.73.01 (via buster-backports) =====

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

 1. Add buster-backports as an additional new line to your /etc/apt/sources.list, for example: {{{
# buster-backports
deb http://deb.debian.org/debian buster-backports main contrib non-free
}}}

 1. Update the list of available packages, then we can install the DebianPkg:nvidia-driver package, plus the necessary firmware, from the backports repository:{{{
# apt update
# apt install -t buster-backports nvidia-driver firmware-misc-nonfree
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-kernel-dkms package.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. Reboot your system to load the updated driver.

<<Anchor(buster-418)>>

===== Version 418.197.02 =====

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 (legacy GPUs)]] and [[#buster-340|Version 340 (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, then we can install the DebianPkg:nvidia-driver package, plus the necessary firmware: {{{
# apt update
# apt install nvidia-driver firmware-misc-nonfree
}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-kernel-dkms package.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. Restart your system to load the new driver.

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

For support of !GeForce 400 series and newer GPUs ([[https://us.download.nvidia.com/XFree86/Linux-x86/390.138/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, then we can install the DebianPkg:nvidia-legacy-390xx-driver package, plus the necessary firmware:{{{
# apt update
# apt install nvidia-legacy-390xx-driver firmware-misc-nonfree}}}
 DKMS will build the {{{nvidia}}} module for your system, via the DebianPkg:nvidia-legacy-390xx-kernel-dkms package.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 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, then we can install the DebianPkg:nvidia-legacy-340xx-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.
  * ''Note about Secureboot'' : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available [[SecureBoot#Using_your_key_to_sign_modules|here]].
 1. 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 (legacy GPUs)]] and [[#stretch-304xx|Version 304 (legacy GPUs)]].

 1. Add stretch-backports as an additional new line to your /etc/apt/sources.list, for example: {{{
# stretch-backports
deb http://deb.debian.org/debian stretch-backports main contrib non-free
}}}

 1. Update the list of available packages, then we can install the DebianPkg:nvidia-driver package, plus the necessary firmware, from the backports repository:{{{
# apt update
# apt install -t stretch-backports nvidia-driver firmware-misc-nonfree
}}}
 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 (legacy GPUs)]] and [[#stretch-304xx|Version 304 (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, then we can install the DebianPkg:nvidia-driver package, plus the necessary firmware: {{{
# apt update
# apt install nvidia-driver firmware-misc-nonfree
}}}
 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, then we can install the DebianPkg:nvidia-legacy-340xx-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, then we can install the DebianPkg:nvidia-legacy-304xx-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}}}.
----
== Wayland ==
The NVIDIA driver supports Wayland, with caveats. The 495-series driver
(or newer) is recommended for the best experience, as older versions only
support Wayland through an NVIDIA-specific API which is not supported by
all desktops, and is generally less reliable.

The NVIDIA driver also lacks support for accelerated XWayland
applications in current stable Debian versions.
This means that if you run a Xorg-only application on your NVIDIA Wayland
desktop (often proprietary video games), they will only be able to render
on the CPU without taking advantage of GPU acceleration, leading to
incredibly poor performance. [[https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/587|Patches have been merged to resolve this]], however this support will only be available in [[DebianBookworm|Debian 12/Bookworm]].

In terms of specific desktop support, GNOME supports NVIDIA Wayland sessions
in both Debian 10 and Debian 11, though they call their support "preliminary".
KDE Plasma supports NVIDIA Wayland sessions starting with Debian 11,
though it requires some extra hoops to enable, and generally is not recommended.
Refer to the Wayland section of the Debian KDE wiki page for up-to-date information:
https://wiki.debian.org/KDE#Wayland.2C_touchscreens.2C_autorotation.2C_hi-DPI

In Debian 12 (currently Debian Testing), almost all issues should be resolved
and most Wayland sessions should "just work" with the 495-series driver,
however some major issues remain with KDE Plasma. These will require merging
KDE's Qt 5 patch collection to fix: https://salsa.debian.org/qt-kde-team/qt/qtwayland/-/merge_requests/5

----

== 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}}}
Line 161: Line 499:
$ cd /usr/src/linux
# make xconfig
}}}
 and then choose the options you want. Note, however, that each of the following kernel options has been reported to cause trouble with the ''nvidia'' driver:
  * Device drivers –> Graphics Support –> nVidia Riva support (FB_RIVA)
  * Device drivers –> Graphics support –> nVidia Framebuffer Support (FB_NVIDIA)
  * Device drivers –> Graphics support –> VESA VGA graphics support (FB_VESA)
  * Processor Type and Features –> Local APIC support on uniprocessors (X86_UP_APIC) (not available if you have an SMP kernel, including hyperthreading)
 It is therefore recommended that you disable all of the above options in your kernel configuration. If for some reason you don't disable them, and then your X display doesn't work properly with the ''nvidia'' driver, you should suspect these options as the likely cause of the trouble. For more details, see the Troubleshooting section.

 1. Build the kernel and the ''nvidia'' kernel module:
Section "Device"
 Identifier "My GPU"
 Driver "nvidia"
EndSection
}}}

The configuration file above can be created using these commands:
Line 173: Line 507:
# make-kpkg clean
# make-kpkg kernel_image modules_image
}}}
 For an introduction to using make-kpkg to build kernel packages, see [[http://newbiedoc.sourceforge.net/system/kernel-pkg.html|Creating custom kernels with Debian's kernel-package system]], or [[http://www.debianuniverse.com/readonline/chapter/21|Compiling Kernels the Debian Way]]. See also the [[DebianMan1/make-kpkg|make-kpkg(1)]] man page, for a description of other options and targets that you can use in this command. The result of the above command will be two Debian package files, linux-image-*.deb and nvidia-kernel-*.deb, both in /usr/src or /usr/src/modules. The first file contains your kernel, and the second contains your '''nvidia''' kernel module. <<BR>>At the same time, if you have sources for any other add-on kernel modules in /usr/src/modules, then the "modules_image" target will cause make-kpkg to build Debian package files for them, too. For example, if you install the fuse-source package you'll get a source archive /usr/src/fuse.tar.gz, which you can unpack to get fuse module sources in /usr/src/modules/fuse. If you've done this, then this same invocation of make-kpkg will also build a fuse module package file, /usr/src/fuse-*.deb, that's specific to your new kernel.

 1. Install the new kernel and kernel module:
 {{{
$ cd /usr/src
# dpkg -i /path/linux-image-*.deb /path/nvidia-kernel-*.deb
}}}
 Use the fileglobs as above if you want, but watch out that you don't have more than one Linux image or nvidia-kernel package file lying around in /usr/src. If you do you'll get a blizzard of error messages. It's probably better to explicitly type all of the version information rendered as * above.
  
 1. Boot your new kernel. Before trying to get the NVIDIA 3D drivers to work, make sure that the new kernel boots and that X starts well using a free X driver.
[[#Libraries|Proceed to step 3]].

<<Anchor(Method4)>>

===== Build manually, with a stock kernel =====
Use this method if you're running a stock kernel and the two first methods failed. module-assistant should automate this process. In other words, if the first method failed but this one works, you should probably submit a bug report against module-assistant.

The following procedure is adapted from the instructions in /usr/share/doc/nvidia-kernel-source/README.Debian and is known to be potentially inexact.

 1. Save the release number of your kernel (e.g. 2.6.18-6-686) in a couple of environment variables:
 {{{
export KVERS=$(uname -r)
export KSRC=/usr/src/linux-headers-$KVERS
export KPKG_DEST_DIR=/usr/src
}}}
 Note that these variables are used by the build commands below, so you really do need to set and export them, as in the above commands.
 1. Install the kernel module source: run
 {{{
apt-get install nvidia-kernel-source nvidia-kernel-common
}}}
 This will give you a source tarball /usr/src/nvidia-kernel-source.tar.gz. Unpack it with
 {{{
cd /usr/src
tar -zxf nvidia-kernel-source.tar.gz
}}}
 This will unpack the kernel module sources into /usr/src/modules/nvidia-kernel.
 In case there is no such tarball, but /usr/src/nvidia-kernel.tar.bz2, unpack it with
 {{{
cd /usr/src
tar -jxf nvidia-kernel.tar.bz2
}}}
 1. Install the header files for your kernel:
 {{{
apt-get install linux-headers-$KVERS
}}}
 This will give you kernel header files in /usr/src/linux-headers-$KVERS. Be sure to check that the installed kernel image and kernel header packages have the same version number: run
 {{{
apt-cache policy linux-image-$KVERS linux-headers-$KVERS
}}}
 and check that the version number listed as Installed is the same for both packages. If it isn't, find the distribution that has the version of linux-headers that you need, e.g. testing, and rerun the above installation command, adding '-t testing' (or whichever).
 1. Build the kernel module package:
 {{{
cd /usr/src/modules/nvidia-kernel
debian/rules binary-modules
}}}
 The result will be a package file /usr/src/nvidia-kernel-*.deb, which contains your kernel module. Note: several users have told me recently that their nvidia package file ends up in /usr/src/modules, instead of /usr/src. I don't know yet why this happens. If this is your case, please adjust the next command appropriately.
 1. Install the kernel module:
 {{{
dpkg -i /usr/src/nvidia-kernel-*.deb
}}}
 Use the fileglob as above if you want, but watch out that you don't have more than one nvidia-kernel package file lying around in /usr/src. If you do you'll get a blizzard of error messages. It's probably better to explicitly type all of the version information that I rendered as * above.
Now [[#Libraries|proceed to step 3]], below. <<Anchor(Libraries)>>

==== Install the NVIDIA X driver and user-space libraries ====
Install the X driver and user-space libraries package. For example, with apt-get:

{{{
# apt-get install nvidia-glx${VERSION}
}}}
Note: The reason this step has to come after step 2 is that nvidia-glx depends on a virtual package called 'nvidia-kernel-$NVVERSION', where $NVVERSION is the upstream part of the version of the nvidia-glx package. This virtual package should be provided by the kernel module package that you installed in step 2; so you have to complete that step first. If the installation of nvidia-glx fails because the 'nvidia-kernel-$NVVERSION' isn't satisfied, you should probably make sure that step 2 went OK.

==== Configure X to use the nvidia driver ====
You can use [[#config-manual|The manual way]] or [[#using-nvidia-xconfig|nvidia-xconfig]], which will create a basic xorg.conf and a final one with your preferred settings.

<<Anchor(config-manual)>>
===== The manual way =====
Consider backing up your current X config file:

{{{
# cp -p /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
}}}
Watch out for typos, and check your X log if things go wrong.

Edit /etc/X11/xorg.conf:

 * If it contains a "Module" section, be sure that it contains a line:
 {{{
Load "glx"
}}}
 and remove or comment out (prepend with a #) any lines that refer to the "dri" or "GLCore" modules.
 * In the "Device" section for your video card, change the driver (normally nv or vesa) to '''nvidia'''. If the driver is not defined, add the line
 {{{
Driver "nvidia"
}}}

<<Anchor(using-nvidia-xconfig)>>
===== Using nvidia-xconfig =====
'''Warning''': this method is generally not recommended due to an important X bug (DebianBug:504692).

Install nvidia-xconfig. For example, using apt-get:
{{{
# apt-get install nvidia-xconfig
}}}
Now make a basic xorg.conf to include NVIDIA driver:

{{{
# nvidia-xconfig
}}}


=== Restart X ===
This is the easiest but probably most crucial step. If it doesn't work for some reason, and you want to get back to X before fixing the problem, you'll have to revert step 4 (by choosing a free X driver again). When you think you fixed the problem, you can do step 4 again and retry starting X. Remember that even if it works you'll want to read the [[#Upgrades|next section]] to avoid future trouble. And if it doesn't...check the Troubleshooting section.

If you don't use a display manager, simply close your session. That should bring to a console. If it doesn't, you must be using a display manager (such as gdm, kdm or xdm). First identify which one you're using. If you don't know, it's probably gdm. You can know by checking whether a process ending with "dm" is running. Once you determined which one you use, close your session and go run the appropriate init script in a console. Here's an example for gdm:

{{{
# invoke-rc.d gdm restart
}}}
Alternatively, you can simply press Alt+E at the login screen if you use kdm. If you can't figure out how to restart X with those instructions, you can simply reboot your system. Otherwise, the keyboard shortcut Ctrl+Alt+Backspace should be reliable, despite being somewhat "unfriendly".

==== Check that it worked ====
To check that the acceleration is working, glxinfo can be used. This program is in the mesa-utils package. If

{{{
$ glxinfo |grep rendering
}}}
returns "direct rendering: Yes", acceleration is working. If it returns No, [[#nodri|see section "Hardware acceleration, aka direct rendering, doesn't work"]]. If it returns Yes, 3D acceleration (in games such as !PlanetPenguin Racer or Extreme Tux Racer and Neverball) should work.
<<Anchor(Upgrades)>>

== How to deal with kernel changes and driver upgrades ==
Steps 3 and 4 are done for good. However, you'll have to repeat step 2 in certain situations. If you don't realize such a situation happens, X will fail to start. You can take two approaches with this: either remember when this will happen and try to prevent it, or remember to come back here when your X fails to start. Either way, you're not done for life. If X fails to start because of this, you can again revert step 4 (by choosing a free X driver again) and redo it when you want to retry using the ''nvidia'' driver for X.

=== When ===
Step 2 installs an ''nvidia'' kernel module for a specific kernel and NVIDIA driver version. You'll have to do it for each kernel, and you'll have to redo it for each new driver version. If you don't know what this means, read on.

==== ...will the NVIDIA driver version change ====
If you're using Debian stable, this won't happen until you upgrade to the next Debian release, but it will happen then.

In all cases, this will happen when the nvidia-glx package is upgraded. All versions of nvidia-glx depend on an nvidia-kernel-''version'' virtual package. When you followed step 2, you installed a package providing this virtual package. However, if you upgrade nvidia-glx before doing step 2 again, APT will attempt to satisfy the virtual package by installing a basically randomly chosen prebuilt kernel module. You'll notice some new nvidia-kernel-''something'' package being installed (or upgraded if you already had it). Instead of letting it do, do step 2 again to get an appropriate kernel module. Then, the virtual package will be satisfied and you can upgrade nvidia-glx safely and without installing a useless package.

==== ...will your kernel change ====
If you build other modules using module-assistant, you have to redo step 2 everytime you'd have to run module-assistant for other modules, that is for every new kernel ABI. If you don't know what that means, read on.

If you install a kernel with a new ABI, a new Linux image package will be installed. For example, if the Linux 2.6.18 gets a new ABI and you currently use linux-image-2.6.18-4-486, you will have to install the linux-image-2.6.18-5-486 package to get the new kernel (the "-4" and "-5" part of the package names indicate respectively that these packages contain the fourth and fifth ABI of Debian's 2.6.18 i386 stock kernels). This may happen without your intervention when upgrading your system if the linux-image-2.6-486 meta package is installed. This can also happen if you install a different kernel. For example, you can have both 2.6.26 and 2.6.32 in Lenny. If you did step 2 for 2.6.26 only, you'll need to do it for 2.6.32 too. You'll notice that a new kernel is installed when a new linux-image-''something'' package is installed. X will fail to start after you booted a new kernel until you perform step 2 for that kernel.

= Troubleshooting =
== X doesn't start ==
 * Make sure that your problem is related to the ''nvidia'' driver. Try switching back to a free driver. Then restart your X server. If it still won't start, then you have other problems that precede NVIDIA's drivers.
== X (or the complete machine when running X) is unstable ==
 * Check whether you use a framebuffer, such as rivafb, nvidiafb and vesafb. The rivafb driver is known to conflict with NVIDIA's drivers. vesafb is known to work in some cases but also to be problematic in other cases. All of these drivers are compiled as modules in stock kernels, except for vesafb after 2.6.12. To see if you have one of these modules inserted in your kernel, run
 {{{
$ lsmod|grep 'rivafb\|vesafb\|nvidiafb'
}}}
 If this outputs something, get rid of the module(s) displayed.
 {{{
# rmmod rivafb vesafb nvidiafb
}}}
 will remove the modules temporarily (for this boot). If something causes one of the modules to load automatically at boot, blacklist the modules. If you are using a custom kernel, do not compile these modules in (Device drivers –> Graphics support –> nVidia Riva support (FB_RIVA), Device drivers –> Graphics support –> VESA VGA graphics support (FB_VESA) and Device drivers –> Graphics support –> nVidia Framebuffer Support (FB_NVIDIA)).

<<Anchor(nodri)>>

== Hardware acceleration, aka direct rendering, doesn't work ==
We've covered how to check that the installation worked in section "Check that it worked". If it doesn't, check that you adjusted your X configuration properly. You can do so by checking that

{{{
$ grep Driver /etc/X11/xorg.conf 2>&1|grep nvidia
}}}
returns something. If this is the case and X was restarted since the configuration was changed, you may be affected by Debian bug DebianBug:208198. You can check if this is the case by running

{{{
$ glxinfo | egrep "glx (vendor|version)"
}}}
If you see different vendors or versions for the client and server, this is your problem. In that case you can run

{{{
# NVVER=`dpkg -s nvidia-glx|grep Version|cut -d ' ' -f2|cut -d '-' -f1`
# ln -fs /usr/lib/libGL.so.$NVVER /usr/X11R6/lib/libGL.so
# ln -fs /usr/lib/libGL.so.$NVVER /usr/X11R6/lib/libGL.so.1
# ln -fs libGL.so.$NVVER /usr/lib/libGL.so.1.2
}}}
to fix the problem.

If that's not your problem but you get an error when trying to use OpenGL apps like glxinfo that looks like this one:

{{{
Error: Could not open /dev/nvidiactl because the permissions
are too resticitive. Please see the FREQUENTLY ASKED QUESTIONS
section of /usr/share/doc/NVIDIA_GLX-1.0/README for steps
to correct.
Fatal signal: Segmentation Fault
}}}
you should make sure that the user running the application is in the ''video'' group.

== Various problems with X ==
Look in your X log file (/var/log/Xorg.0.log). The X server writes a lot of information there about what configuration files it's reading, what display modes it's trying, and errors (EE) it encounters along the way. You can very often find hints there to the source of whatever problem you're having.

== "nvidia license taints kernel" ==
If you get such a warning message on your console or in your syslog, don't worry. Your kernel is fine...or at least as fine as a kernel that can run NVIDIA's 3D driver can be. All this message means is that because your driver isn't open source, you won't get any support from the Linux maintainers if anything goes wrong with your kernel while the module is loaded. See the [[http://www.tux.org/lkml/#s1-18|LKML FAQ]] for more.

== Last resort ==
You can check [[http://www.nvnews.net/vbulletin/forumdisplay.php?f=14|the NVIDIA Linux Forum at nvnews.net]] for issues not related to Debian packaging. For Debian-specific issues, you may look at the bug tracking system or ask a question on Debian help resources, such as the debian-user mailing list and #debian on irc.debian.org. If you still have a problem that you can't solve, you can write and [[mailto:andrex@alumni.utexas.net?subject=Debian-NVIDIA|tell the author]] about it. He'll do what he can to help, subject to his knowledge and time constraints.

= More information =
 * For more information about the drivers, see:
  * /usr/share/doc/nvidia-glx/README.Debian
  * /usr/share/doc/nvidia-glx/README.txt.gz
 These files have loads of information about options and for troubleshooting NVIDIA's proprietary drivers. Here's an enticement for you to read them: somewhere in one of them you can find an explanation of how to suppress the NVIDIA splash screen every time you start an X server (hint: search for "No{{{}}}Logo").
 * You can adjust the clock rates of your GPU and video RAM by running nvclock, nvclock_gtk, or nvclock_qt, available respectively in the nvclock, nvclock-gtk, and nvclock-qt packages. Obligatory warning: you can destroy your video hardware with these tools if you're not careful.
 * You can adjust some other, relatively obscure settings of the driver by running nvidia-settings, available in the nvidia-settings package.
= About this document =
This wiki page was created by [[http://pages.videotron.ca/chealer/pc_en.html|Philippe Cloutier]] to publish an update to ''Andrew's Debian-nVidia HOWTO''. You are free to modify this page as long as you agree to let copyright of your changes to the author. For problems, comments, or questions about the information in this document, you can [[mailto:chealer@gmail.com?subject=Debian-NVIDIA|write to the maintainer]]. He's no expert, but he'll do his best to make the document useful.

== Credits ==
Thanks to Andrew Schulman for publishing his HOWTO, agreeing to share his rights on it, and making the HOWTO link to this page since it stopped being maintained.

== Licensing ==
This document is Copyright 2005, by Andrew E. Schulman. Permission is hereby granted to freely copy, distribute, and/or modify any of the contents of this document in any way and for any purpose.

== See also ==
 * [[GraphicsCard]]
# 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 Unstable "Sid" ===

CUDA 11.4.3 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.

=== Debian 12 "Bookworm" ===

CUDA 11.4.3 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.


=== Debian 11 "Bullseye" ===

CUDA 11.2.2 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.

=== Debian 10 "Buster" ===

CUDA 9.2.148 is available from the non-free repository:
{{{
# apt install nvidia-cuda-dev nvidia-cuda-toolkit
}}}
And, if [[Backports]] are enabled, CUDA 11.2.1 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.0.44 is available from the non-free repository:

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

And, if [[Backports]] are enabled, CUDA 9.1.85 is available similarly:
{{{
# apt -t stretch-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.

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 license 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
}}}

----

== Troubleshooting ==
=== Build failures ===
The NVIDIA driver can fail to build for several potential reasons.

1. You've installed a kernel from backports without installing
the NVIDIA driver from backports. This can, in some cases, mean
that the kernel is too new for the driver version you're attempting to use.
Check this by viewing the package description for the NVIDIA driver where
it will mention something along the lines of, "Building the kernel module
has been tested up to Linux X.X" to figure out what's supported.

2. Particularly if you're on Debian Testing or Debian Unstable,
the driver might not support your kernel yet. Often, new versions
of the Linux kernel will explicitly require an update to the driver
in order to be supported, so if the kernel package updates before
the driver has a chance to be patched for it, you won't be able to use
the NVIDIA driver. Solutions for this, from most to least recommended,
are temporarily using an older kernel until the driver is updated,
installing a newer version of the driver from Debian Experimental if
one is available that supports your kernel version, or finding a patch
for the build failure online that can be added to DKMS. The last two
options are for advanced users
'''and may break your system or, in the
case of adding a third-party patch, introduce security issues, forcing you to potentially reinstall completely or spend hours recovering your system. Caveat emptor.'''

3. Legacy versions of the NVIDIA driver may not always support the latest kernel.
For instance, the 304xx series driver, though available in the Debian Unstable
repository, does not support Linux 5.0 or newer. As necessary, you might consider
using an older Debian version, or using Nouveau instead. Nouveau has decent
performance with GPUs that are old enough to no longer be supported by the
proprietary driver.

=== Driver stops working after upgrading Debian ===
When going between two major Debian releases (e.g., upgrading
from Debian 9/Stretch to Debian 10/Buster), it's possible that the
driver will stop functioning despite the build succeeding and no other
issues being easily visible. This is most often caused by the
DebianPkg:nvidia-driver package updating to a newer major release that
no longer supports your hardware, as NVIDIA regularly drops support for
older hardware generations. You will need to uninstall all your existing
NVIDIA packages (refer to the section below for instructions on how to do so),
and instead install the most recent legacy driver that still supports your GPU.

=== GPU isn't functional, even with a compatible driver version installed ===
If you have an extremely modern NVIDIA GPU that was manufactured after the release of your
Debian version, it may not work even after installing the newest backported driver
that claims to support your card. If so, you likely need to upgrade the non-free firmware
package on your system as well by installing the DebianPkg:firmware-misc-nonfree package
from backports. For instance, on a Debian 10 system with backports enabled:
{{{
# apt install -t buster-backports firmware-misc-nonfree
}}}
After rebooting, the driver should be able to load the appropriate firmware.

=== Miscellaneous ===
 * 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 Unstable "Sid":

  • Version 470.103.00 (supported devices)

    • Supports Kepler, Maxwell, Pascal, Turing, and all current Ampere GPUs. Supports Vulkan 1.2 and OpenGL 4.6.
  • Version 390.144 (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.
  • Version 340.108 (legacy GPUs) (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.

    • Use of the 340-series driver is strongly discouraged. It is not included in stable releases of Debian anymore, has serious unfixable security vulnerabilities, and may not be updated for new kernels in a timely manner. You are highly recommended to use the built-in Nouveau driver if security is a priority.

Multiple precompiled driver versions are available for Debian 12 "Bookworm":

Multiple precompiled driver versions are available for Debian 11 "Bullseye":

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

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

All driver versions up to, and including, the 418-series, are only available for the x86, x86-64, and 32-bit ARMv7 architectures (Debian i386, AMD64, and ARMHF ports respectively).

The 450-series and newer has dropped support for 32-bit architectures, now only supporting x86-64 and ARMv8 (Debian AMD64 and ARM64 ports respectively).


Prerequisites

Kernel headers

Before installing the drivers, you must obtain the proper kernel headers for the NVIDIA driver 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 backports on a 64-bit Debian 10 system, you might run:

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


Kernel

In some cases, if you're aiming to install the bleeding-edge version of the NVIDIA driver from Debian Backports, you may also need to install the kernel from backports to match it. For Debian 10, you might do this with:

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

Exchange "buster-backports" with your own version's backports repository as necessary.


Installation

Debian Unstable "Sid"

Version 470.103.01

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

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

    # Debian Sid
    deb http://deb.debian.org/debian/ sid main contrib non-free
  2. Update the list of available packages, then we can install the nvidia-driver package, plus the necessary firmware:

    # apt update
    # apt install nvidia-driver firmware-misc-nonfree

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

    • Note about Secureboot: if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  3. Restart your system to load the new driver.

Version 390.144

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 Sid
    deb http://deb.debian.org/debian/ sid main contrib non-free
  2. Update the list of available packages, then we can install the nvidia-legacy-390xx-driver package, plus the necessary firmware:

    # apt update
    # apt install nvidia-legacy-390xx-driver firmware-misc-nonfree

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

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  3. Restart your system to load the new driver.

Version 340.108

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

Use of the 340-series driver is strongly discouraged. It is not included in stable releases of Debian anymore, has serious unfixable security vulnerabilities, and may not be updated for new kernels in a timely manner. You are highly recommended to use the built-in Nouveau driver if security is a priority.

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

    # Debian Sid
    deb http://deb.debian.org/debian/ sid main contrib non-free
  2. Update the list of available packages, then we can install the nvidia-legacy-340xx-driver package, plus the necessary firmware:

    # apt update
    # apt install nvidia-legacy-340xx-driver firmware-misc-nonfree

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

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  3. Restart your system to load the new driver.


Debian 12 "Bookworm"

Version 470.103.01

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

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

    # Debian Bookworm
    deb http://deb.debian.org/debian/ bookworm main contrib non-free
  2. Update the list of available packages, then we can install the nvidia-driver package, plus the necessary firmware:

    # apt update
    # apt install nvidia-driver firmware-misc-nonfree

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

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  3. Restart your system to load the new driver.

Version 390.144

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 Bookworm
    deb http://deb.debian.org/debian/ bookworm main contrib non-free
  2. Update the list of available packages, then we can install the nvidia-legacy-390xx-driver package, plus the necessary firmware:

    # apt update
    # apt install nvidia-legacy-390xx-driver firmware-misc-nonfree

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

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  3. Restart your system to load the new driver.


Debian 11 "Bullseye"

Version 470.103.01

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

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

    # Debian Bullseye
    deb http://deb.debian.org/debian/ bullseye main contrib non-free
  2. Add bullseye-backports as an additional new line to your /etc/apt/sources.list, for example:

    # bullseye-backports
    deb http://deb.debian.org/debian bullseye-backports main contrib non-free
  3. Update the list of available packages, then we can install the nvidia-driver package, plus the necessary firmware, from the backports repository:

    # apt update
    # apt install -t bullseye-backports nvidia-driver firmware-misc-nonfree

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

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  4. Reboot your system to load the updated driver.

Version 460.91.03

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

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

    # Debian 11 "Bullseye"
    deb http://deb.debian.org/debian/ bullseye main contrib non-free
  2. Update the list of available packages, then we can install the nvidia-driver package, plus the necessary firmware:

    # apt update
    # apt install nvidia-driver firmware-misc-nonfree

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

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  3. Restart your system to load the new driver.

Version 390.144

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 11 "Bullseye"
    deb http://deb.debian.org/debian/ bullseye main contrib non-free
  2. Update the list of available packages, then we can install the nvidia-legacy-390xx-driver package, plus the necessary firmware:

    # apt update
    # apt install nvidia-legacy-390xx-driver firmware-misc-nonfree

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

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  3. Restart your system to load the new driver.


Debian 10 "Buster"

Version 460.73.01 (via buster-backports)

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

  1. Add buster-backports as an additional new line to your /etc/apt/sources.list, for example:

    # buster-backports
    deb http://deb.debian.org/debian buster-backports main contrib non-free
  2. Update the list of available packages, then we can install the nvidia-driver package, plus the necessary firmware, from the backports repository:

    # apt update
    # apt install -t buster-backports nvidia-driver firmware-misc-nonfree

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

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  3. Reboot your system to load the updated driver.

Version 418.197.02

For support of GeForce 600 series and newer GPUs (supported devices). For older devices, see Version 390 (legacy GPUs) and Version 340 (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, then we can install the nvidia-driver package, plus the necessary firmware:

    # apt update
    # apt install nvidia-driver firmware-misc-nonfree

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

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  3. Restart your system to load the new driver.

Version 390.138 (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, then we can install the nvidia-legacy-390xx-driver package, plus the necessary firmware:

    # apt update
    # apt install nvidia-legacy-390xx-driver firmware-misc-nonfree

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

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  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, then we can install the nvidia-legacy-340xx-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.

    • Note about Secureboot : if you have SecureBoot enabled, you need to sign the resulting modules. Detailed instructions are available here.

  3. 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 (legacy GPUs) and Version 304 (legacy GPUs).

  1. Add stretch-backports as an additional new line to your /etc/apt/sources.list, for example:

    # stretch-backports
    deb http://deb.debian.org/debian stretch-backports main contrib non-free
  2. Update the list of available packages, then we can install the nvidia-driver package, plus the necessary firmware, from the backports repository:

    # apt update
    # apt install -t stretch-backports nvidia-driver firmware-misc-nonfree

    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 (legacy GPUs) and Version 304 (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, then we can install the nvidia-driver package, plus the necessary firmware:

    # apt update
    # apt install nvidia-driver firmware-misc-nonfree

    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, then we can install the nvidia-legacy-340xx-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, then we can install the nvidia-legacy-304xx-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.


Wayland

The NVIDIA driver supports Wayland, with caveats. The 495-series driver (or newer) is recommended for the best experience, as older versions only support Wayland through an NVIDIA-specific API which is not supported by all desktops, and is generally less reliable.

The NVIDIA driver also lacks support for accelerated XWayland applications in current stable Debian versions. This means that if you run a Xorg-only application on your NVIDIA Wayland desktop (often proprietary video games), they will only be able to render on the CPU without taking advantage of GPU acceleration, leading to incredibly poor performance. Patches have been merged to resolve this, however this support will only be available in Debian 12/Bookworm.

In terms of specific desktop support, GNOME supports NVIDIA Wayland sessions in both Debian 10 and Debian 11, though they call their support "preliminary". KDE Plasma supports NVIDIA Wayland sessions starting with Debian 11, though it requires some extra hoops to enable, and generally is not recommended. Refer to the Wayland section of the Debian KDE wiki page for up-to-date information: https://wiki.debian.org/KDE#Wayland.2C_touchscreens.2C_autorotation.2C_hi-DPI

In Debian 12 (currently Debian Testing), almost all issues should be resolved and most Wayland sessions should "just work" with the 495-series driver, however some major issues remain with KDE Plasma. These will require merging KDE's Qt 5 patch collection to fix: https://salsa.debian.org/qt-kde-team/qt/qtwayland/-/merge_requests/5


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 Unstable "Sid"

CUDA 11.4.3 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.

Debian 12 "Bookworm"

CUDA 11.4.3 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.

Debian 11 "Bullseye"

CUDA 11.2.2 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.

Debian 10 "Buster"

CUDA 9.2.148 is available from the non-free repository:

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

And, if Backports are enabled, CUDA 11.2.1 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.0.44 is available from the non-free repository:

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

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

# apt -t stretch-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.

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


Troubleshooting

Build failures

The NVIDIA driver can fail to build for several potential reasons.

1. You've installed a kernel from backports without installing the NVIDIA driver from backports. This can, in some cases, mean that the kernel is too new for the driver version you're attempting to use. Check this by viewing the package description for the NVIDIA driver where it will mention something along the lines of, "Building the kernel module has been tested up to Linux X.X" to figure out what's supported.

2. Particularly if you're on Debian Testing or Debian Unstable, the driver might not support your kernel yet. Often, new versions of the Linux kernel will explicitly require an update to the driver in order to be supported, so if the kernel package updates before the driver has a chance to be patched for it, you won't be able to use the NVIDIA driver. Solutions for this, from most to least recommended, are temporarily using an older kernel until the driver is updated, installing a newer version of the driver from Debian Experimental if one is available that supports your kernel version, or finding a patch for the build failure online that can be added to DKMS. The last two options are for advanced users and may break your system or, in the case of adding a third-party patch, introduce security issues, forcing you to potentially reinstall completely or spend hours recovering your system. Caveat emptor.

3. Legacy versions of the NVIDIA driver may not always support the latest kernel. For instance, the 304xx series driver, though available in the Debian Unstable repository, does not support Linux 5.0 or newer. As necessary, you might consider using an older Debian version, or using Nouveau instead. Nouveau has decent performance with GPUs that are old enough to no longer be supported by the proprietary driver.

Driver stops working after upgrading Debian

When going between two major Debian releases (e.g., upgrading from Debian 9/Stretch to Debian 10/Buster), it's possible that the driver will stop functioning despite the build succeeding and no other issues being easily visible. This is most often caused by the nvidia-driver package updating to a newer major release that no longer supports your hardware, as NVIDIA regularly drops support for older hardware generations. You will need to uninstall all your existing NVIDIA packages (refer to the section below for instructions on how to do so), and instead install the most recent legacy driver that still supports your GPU.

GPU isn't functional, even with a compatible driver version installed

If you have an extremely modern NVIDIA GPU that was manufactured after the release of your Debian version, it may not work even after installing the newest backported driver that claims to support your card. If so, you likely need to upgrade the non-free firmware package on your system as well by installing the firmware-misc-nonfree package from backports. For instance, on a Debian 10 system with backports enabled:

# apt install -t buster-backports firmware-misc-nonfree

After rebooting, the driver should be able to load the appropriate firmware.

Miscellaneous

  • 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