NVidia:Basic Installation

From Linux 3D

Contents

Introduction

This chapter will give you a short introduction on why to use the binary drivers published by NVIDIA and why there is a problem with those drivers concerning the idea of Open Source Software.

Some distributions inform their users during installation that there will be no 3D support by default. Why ? Because the NVIDIA drivers are built under the NVIDIA Software License, which is non-free. To avoid problems due to license conflicts, distributors do not include those software packages. Some others do provide those packages.

Nevertheless the Graphical User Interface does work well. Xserver and windowmanager will do their jobs properly because there is a free software clone of this nvidia-driver provided and developed by the DRI-Project.

So why don't use them? Of course you can use them. But notice, that they do not have 3D acceleration support, which you need to play OpenGL games such as Unreal Tournament or Quake.

This article will help you to install the closed-source driver modules to gain 3D support.

The X server

As most should already know GNU/Linux isn't just a kernel. You need at least one terminal to tell the kernel what to do. Of course you do not have to enter cryptical letters into the terminal because you can use your mouse and use graphical user interfaces (GUIs).

The X Window System provides the ability to use a mouse and get interfaces. It reads the mouse and the keyboard and gives you surface. Actually there are two possible X implementations : X.org and XFree86. It does not matter which one you have installed because the NVIDIA drivers support both.

The configuration file for the X server is located in /etc/X11/ and is called xorg.conf or XF86Config (or XF86Config-4, for example on Debian). All these use the same syntax. We will need to edit this file later to activate the NVIDIA drivers. But let's go on with the installation.

Concerning the NVIDIA drivers

The NVIDIA drivers consist of those two parts:

  • the libraries & headers are used to control the 3D-related algorithm on the GPU. This part is closed source.
  • the kernel module is used to take control over the card itself and includes it into the kernel interface. The source of this part is available.

Installation

Requirements

To be able to install the drivers successfully, software with these versions (or above) is required:

  • Linux kernel 2.4 :
    cat /proc/version
  • Xorg 6.7 or XFree86 4.0.1 :
    Xorg -version
    or
    XFree86 -version
  • Kernel modutils 2.1.121 :
    insmod -V

If you use precompiled packages, such as apt-get (for Debian) or RPM (for SUSE and Red Hat):

  • binutils 2.9.5  :
    size --version
  • GNU make 3.77  :
    make --version
  • gcc 2.91.66  :
    gcc --version
  • glibc 2.0  :
    /lib/libc.so.6

There's more than one way

There are often two ways to perform the installation on your system. There is one NVIDIA-official way, nvidia-installer. The other way, when it exists, is the one your distribution recommends. While we try to list the most popular distro-specific methods, there is no methodic way to know if your distribution recommends to install the drivers with a different method than nvidia-installer. If you have no clue, you can ask your distribution's community, or just use nvidia-installer. If you have two possible ways to install, and one fails, you could obviously try the other one.

nvidia-installer is a clever cross-platform way of installing which works fine on systems with stupid package managers (i.e. not so good with Debian, etc.).

Distribution-specific methods

These methods have the advantage that they can't conflict with your distribution's package managers. They could also be more adapted to your system, or easier/harder to perform. One potential difference you should consider is the availability of the latest drivers release in your distribution. As always, the distributions's drivers always lag some time behind the official drivers. This is also a good way to be sure you won't be installing untested stuff. But if your distributions' drivers lag more than one release, consider using nvidia-installer.

Here are the most common distro-specific installation methods. If you choose one, you can skip the rest of the installation chapter, and the next chapter if your howto also covers it.

Debian

The Debian-nVidia HOWTO entirely explains the installation process for Debian GNU/Linux, or any of its derivatives including Libranet, Mepis, Ubuntu, or Xandros. You won't need to come back here.

Gentoo Linux

Gentoo's portage offers a complete NVIDIA installation. You only need to run

emerge -av nvidia-glx

The result should look like this:

  emerge -av nvidia-glx
These are the packages that I would merge, in order:
Calculating dependencies ...done!
[ebuild N ] media-video/nvidia-kernel-1.0.6111-r3 7,976 kB [ebuild N ] media-video/nvidia-glx-1.0.6111 [1.0.6629] -multilib 0 kB
Total size of downloads: 7,976 kB
Do you want me to merge these packages? [Yes/No]

Accept and start the installation by typing Yes. Finally you need to activate the new libraries. To do avoid lots of terminal commands Gentoo offers a script called opengl-update. If it is not already installed do install it using

emerge -av opengl-update

You link the libraries and headerfiles of NVIDIA by:

opengl-update nvidia

SUSE LINUX

Use the official Nvidia Installer HOWTO for SuSE Linux users.

Recent versions of SUSE LINUX offer the possibility to do an Online Update with YOU.

  1. Start YOU using it's entry in your menu or directly run you as root.
  2. Select a mirror server and launch the manual update.
  3. Select fetchnvidia-1 .
  4. Read and accept the license.
  5. Quit you and restart your computer.

Installing with nvidia-installer

Downloading the drivers

NVIDIA has a portal for Linux users. nV News has a Linux forum. We recommend to use the most recent drivers.

NVIDIA Linux Drivers Portal: here
nV News's Linux forum: here
Most recent drivers: 1.0-7676 ---- README
Driver archive-http: here
Driver archive-ftp : here

Shutting down the X server

X must be shutdown to install the drivers. For some systems, X is shutdown by default in runlevel 3, so the command init 3 does it. Some distributions offer a script to only shutdown X but as there are lots of distributions there are also lots of scripts for those. If your display manager is gdm and you're using Debian, /etc/init.d/gdm stop will do. There are similar ways if you use kdm, xdm, etc. If you have no clue, you should ask your distribution's community.

Run nvidia-installer

Execute the installer with

Running the installer
sh /path/to/your/NVIDIA-Linux-x86-1.0-{VERSION}-pkg1.run

Make sure you changed the {VERSION} to the one you downloaded.

Step by Step

  1. After launching the installer there will popup a messagebox wanting you to accept the license printed in the background. Read the license carefully and click accept if you like otherwise the installer will quit. Image:small_box_nvidia_installer_step1.png
  2. If you have a driver already installed the installer asks whether to uninstall it. Image:small_box_nvidia_installer_step2.png
  3. Next the installer will ask you whether it should download a precompiled driver package from ftp.nvidia.com. You can choose both: Yes then No. Whatever you use the installer will (quite) surely need to compile it's own kernel interface.Image:small_box_nvidia_installer_step3.png
  4. Now the kernel module will be compiled. Image:small_box_nvidia_installer_step6.png
  5. After some time the compilation will be completed and the installer continues with the system installation... Image:small_box_nvidia_installer_step8.png
    ... and the linking of the libraries (this may take some time) Image:small_box_nvidia_installer_step10.png
  6. Finally the installer prints: Image:small_box_nvidia_installer_step11.png

Loading the kernel module

Now you have installed the drivers, but usually they're not loaded. To check whether the driver is loaded yet type

Command:
lsmod
Result:
Module                  Size  Used by
nvidia               3462172  12 

If it does not appear don't worry. You can easily load it via

Loading the nvidia interface
modprobe nvidia

This should work without problems. Nevertheless things can happen. If you receive an error look through the Troubleshoots.

Avoid kernel troubles

NVIDIA drivers being non-free, they are not handled as well as most modules are. If you change your kernel, your nvidia module won't adapt automatically, while you'll need to recompile. When you install the nvidia driver it compiles a "kernel interface" to the currently running kernel. When you update your kernel (or your distribution's update facility does it for you) the NVIDIA installation will need re-running otherwise X will not start after you reboot (to load the kernel) and will typically flash the text login screen several times whilst it tries to start. This can be annoying. You can manually recompile your module everytime this happens, or to make the process easier you can employ a init script to update the kernel interface of your NVIDIA driver on boot up after a kernel install. An example of such script is shown below:

 case "$1" in
   start)
     if [ -f /etc/nvidia-update ]
     then
       /path/to/your/NVIDIA-Linux-x86-1.0-{VERSION}-pkg1.run -s --uninstall #uninstall old driver
       /path/to/your/NVIDIA-Linux-x86-1.0-{VERSION}-pkg1.run -as #install new driver
       rm /etc/nvidia-update
     fi
     ;;
 esac
When you update your kernel simply touch the /etc/nvidia-update file and reboot (which you would have had to do any way to load the kernel). A refinement to this script would be to check if the nvidia module can be loaded and if not update the driver. Use the
/path/to/your/NVIDIA-Linux-x86-1.0-{VERSION}-pkg1.run --advanced-options
command to see all options of nvidia-installer. You can also use the
/path/to/your/NVIDIA-Linux-x86-1.0-{VERSION}-pkg1.run --update
command to install the latest driver available version from NVIDIA.

Setting up your system

We now configure the system to use the NVIDIA drivers and libraries correctly.

Autoload the drivers on startup

As already mentionned there are different way to succed. Same is valid here as different distributions offer different ways to autoload kernel modules.

As you might already know Linux distributions use runlevels to startup different servieces, such as network, CUPS (the print server), xdm (a display manager). If you look into your /etc/init.d/ folder you can see a list of all those available scripts. Some get launched on startup and some are optional. On most distributions there's one special initscript we want to use now. The name does differ a bit from system to system but in general it does contain words like: local and start. In this example it is called: local.start .

Linux platforms offer modprobe what can be used to load drivers (see #Loading the kernel module).

So we easily add this command to the end of the init script:

modprobe nvidia

As there are usually more scripts that are run during startup you only need to add this line to one of those scripts. You can even use the script to setup the sound to load the nvidia module.

Configuring the X server

Now the driver modules are loaded and will be loaded each startup. So the way is clear to configure the X server to use them and give 3D support. The main configuration file can be found in /etc/X11 . The filename depends on the X server used and sometimes the distribution. Generally they are:

XFree86 : /etc/X11/XF86Config
X.org : /etc/X11/xorg.conf

Open your config file in your preferred text editor. For example if you like vim (and use (X.org):

vim /etc/X11/xorg.conf

Now you can see the contents in different Sections. The ones important for now are:

Section "Module"

and

Section "Device"

Module Section

Your Module section should look like this:

Section "Module"
#      Load  "GLcore"
       Load  "glx"
#      Load  "dri"
       Load  "nvidia"
#      'There are certainly more modules booked here !'
EndSection

Note: Make sure you commented out the 'dri' module, because nvidia already offers this module.

Device Section

Now X loads the libraries and the driver into its memory, but we need more. It should also access the nvidia hardware. So search the Device Section in your configuration file and change:

Driver nv

to

Driver nvidia

The whole section should now look like this:

Section "Device"
       Identifier  "Here might come something ident name !"
       Driver      "nvidia"
#       Maybe coming more (optional) parts
EndSection

Test the 3D acceleration

After setting up all the important options your X server needs to be restarted.

If you use a graphical login, where you can enter you username and password directly after boot it is sufficent to quit your local windowmanager or hardkill X by pressing:

Ctrl + Alt + Backspace

You will return to the graphical login.

If you do not use graphical login managers, just quit your session and rerun it.

Once you restarted X there a NVIDIA logo will appear before your login manager. This indicates that the NVIDIA drivers are installed correctly and loaded by X.

Last but not least you can check your 3D acceleration by launching:

Command:
glxinfo | grep -i "direct rendering"
Result:
direct rendering: Yes

To see the 3D acceleration working smooth you can try

glxgears
Note  
If you launch it via terminal you will receive some framerates per second. They do not mean the speed of your GPU.
glxgears is not a benchmark and can not be used to compare machine speed.

Configure the drivers

NVidia:nvidia-settings will help you configure the NVIDIA drivers if you wish.

Links