DeskTux

Linux on Desktops

User Tools

Site Tools


misc:nvidia

Nvidia

The installation of the Nvidia driver in Linux is already really easy. But some small tips for the installation never hurt ;-)

Nvidia driver installation

Please follow these steps as root.

As of Debian 6.0 (Squeeze) the new driver/module 'nouveau' is used for the framebuffer as well as X. This conflicts with the 'nvidia' kernel module and thus 'nouveau' must be blacklisted (or uninstalled). If you follow The Debian Way this happens automatically. If you wish to use the official driver from Nvidia you must do that manually (see below for more information).

The Debian Way

If you don't need the latest driver versions for any specific reason, I recommend installing the Nvidia drivers the Debian way. This method is easier, faster and less vulnerable to kernel changes.

An extensive description is given in the Debian Wiki, especially the section about DKMS is important. Here I'll just summarize the steps for your (and my) convenience that are specific for Debian (and the latest Nvidia cards).

Just install some necessary tools:

apt install linux-headers-`uname -r` nvidia-kernel-dkms

That's it already, you can now continue with the configuration of X!

Official Nvidia drivers

If you need the latest driver for any reason (e.g. you just got a brand-new card that is not yet supported), please follow these steps for the installation of the official Nvidia driver.

Blacklisting 'nouveau'

This is only relevant if you use Debian GNU/Linux 6.0 (Squeeze) or later.

Because the 'nouveau' kernel module conflicts with the 'nvidia' kernel module, you will need to blacklist or uninstall it before you can begin the installation.

To accomplish this create a new file nouveau.conf in /etc/modprobe.d/ and add this line:

blacklist nouveau

When done, reboot your system and you can proceed with the Nvidia driver installation.

Installing the driver

  1. Download the latest driver from Nvidia, afterwards make it executable.
  2. Install your Kernel headers and some build tools. On Debian (Etch or later) run this:
    apt install linux-headers-`uname -r` build-essential dkms
  3. Invoke the Nvidia Installer. I, personally, prefer a few options as well (see below for an explanation):
    ./NVIDIA-Linux-<version>.run -a -n -s --dkms
  4. Edit your X-configuration file (usually /etc/X11/xorg.conf), I don't trust the script to do that accurately. See below for the steps.

That's it!

For more useful information make sure you read the Nvidia README1), it is really extensive. If everything went well you should have 2D and 3D acceleration in X. Enjoy!

Explanations of the used options
-a Accept the license agreement
-n Don't use precompiled drivers
-s Use the default answer on most questions (silent/quiet mode)
--dkms Use DKMS to build the module, ensuring it will continue to work on kernel updates

X configuration

Nowadays, xorg works mainly based on auto detection. Thus there is no more xorg.conf available, you'll have to create it manually. To get your NVidia card working with the nvidia driver though, a minimal xorg.conf is sufficient. You can check my fully assembled xorg.conf for your convenience.

Section "Module"

Create this section using this content:

Section "Module"
	Load		"glx"
EndSection

Section "Device"

Create this section using this content:

Section "Device"
	Identifier	"Whatever card you have"
	Driver		"nvidia"
EndSection

Troubleshooting

As a general rule for troubleshooting: check the logs! In /var/log/Xorg.?.log you can find very useful information why e.g. your X-server didn't start or why the screen stays blank/black. Check especially for lines beginning with (EE).

It often also helps to start X manually from a console. Just log in as user en run startx. If you land back on the console the last messages often give a clue what went wrong.

Optimus Hardware issues

If you are running a notebook with Nvidia Optimus technology just installing the Nvidia driver (either the Debian way or the official driver), chances are that Xorg won't detect a display card at all. In that case, installing Bumblebee will most certainly help:

# apt-get install bumblebee-nvidia primus

In this case even an xorg.conf is not necessary at all. For this to work in Debian Wheezy you need to activate the Backports repository in your sources.list.

Is 3D Acceleration working?

To check if the 3D acceleration is actually working, just start a terminal and run this command:

glxinfo|head

There should be a line direct rendering: Yes which indicates that the 3D acceleration actually works.

GCC errors

If you get GCC errors while installing the Nvidia drivers please read this information. GCC errors can happen using the Debian way as well as with the official Nvidia drivers. GCC errors occur if the compiler used to compile the kernel is not the same as used to compile the Nvidia driver module.

For example in Lenny the kernel is compiled w/ gcc-4.1 whereas gcc-4.3 is the default compiler.

To install the latest Nvidia driver in Lenny you should:

  1. Install gcc-4.1:
    apt-get install gcc-4.1
  2. Use at least version 177.76 of the driver. Beta-drivers can be found on the Nvidia forums
  3. Run this to install:
    export CC=gcc-4.1; ./NVIDIA-Linux-<version>.run -a -n -s --dkms

To check which compiler version was used to compile your kernel you can use the command cat /proc/version (look for the part named “gcc version”).

1)
Found on the same page as the driver download, on the tab “Additional Information”.
misc/nvidia.txt · Last modified: 2019-11-09 08:26 by jens