Differences between revisions 2 and 320 (spanning 318 versions)
Revision 2 as of 2005-11-16 06:10:06
Size: 15148
Comment: more; step 1
Revision 320 as of 2019-08-28 19:28:14
Size: 25327
Editor: GregWooledge
Comment: mkdir -p because it might already exist
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
This document explains how to make use of NVIDIA video hardware for ["Debian"] GNU/Linux users, who are the primary target. However, most (if not all) of Debian derivatives, including Libranet, Mepis, Ubuntu, and Xandros, should work in the same way. The following section shortly describes the ["free"] drivers while the rest of the document covers the ["non-free"] but 3D-accelerated drivers.

[[TableOfContents]]

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

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

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

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

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

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

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

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

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

== Target audience ==
The following method should work with any 2.4 or 2.6 Linux kernel, with either stock or custom kernels, and with ["Sarge"], ["Etch"] and ["Sid"] (assuming Sid works). Although there are Debian packages for the drivers in ["Woody"], if you are looking to make some fun gaming, consider the fun of upgrading to Sarge first.
#language en
~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[es/NvidiaGraphicsDrivers|Español]] - [[fr/NvidiaGraphicsDrivers|Français]] - [[it/NvidiaGraphicsDrivers|Italiano]] - [[ru/NvidiaGraphicsDrivers|Русский]] - [[zh_CN/NvidiaGraphicsDrivers|简体中文]]-~
----
= NVIDIA Proprietary Driver =

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

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

<<TableOfContents(4)>>

== 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"
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation G80 [GeForce 8800 GTS] [10de:0193] (rev a2)
}}}

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 [[http://www.nvidia.com/object/optimus_technology.html|Optimus]] (hybrid) graphics chipset, and the instructions on this page '''do not apply''' to you. Check the [[Bumblebee]] page instead.

=== nvidia-detect ===

The {{{nvidia-detect}}} script (DebianPkg:nvidia-detect package in [[http://www.debian.org/doc/debian-policy/ch-archive#s-non-free|non-free]]) can also be used to identify the GPU and required driver:
 {{{
$ nvidia-detect
Detected NVIDIA GPUs:
02:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF108 [GeForce GT 430] [10de:0de1] (rev a1)
Your card is supported by the default drivers.
It is recommended to install the
    nvidia-driver
package.
}}}

== Drivers ==

The proprietary "NVIDIA Accelerated Linux Graphics Driver" provides optimized hardware acceleration of OpenGL applications via a direct-rendering X server. It is a binary-only [[Xorg]] driver requiring a Linux kernel module for its use.

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

 * [[#stretch|Version 390.48]] ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/390.48/README/supportedchips.html|supported devices]])
  * For Fermi/Kepler/Maxwell/newer GPUs.
  * Note that 390.48 is currently only available in stretch-backports.
 * [[#stretch|Version 375.66]] ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/375.66/README/supportedchips.html|supported devices]])
  * For Kepler/Maxwell/newer GPUs.
 * [[#stretch-340xx|Version 340.102 (legacy GPUs)]] ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/340.102/README/supportedchips.html|supported devices]])
  * For !GeForce 8xxx through 7xx GPUs.
 * [[#stretch-304xx|Version 304.135 (legacy GPUs)]] ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/304.135/README/supportedchips.html|supported devices]])
  * For !GeForce 6xxx and 7xxx GPUs.

Multiple precompiled driver versions are available for [[DebianJessie|Debian 8 "Jessie"]]:

 * [[#jessie-375|Version 375.66]] ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/375.66/README/supportedchips.html|supported devices]])
  * For Kepler/Maxwell/newer GPUs.
  * Note that 375.66 is currently only available in jessie-backports.
 * [[#jessie|Version 340.102]] ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/340.102/README/supportedchips.html|supported devices]])
  * For !GeForce 8xxx through 7xx GPUs.
 * [[#jessie-304xx|Version 304.135 (legacy GPUs)]] ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/304.135/README/supportedchips.html|supported devices]])
  * For !GeForce 6xxx and 7xxx GPUs.

Four driver versions are available for [[DebianWheezy|Debian 7 "Wheezy"]]:

 * [[#wheezy-backports|Version 340.65]] ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/340.65/README/supportedchips.html|supported devices]])
  * For !GeForce 8xxx and higher GPUs.
 * [[#wheezy|Version 304.125]] ([[http://us.download.nvidia.com/XFree86/Linux-x86/304.125/README/supportedchips.html|supported devices]])
  * For !GeForce 6xxx and higher GPUs.
 * [[#wheezy-173xx|Version 173.14.35 (legacy GPUs)]] ([[http://www.nvidia.com/object/IO_32667.html|supported devices]])
  * For !GeForce 5xxx / !GeForce FX GPUs.
 * [[#wheezy-96xx|Version 96.43.23 (legacy GPUs)]] ([[http://www.nvidia.com/object/IO_32667.html|supported devices]])
  * For !GeForce 2, !GeForce 3 and !GeForce 4 GPUs.

All versions above are available only for the x86 and x86-64 architectures (Debian [[i386]] and [[DebianAMD64|AMD64]] ports respectively).
Line 39: Line 77:
Here are the instructions for building and installing your nVidia drivers, the Debian way.
=== Overview ===
The NVIDIA driver consists of two parts: a kernel module, and a collection of user-space libraries. The libraries (sometimes called the "binary driver" or GLX libraries) are distributed in binary form by NVIDIA, and packaged for Debian in the nvidia-glx package. 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 nvidia-kernel-source and nvidia-kernel-common packages. The version of the kernel module has to match the version of the libraries. The user libraries and kernel module source only have to be installed once. Then the kernel module has to be rebuilt every time you change or rebuild your kernel. So, here's what you have to do:

   1. Build and install the kernel module.
   2. Install the user-space libraries.
   3. Configure X to use the '''nvidia''' driver and add the '''nvidia''' module to /etc/modules

Step 2 has to be performed after step 1 because of some dependencies, as explained below.

Steps 2 and 3 have to be performed only once. Step 1 has to be repeated every time you change your kernel, but with the help of module-assistant, apt-get, and make-kpkg, it's hardly any work at all. We'll come back to this at the end of the installation section.

=== Steps ===
==== Build and 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 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. 2.4.27-2-386 or 2.6.8-2-k7). If it does, you're most likely running a stock kernel.

===== Methods =====

There are four different methods that you can use to install the kernel module. If that sounds like a lot, don't worry—they're listed in order of difficulty. So start with the first one, and if it doesn't work for you, go on down the list.

====== Use module-assistant ======
This method is very easy, and should work for most people, with either a stock or custom kernel.

Install module-assistant if you don't have it, and nvidia-kernel-common. To do it with apt-get:
{{{
apt-get install module-assistant nvidia-kernel-common
}}}
Then run:
{{{
m-a prepare
m-a auto-install nvidia
}}}
And that's it. If all went well, your '''nvidia''' kernel module is now built and installed; you may proceed to step 2.

Note: 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-3.4 instead of gcc-3.3.

====== 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. If the module-assistant method doesn't work for you and there are pre-built modules available for your kernel, use this method.

As of this writing, pre-built modules are only available for kernel 2.4.27, Sarge's default kernel. There are no pre-built modules for 2.6.8. 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-". To do it with apt-get:
{{{
apt-get install nvidia-kernel-$(uname -r)
}}}

If this step succeeds, you may now proceed to step 2. If not, try a different installation method.

====== Build manually, with a stock kernel ======
Use this method if you're running a stock kernel and the two previous methods failed or didn't apply to you. 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.4.27-2-k7 or 2.6.8-1-686) in a couple of environment variables:

                export KVERS=$(uname -r)
                export KSRC=/usr/src/kernel-headers-$KVERS

            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.
         2. 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.
         3. Install the header files for your kernel:

                apt-get install kernel-headers-$KVERS

            This will give you kernel header files in /usr/src/kernel-headers-$KVERS. Be sure to check that the installed kernel image and kernel header packages have the same version number: run

                apt-cache policy kernel-image-$KVERS kernel-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 kernel-headers that you need, e.g. testing, and rerun the above installation command, adding '-t testing' (or whichever).
         4. 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.
         5. 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 proceed to step 2, below.

====== Build manually, with a custom kernel ======
Use this method if you're configuring and building a custom kernel.

1. Install the kernel module source. To do it with apt-get:
{{{
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.

2. 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
{{{
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:
 * Graphics Support –> nVidia Riva support (FB_RIVA)
 * 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 page.

3. Build the kernel and the nvidia kernel module:
{{{
cd /usr/src/linux
make-kpkg clean
make-kpkg kernel_image modules_image
}}}
For an introduction to using make-kpkg to build kernel packages, see "Creating custom kernels with Debian's kernel-package system", or "Compiling Kernels the Debian Way". See also the make-kpkg 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, { kernel | 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.

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.

4. Install the new kernel and kernel module:
{{{
cd /usr/src
dpkg -i /path/kernel-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 kernel-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.

=== Redo step1 ===

***contrib non-free***

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

For problems, comments, or questions about the information in this HOWTO, you can write to me. I'm no expert, but I'll do my best to make the information useful.

=== 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-390)>>
==== Version 390.48 (via stretch-backports) ====

For support of Geforce 4xx and higher GPUs [[http://us.download.nvidia.com/XFree86/Linux-x86_64/390.48/README/supportedchips.html|Supported devices]]. For older devices, see [[#stretch-340xx|Version 340.102 (legacy GPUs)]] and [[#stretch-304xx|Version 304.135 (legacy GPUs)]].

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

 1. Install Linux headers for the kernel you are using. If you are using the 4.9 Linux kernel in Debian Stretch:{{{
# apt-get install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//')
}}}
 Or if you are using a Linux kernel from stretch-backports:{{{
# apt-get install -t stretch-backports linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//')
}}}

 1. Then we can install the package `nvidia-driver`.{{{
# apt-get update
# apt-get install -t stretch-backports nvidia-driver
}}}
 DKMS will build the nvidia module for your system.

 1. Restart your system to enable the nouveau blacklist.

<<Anchor(stretch)>>

==== Version 375.66 ====

For support of GeForce 4xx and higher GPUs ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/375.66/README/supportedchips.html|supported devices]]). For older devices, see [[#stretch-340xx|Version 340.105 (legacy GPUs)]] and [[#stretch-304xx|Version 304.135 (legacy GPUs)]].

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 9 "Stretch"
deb http://httpredir.debian.org/debian/ stretch main contrib non-free
}}}
 1. Update the list of available packages. Install the appropriate linux-headers and kernel module packages: {{{
# apt update
# apt install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-driver
}}}
 This will install the [[DebianPkg:stretch/nvidia-driver|nvidia-driver]] package. DKMS will build the nvidia module for your system, via the nvidia-kernel-dkms package.
 1. Restart your system to enable the nouveau blacklist.
 1. (The answer [[http://askubuntu.com/a/595884/416671|here]] may be needed to enable a higher resolution.)

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

For support of !GeForce 6xxx and 7xxx GPUs ([[http://us.download.nvidia.com/XFree86/Linux-x86/340.102/README/supportedchips.html|supported devices]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 9 "Stretch"
deb http://httpredir.debian.org/debian/ stretch main contrib non-free
}}}
 1. Update the list of available packages. Install the appropriate linux-headers and kernel module packages: {{{
# apt update
# apt install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-legacy-340xx-driver}}}
 This will install the [[DebianPkg:stretch/nvidia-legacy-340xx-driver|nvidia-legacy-340xx-driver]] package. DKMS will build the nvidia module for your system, via the nvidia-legacy-340xx-kernel-dkms package.
 1. Create an [[#configure|Xorg server configuration file]].
 1. Restart your system to enable the nouveau blacklist.

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

For support of !GeForce 6xxx and 7xxx GPUs ([[http://us.download.nvidia.com/XFree86/Linux-x86/304.135/README/supportedchips.html|supported devices]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 9 "Stretch"
deb http://httpredir.debian.org/debian/ stretch main contrib non-free
}}}
 1. Update the list of available packages. Install the appropriate linux-headers and kernel module packages: {{{
# apt update
# apt install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-legacy-304xx-driver}}}
 This will install the [[DebianPkg:jessie/nvidia-legacy-304xx-driver|nvidia-legacy-304xx-driver]] package. DKMS will build the nvidia module for your system, via the nvidia-legacy-304xx-kernel-dkms package.
 1. Create an [[#configure|Xorg server configuration file]].
 1. Restart your system to enable the nouveau blacklist.

=== Debian 8 "Jessie" ===
As of jessie, if you only need basic functionality and don't care about performances, the need for the proprietary drivers is pretty much over - nouveau now works quite well and works with dual-headed displays by simple and easy configuring from within your desktop (for KDE Plasma see ''System_Settings/Hardware/Display_and_Monitor/Display_Configuration''). The proprietary drivers don't provide normal logging and can be a hidden source of problems. If you are doing a distribution upgrade, you should at the very least remove all the nvidia packages from wheezy, get your desktop working with nouveau, then reinstall the nvidia packages if there is a pressing reason.

<<Anchor(jessie-375)>>
==== Version 375.66 (via jessie-backports) ====

For support of Geforce 4xx and higher GPUs [[http://http.download.nvidia.com/XFree86/Linux-x86_64/375.66/README/supportedchips.html|Supported devices]]. For older devices, see [[#jessie-340xx|Version 340.102 (legacy GPUs)]] and [[#jessie-304xx|Version 304.135 (legacy GPUs)]].

 1. Add jessie-backports to your /etc/apt/sources.list, for example: {{{
# jessie-backports
deb http://httpredir.debian.org/debian jessie-backports main contrib non-free
}}}

 1. Install Linux headers for the kernel you are using. If you are using the 3.16 Linux kernel in Debian Jessie:{{{
# apt-get install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//')
}}}
 Or if you are already using a Linux kernel from jessie-backports:{{{
# apt-get install -t jessie-backports linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//')
}}}

 1. Then we can install the package `nvidia-driver`.{{{
# apt-get update
# apt-get install -t jessie-backports nvidia-driver
}}}
 DKMS will build the nvidia module for your system.

 1. Restart your system to enable the nouveau blacklist.

<<Anchor(jessie)>>

==== Version 340.102 ====

For support of !GeForce 8xxx and higher GPUs ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/340.102/README/supportedchips.html|supported devices]]). For older devices, see [[#jessie-304xx|Version 304.135 (legacy GPUs)]].

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 8 "Jessie"
deb http://httpredir.debian.org/debian/ jessie main contrib non-free
}}}
 1. Update the list of available packages. Install the appropriate linux-headers and kernel module packages: {{{
# aptitude update
# aptitude -r install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-driver
}}}
 This will install the [[DebianPkg:jessie/nvidia-driver|nvidia-driver]] package. DKMS will build the nvidia module for your system, via the nvidia-kernel-dkms package.
 1. Create an [[#configure|Xorg server configuration file]].
 1. Restart your system to enable the nouveau blacklist.
 1. (The answer [[http://askubuntu.com/a/595884/416671|here]] may be needed to enable a higher resolution.)

<<Anchor(jessie-304xx)>>
==== Version 304.135 (legacy GPUs) ====

For support of !GeForce 6xxx and 7xxx GPUs ([[http://us.download.nvidia.com/XFree86/Linux-x86/304.135/README/supportedchips.html|supported devices]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 8 "Jessie"
deb http://httpredir.debian.org/debian/ jessie main contrib non-free
}}}
 1. Update the list of available packages. Install the appropriate linux-headers and kernel module packages: {{{
# aptitude update
# aptitude -r install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-legacy-304xx-driver}}}
 This will install the [[DebianPkg:jessie/nvidia-legacy-304xx-driver|nvidia-legacy-304xx-driver]] package. DKMS will build the nvidia module for your system, via the nvidia-legacy-304xx-kernel-dkms package.
 1. Create an [[#configure|Xorg server configuration file]].
 1. Restart your system to enable the nouveau blacklist.

=== Debian 7 "Wheezy" ===

<<Anchor(wheezy-backports)>>
==== Version 340.96 (via wheezy-backports) ====

For support of !GeForce 8xxx and higher GPUs ([[http://us.download.nvidia.com/XFree86/Linux-x86_64/340.65/README/supportedchips.html|supported devices]]). This is made available from [[Backports|wheezy-backports]].

 1. Add wheezy-backports to your {{{/etc/apt/sources.list}}}, for example: {{{
# wheezy-backports
deb http://httpredir.debian.org/debian/ wheezy-backports main contrib non-free
}}}
 1. Update the list of available packages: {{{
# aptitude update
}}}
 1. Install the appropriate linux-headers package: {{{
# aptitude install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//')
}}}
 1. Install the kernel module package from wheezy-backports: {{{
# aptitude -t wheezy-backports -r install nvidia-driver
}}}
 This will install the [[DebianPkg:wheezy-backports/nvidia-driver|nvidia-driver]] package. DKMS will build the nvidia module for your system, via the nvidia-kernel-dkms package.
 1. Create an [[#configure|Xorg server configuration file]].
 1. Restart your system to enable the nouveau blacklist.

<<Anchor(wheezy)>>
==== Version 304.125 ====

For support of !GeForce 6xxx and higher GPUs ([[http://us.download.nvidia.com/XFree86/Linux-x86/304.125/README/supportedchips.html|supported devices]]). For older devices, see [[#wheezy-173xx|Version 173.14.35 (legacy GPUs)]] and [[#wheezy-96xx|Version 96.43.23 (legacy GPUs)]].

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 7 "Wheezy"
deb http://httpredir.debian.org/debian/ wheezy main contrib non-free
}}}
 1. Update the list of available packages. Install the appropriate linux-headers and kernel module packages: {{{
# aptitude update
# aptitude -r install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-glx
}}}
 This will install the [[DebianPkg:wheezy/nvidia-glx|nvidia-glx]] package. DKMS will build the nvidia module for your system, via the nvidia-kernel-dkms package.
 1. Create an [[#configure|Xorg server configuration file]].
 1. Restart your system to enable the nouveau blacklist.

<<Anchor(wheezy-173xx)>>
==== Version 173.14.35 (legacy GPUs) ====

For support of !GeForce 5xxx / !GeForce FX GPUs ([[http://www.nvidia.com/object/IO_32667.html|supported devices]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 7 "Wheezy"
deb http://httpredir.debian.org/debian/ wheezy main contrib non-free
}}}
 1. Update the list of available packages. Install the appropriate linux-headers and kernel module packages: {{{
# aptitude update
# aptitude -r install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-legacy-173xx-driver
}}}
 This will install the [[DebianPkg:wheezy/nvidia-glx-legacy-173xx|nvidia-glx-legacy-173xx]] package. DKMS will build the nvidia module for your system, via the nvidia-legacy-173xx-kernel-dkms package.
 1. Create an [[#configure|Xorg server configuration file]].
 1. Restart your system to enable the nouveau blacklist.

<<Anchor(wheezy-96xx)>>
==== Version 96.43.23 (legacy GPUs) ====

For support of !GeForce 2, !GeForce 3 and !GeForce 4 GPUs ([[http://www.nvidia.com/object/IO_32667.html|supported devices]]).

 1. Add "contrib" and "non-free" components to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 7 "Wheezy"
deb http://httpredir.debian.org/debian/ wheezy main contrib non-free
}}}
 1. Update the list of available packages. Install the appropriate linux-headers and kernel module packages: {{{
# aptitude update
# aptitude -r install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-driver
}}}
 This will also install the recommended [[DebianPkg:wheezy/nvidia-glx-legacy-96xx|nvidia-glx-legacy-96xx]] package. DKMS will build the nvidia module for your system, via the nvidia-legacy-96xx-kernel-dkms package.
 1. Create an [[#configure|Xorg server configuration file]].
 1. Restart your system to enable the nouveau blacklist.

<<Anchor(git)>>
=== Building newer releases from GIT ===

TODO...

<<Anchor(svn)>>
=== Building newer releases from SVN ===

As new upstream versions of the proprietary driver are released, upload might not happen immediately. This might be for various reasons, including waiting for new binary packages to clear the NEW queue, which has to be approved manually by the FTP masters.

Before running the upstream installer, which might cause problems to your installation, you can build and install the packages locally if they are ready on SVN. Check if the version you are interested in is available:

https://anonscm.debian.org/viewvc/pkg-nvidia/packages/nvidia-graphics-drivers/branches/

If it is, install the following: {{{
# apt-get install subversion svn-buildpackage
# apt-get build-dep nvidia-driver
}}}

Then checkout the branch you want and build it locally: {{{
# svn co svn://anonscm.debian.org/pkg-nvidia/packages/nvidia-graphics-drivers/branches/384
# cd 384
# debian/rules get-orig-source
# mkdir ../tarballs
# mv nvidia-graphics-drivers* ../tarballs
# svn-buildpackage --svn-ignore -us -uc -rfakeroot
}}}

and if you need multiarch packages (i.e. i386 on amd64) - required for steam to work: {{{
# sudo apt-get install libwayland-client0:i386 libwayland-server0:i386
# svn-buildpackage --svn-ignore --svn-arch=i386 -us -uc -rfakeroot
}}}

NOTE: for the multiarch, for example on amd64 with i386, you must NOT install all the packages from the foreign architecture, but ONLY either libgl1-nvidia-glx-i386 or nvidia-driver-libs-i386 depending on the branch, and their dependencies.

NOTE: to use get-orig-source you'll need tar version 1.29 or higher, if that is not an option (e.g. in jessie) you can modify the {{{debian/rules}}} file by deleting the new {{{tar}}} arguments that doesn't exist in older tar versions ({{{--clamp-mtime}}} and {{{--sort}}}):

{{{
$ svn diff debian/rules
Index: debian/rules
===================================================================
--- debian/rules (revision 6570)
+++ debian/rules (working copy)
@@ -380,8 +380,7 @@
            chmod 0755 $(ORIGDIR.$*)/* ; \
            latestfile=$$(ls -tr $$(find $(ORIGDIR.$*) -type f) | tail -n 1) ; \
            tar cv \
- --clamp-mtime --mtime="./$$latestfile" \
- --sort=name \
+ --mtime="./$$latestfile" \
                --owner=root --group=src \
                $(ORIGDIR.$*) \
                | gzip -n -9 > $(TARBALL.$*) ; \

}}}

This way {{{debian/rules get-orig-source}}} command will work fine in jessie. In case it doesn't work you may try creating the tarball manually following the schema used by an existing one in the Debian archive.

NOTE: if the {{{svn-buildpackage}}} command fails with a message from {{{tar}}} like this:
{{{
tar: /home/foo/tmp/nvidia/build-area/tmp-0.834000333984481: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Command ' tar --no-same-owner --no-same-permissions --extract --file /home/foo/tmp/nvidia/tarballs/nvidia-graphics-drivers_367.35.orig-armhf.tar.gz --directory /home/foo/tmp/nvidia/build-area/tmp-0.834000333984481' failed in '/home/foo/tmp/nvidia/367', how to continue now? [Qri?]:
}}}
then create the missing {{{/home/foo/tmp/nvidia/build-area/tmp-0.834000333984481}}} directory (the name changes every time, so create it in another terminal) and press {{{r}}} to retry the command. You will need to create the directory twice. After that, the build should succeed.

<<Anchor(configure)>>
== Configuration ==

As the nvidia driver is not autodetected by [[Xorg]], a configuration file is required to be supplied. However, the configuration described below should '''not''' be applied to Nvidia Optimus systems; on such systems, the primary X display is driven by your Intel GPU, which is autodetected by X. See [[Bumblebee]] for more details on how to configure an Optimus system.

=== 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 [[Bumblebee]] instead.

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

[[/Configuration|Additional configuration information]] is available.

== CUDA ==

=== Debian 9 "Stretch" ===

CUDA 8 is available from the non-free repository

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

This installs `nvcc` and friends. The visual profiler is in a seperate package `nvidia-visual-profiler`.

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

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


Note that if you are mixed code compiled with `gcc` and `nvcc`, [[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=861878|you may need to also add]]
{{{
--compiler-options -fpie
}}}

to nvcc command line




== Troubleshooting ==

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

== Backing out in case of failure ==
In case you want to restore your system to the state it was before, do:

If you can't use your desktop environment:

hit Ctrl+alt+F2

login as root
{{{

 # apt-get purge nvidia. (don't forget the "." dot) It erases every package with "nvidia" on its name


 # /etc/init.d/gdm3 stop (gdm3 for gnome 3)

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

 # killall Xorg

 # reboot
}}}

Xorg should reconfigure itself, if not run a terminal and pass{{{

# X -configure}}}



== See Also ==

 * [[/Configuration]]
 * [[/Troubleshooting]]
 * [[/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.

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

Identification

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

  • $ lspci -nn | egrep -i "3d|display|vga"
    01:00.0 VGA compatible controller [0300]: NVIDIA Corporation G80 [GeForce 8800 GTS] [10de:0193] (rev a2)

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, and the instructions on this page do not apply to you. Check the Bumblebee page instead.

nvidia-detect

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

  • $ nvidia-detect
    Detected NVIDIA GPUs:
    02:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF108 [GeForce GT 430] [10de:0de1] (rev a1)
    Your card is supported by the default drivers.
    It is recommended to install the
        nvidia-driver
    package.

Drivers

The proprietary "NVIDIA Accelerated Linux Graphics Driver" provides optimized hardware acceleration of OpenGL applications via a direct-rendering X server. It is a binary-only Xorg driver requiring a Linux kernel module for its use.

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

Multiple precompiled driver versions are available for Debian 8 "Jessie":

Four driver versions are available for Debian 7 "Wheezy":

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

Installation

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 390.48 (via stretch-backports)

For support of Geforce 4xx and higher GPUs Supported devices. For older devices, see Version 340.102 (legacy GPUs) and Version 304.135 (legacy GPUs).

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

    # stretch-backports
    deb http://httpredir.debian.org/debian stretch-backports main contrib non-free
  2. Install Linux headers for the kernel you are using. If you are using the 4.9 Linux kernel in Debian Stretch:

    # apt-get install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//')

    Or if you are using a Linux kernel from stretch-backports:

    # apt-get install -t stretch-backports linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//')
  3. Then we can install the package nvidia-driver.

    # apt-get update
    # apt-get install -t stretch-backports nvidia-driver 
    DKMS will build the nvidia module for your system.
  4. Restart your system to enable the nouveau blacklist.

Version 375.66

For support of ?GeForce 4xx and higher GPUs (supported devices). For older devices, see Version 340.105 (legacy GPUs) and Version 304.135 (legacy GPUs).

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

    # Debian 9 "Stretch"
    deb http://httpredir.debian.org/debian/ stretch main contrib non-free
  2. Update the list of available packages. Install the appropriate linux-headers and kernel module packages:

    # apt update
    # apt install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-driver

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

  3. Restart your system to enable the nouveau blacklist.
  4. (The answer here may be needed to enable a higher resolution.)

Version 340.102 (legacy GPUs)

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

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

    # Debian 9 "Stretch"
    deb http://httpredir.debian.org/debian/ stretch main contrib non-free
  2. Update the list of available packages. Install the appropriate linux-headers and kernel module packages:

    # apt update
    # apt install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-legacy-340xx-driver

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

  3. Create an Xorg server configuration file.

  4. Restart your system to enable the nouveau blacklist.

Version 304.135 (legacy GPUs)

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

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

    # Debian 9 "Stretch"
    deb http://httpredir.debian.org/debian/ stretch main contrib non-free
  2. Update the list of available packages. Install the appropriate linux-headers and kernel module packages:

    # apt update
    # apt install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-legacy-304xx-driver

    This will install the nvidia-legacy-304xx-driver package. DKMS will build the nvidia module for your system, via the nvidia-legacy-304xx-kernel-dkms package.

  3. Create an Xorg server configuration file.

  4. Restart your system to enable the nouveau blacklist.

Debian 8 "Jessie"

As of jessie, if you only need basic functionality and don't care about performances, the need for the proprietary drivers is pretty much over - nouveau now works quite well and works with dual-headed displays by simple and easy configuring from within your desktop (for KDE Plasma see System_Settings/Hardware/Display_and_Monitor/Display_Configuration). The proprietary drivers don't provide normal logging and can be a hidden source of problems. If you are doing a distribution upgrade, you should at the very least remove all the nvidia packages from wheezy, get your desktop working with nouveau, then reinstall the nvidia packages if there is a pressing reason.

Version 375.66 (via jessie-backports)

For support of Geforce 4xx and higher GPUs Supported devices. For older devices, see Version 340.102 (legacy GPUs) and Version 304.135 (legacy GPUs).

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

    # jessie-backports
    deb http://httpredir.debian.org/debian jessie-backports main contrib non-free
  2. Install Linux headers for the kernel you are using. If you are using the 3.16 Linux kernel in Debian Jessie:

    # apt-get install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//')

    Or if you are already using a Linux kernel from jessie-backports:

    # apt-get install -t jessie-backports linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//')
  3. Then we can install the package nvidia-driver.

    # apt-get update
    # apt-get install -t jessie-backports nvidia-driver 
    DKMS will build the nvidia module for your system.
  4. Restart your system to enable the nouveau blacklist.

Version 340.102

For support of GeForce 8xxx and higher GPUs (supported devices). For older devices, see Version 304.135 (legacy GPUs).

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

    # Debian 8 "Jessie"
    deb http://httpredir.debian.org/debian/ jessie main contrib non-free
  2. Update the list of available packages. Install the appropriate linux-headers and kernel module packages:

    # aptitude update
    # aptitude -r install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-driver

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

  3. Create an Xorg server configuration file.

  4. Restart your system to enable the nouveau blacklist.
  5. (The answer here may be needed to enable a higher resolution.)

Version 304.135 (legacy GPUs)

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

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

    # Debian 8 "Jessie"
    deb http://httpredir.debian.org/debian/ jessie main contrib non-free
  2. Update the list of available packages. Install the appropriate linux-headers and kernel module packages:

    # aptitude update
    # aptitude -r install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-legacy-304xx-driver

    This will install the nvidia-legacy-304xx-driver package. DKMS will build the nvidia module for your system, via the nvidia-legacy-304xx-kernel-dkms package.

  3. Create an Xorg server configuration file.

  4. Restart your system to enable the nouveau blacklist.

Debian 7 "Wheezy"

Version 340.96 (via wheezy-backports)

For support of GeForce 8xxx and higher GPUs (supported devices). This is made available from wheezy-backports.

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

    # wheezy-backports
    deb http://httpredir.debian.org/debian/ wheezy-backports main contrib non-free
  2. Update the list of available packages:

    # aptitude update
  3. Install the appropriate linux-headers package:

    # aptitude install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//')
  4. Install the kernel module package from wheezy-backports:

    # aptitude -t wheezy-backports -r install nvidia-driver

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

  5. Create an Xorg server configuration file.

  6. Restart your system to enable the nouveau blacklist.

Version 304.125

For support of GeForce 6xxx and higher GPUs (supported devices). For older devices, see Version 173.14.35 (legacy GPUs) and Version 96.43.23 (legacy GPUs).

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

    # Debian 7 "Wheezy"
    deb http://httpredir.debian.org/debian/ wheezy main contrib non-free
  2. Update the list of available packages. Install the appropriate linux-headers and kernel module packages:

    # aptitude update
    # aptitude -r install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-glx

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

  3. Create an Xorg server configuration file.

  4. Restart your system to enable the nouveau blacklist.

Version 173.14.35 (legacy GPUs)

For support of GeForce 5xxx / GeForce FX GPUs (supported devices).

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

    # Debian 7 "Wheezy"
    deb http://httpredir.debian.org/debian/ wheezy main contrib non-free
  2. Update the list of available packages. Install the appropriate linux-headers and kernel module packages:

    # aptitude update
    # aptitude -r install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-legacy-173xx-driver

    This will install the nvidia-glx-legacy-173xx package. DKMS will build the nvidia module for your system, via the nvidia-legacy-173xx-kernel-dkms package.

  3. Create an Xorg server configuration file.

  4. Restart your system to enable the nouveau blacklist.

Version 96.43.23 (legacy GPUs)

For support of GeForce 2, GeForce 3 and GeForce 4 GPUs (supported devices).

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

    # Debian 7 "Wheezy"
    deb http://httpredir.debian.org/debian/ wheezy main contrib non-free
  2. Update the list of available packages. Install the appropriate linux-headers and kernel module packages:

    # aptitude update
    # aptitude -r install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-driver

    This will also install the recommended nvidia-glx-legacy-96xx package. DKMS will build the nvidia module for your system, via the nvidia-legacy-96xx-kernel-dkms package.

  3. Create an Xorg server configuration file.

  4. Restart your system to enable the nouveau blacklist.

Building newer releases from GIT

TODO...

Building newer releases from SVN

As new upstream versions of the proprietary driver are released, upload might not happen immediately. This might be for various reasons, including waiting for new binary packages to clear the NEW queue, which has to be approved manually by the FTP masters.

Before running the upstream installer, which might cause problems to your installation, you can build and install the packages locally if they are ready on SVN. Check if the version you are interested in is available:

https://anonscm.debian.org/viewvc/pkg-nvidia/packages/nvidia-graphics-drivers/branches/

If it is, install the following:

# apt-get install subversion svn-buildpackage
# apt-get build-dep nvidia-driver

Then checkout the branch you want and build it locally:

# svn co svn://anonscm.debian.org/pkg-nvidia/packages/nvidia-graphics-drivers/branches/384
# cd 384
# debian/rules get-orig-source
# mkdir ../tarballs
# mv nvidia-graphics-drivers* ../tarballs
# svn-buildpackage --svn-ignore -us -uc -rfakeroot

and if you need multiarch packages (i.e. i386 on amd64) - required for steam to work:

# sudo apt-get install libwayland-client0:i386 libwayland-server0:i386
# svn-buildpackage --svn-ignore --svn-arch=i386 -us -uc -rfakeroot

NOTE: for the multiarch, for example on amd64 with i386, you must NOT install all the packages from the foreign architecture, but ONLY either libgl1-nvidia-glx-i386 or nvidia-driver-libs-i386 depending on the branch, and their dependencies.

NOTE: to use get-orig-source you'll need tar version 1.29 or higher, if that is not an option (e.g. in jessie) you can modify the debian/rules file by deleting the new tar arguments that doesn't exist in older tar versions (--clamp-mtime and --sort):

$ svn diff debian/rules
Index: debian/rules
===================================================================
--- debian/rules        (revision 6570)
+++ debian/rules        (working copy)
@@ -380,8 +380,7 @@
            chmod 0755 $(ORIGDIR.$*)/* ; \
            latestfile=$$(ls -tr $$(find $(ORIGDIR.$*) -type f) | tail -n 1) ; \
            tar cv \
-               --clamp-mtime --mtime="./$$latestfile" \
-               --sort=name \
+               --mtime="./$$latestfile" \
                --owner=root --group=src \
                $(ORIGDIR.$*) \
                | gzip -n -9 > $(TARBALL.$*) ; \

This way debian/rules get-orig-source command will work fine in jessie. In case it doesn't work you may try creating the tarball manually following the schema used by an existing one in the Debian archive.

NOTE: if the svn-buildpackage command fails with a message from tar like this:

tar: /home/foo/tmp/nvidia/build-area/tmp-0.834000333984481: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Command ' tar --no-same-owner --no-same-permissions --extract --file /home/foo/tmp/nvidia/tarballs/nvidia-graphics-drivers_367.35.orig-armhf.tar.gz --directory /home/foo/tmp/nvidia/build-area/tmp-0.834000333984481' failed in '/home/foo/tmp/nvidia/367', how to continue now? [Qri?]:

then create the missing /home/foo/tmp/nvidia/build-area/tmp-0.834000333984481 directory (the name changes every time, so create it in another terminal) and press r to retry the command. You will need to create the directory twice. After that, the build should succeed.

Configuration

As the nvidia driver is not autodetected by Xorg, a configuration file is required to be supplied. However, the configuration described below should not be applied to Nvidia Optimus systems; on such systems, the primary X display is driven by your Intel GPU, which is autodetected by X. See Bumblebee for more details on how to configure an Optimus system.

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 Bumblebee instead.

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

Additional configuration information is available.

CUDA

Debian 9 "Stretch"

CUDA 8 is available from the non-free repository

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

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

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

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

export PERL5LIB=. 

To compile the samples, you first need to set

export HOST_COMPILER=clang++-3.8

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

--compiler-options -fpie 

to nvcc command line

Troubleshooting

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

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

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

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

        Option         "RegistryDwords" "EnableBrightnessControl=1;"

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

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

    to the file: /etc/rc.local

  • Additional troubleshooting information is available.

Backing out in case of failure

In case you want to restore your system to the state it was before, do:

If you can't use your desktop environment:

hit Ctrl+alt+F2

login as root

 # apt-get purge nvidia. (don't forget the "." dot) It erases every package with "nvidia" on its name


 # /etc/init.d/gdm3 stop  (gdm3 for gnome 3)

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

 # killall Xorg

 # reboot

Xorg should reconfigure itself, if not run a terminal and pass

# X -configure

See Also


CategoryProprietarySoftware CategoryHardware CategoryVideo