Installing nvidia driver
     media: 0.00 din 0 voturi

postat de firefly in 2006-10-09 19:13
Here are the instructions for building and installing your nVidia drivers, the Debian way.
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 user libraries and kernel module source only have to be installed once. Then the kernel module has to be rebuilt every time you rebuild or change your kernel. So, here's what you will do:
Build and install the kernel module.
Install the user-space libraries.
Update your configuration.

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

Steps 2 and 3 have to be performed only once. Step 1 you have to repeat 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.
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 don't know what kind of kernel you're running, then it's probably a stock kernel. But to find out, run

apt-cache policy kernel-image-$(uname -r)
and look at the source lines for the version that's listed as installed. If the source lines include something at, then you're running a stock kernel. If no version is listed as installed, then you're running a custom kernel. If a version is installed, but the only source listed for the installed version is /var/lib/dpkg/status, then you may be running a custom kernel, or a stock kernel that's old enough to have dropped out of the Debian distribution. The easiest way to tell is just to look at the kernel version number (output of uname -r): if it looks like e.g. 2.4.x-1-k7 or 2.6.x-1-686, then it's probably an old stock kernel.
Choose a Distribution
Before you install the Debian nVidia packages, you should choose a distribution, either 'testing' or 'unstable', from which to install them. There is no 'stable' version of these packages at present. You can run 'apt-cache policy nvidia-kernel-source' to see which versions of the driver are available in each distribution.

Once you've chosen a distribution, put its value into a shell variable NVDIST, by executing one of the following lines:

I will use $NVDIST to represent this value in all of the commands below. Also, make sure that your /etc/apt/sources.list contains a line like 'deb $NVDIST main contrib non-free', for your $NVDIST. (Help yourself to a copy of my sources.list if you like.) And if you've just modified /etc/apt/sources.list, you need to run 'apt-get update' before continuing below.
Installation Instructions
Build and install the kernel module.

There are four different procedures that you can use to install the kernel module. If that sounds like a lot, don't worry—I've listed the easiest methods first. So start with the first one, and if it doesn't work for you, go on down the list. Click on the title of each method to see the instructions.
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:

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.

module-assistant automates the more detailed procedures described below: it downloads the nvidia kernel module source, builds a kernel module package compatible with your (stock or custom) kernel, and installs the package. (If you're interested, the package file is /usr/src/nvidia-kernel-*.deb, and you can see that it's installed by running apt-cache policy nvidia-kernel-$(uname -r).) Of course module-assistant has many other operations and options; see the module-assistant man page for details.

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. (Thanks to Josep Ma Antolin for this tip.)
Install a pre-built module. This method is easy if you're running a recent stock kernel; will take a little more work and may fail if you're running an older stock kernel; and will not work at all if you're running a custom kernel.

Find out if there's a prebuilt module available for your kernel. The official Debian mirrors include prebuilt modules for just a few stock kernels, but Randall Donald maintains unofficial prebuilt modules for many other old and current stock kernels. To get access to Randall's repository, add

deb modules-unstable/i386/
into your /etc/apt/sources.list. Now run

apt-get update
apt-cache policy nvidia-kernel-$(uname -r)
and look for a source line somewhere at If there is one, then proceed to step (b). If you don't find one, then there's no prebuilt module for your kernel, so this installation method won't work for you; you should go ahead and try a different installation method.
Find out if there are nvidia-glx and nvidia-kernel-common packages compatible with your nvidia-kernel-* package: run

apt-cache policy nvidia-kernel-$(uname -r) nvidia-glx nvidia-kernel-common
and look for versions of all three packages with compatible version numbers (identical up to the first - or +). If you find them, you're in luck; proceed to step (c).

If you don't find compatible versions of all three nvidia-* packages, then you may still be able to find some on search there for nvidia, add the lines it tells you about to your /etc/apt/sources.list, run apt-get update, and repeat this step.

If after trying the above you still can't find compatible versions of the three nvidia-* packages, then sorry, but this installation method will not work for you. You should go another method. As a rule, nvidia-kernel-* packages are only available in the versions of the nvidia driver that were current at the same time as the kernels they were built for; while nvidia-glx is generally only available in the latest one or two versions. For example, at this writing nvidia-kernel-2.6.3-1-386 is only available in version 1.0.5336, while nvidia-glx is only available in version 1.0.7174. Those versions are incompatible, so if your kernel is a stock 2.6.3, then you have to either upgrade it or choose a different installation method for the nVidia drivers.
If you found compatible nvidia-* packages in steps (a) and (b), then install them now:

apt-get -t $NVDIST install nvidia-kernel-common nvidia-kernel-$(uname -r)
(you'll install nvidia-glx below). You may have to adjust $NVDIST here, depending on where you found compatible versions of the nVidia packages in step (b), above. Sorry, but the possible permutations are too numerous to list here. 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 want or need to build your own nVidia kernel module or other add-on kernel modules.

(The following procedure is adapted from the instructions in /usr/share/doc/nvidia-kernel-source/README.Debian.)
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.
Install the kernel module source: run

apt-get -t $NVDIST 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.
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).
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.
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.
Install the kernel module source: run

apt-get -t $NVDIST 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.
Configure your kernel. I won't try to document this step here; if you need to learn how, see the Kernel HOWTO and "How to Upgrade to the 2.6 Kernel". But in summary, all 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 drivers:
Graphics Support –> nVidia Riva support (FB_RIVA)
Kernel Hacking –> Use 4Kb for kernel stacks instead of 8Kb (4KSTACKS)
Processor Type and Features –> Local APIC support on uniprocessors (X86_UP_APIC) (not available if you have an SMP kernel, including hyperthreading)
I therefore recommend 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.
Build the kernel and 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-image-*.deb and nvidia-kernel-*.deb, both in /usr/src. 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.

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 following commands appropriately.
Install the new kernel and kernel module:

cd /usr/src
dpkg -i kernel-image-*.deb 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 that I rendered as * above.
Install the nVidia user-space libraries. Run

apt-get -t $NVDIST install nvidia-glx
If you're asked whether you want to install the thread-local storage libraries, say yes. Notes:
If the kernel you installed above is version 2.6.x, and the one you're running now is pre-2.6, then you should reboot with your new kernel before performing this step. The reason is that if you're not running a 2.6-series kernel when you perform this step, the thread-local storage part of the user-space libraries will not be installed. As a result your X server will crash when it tries to load the nVidia driver. If you already installed nvidia-glx earlier under a pre-2.6 kernel, then reboot to the new kernel, run dpkg-reconfigure nvidia-glx, and answer yes when asked if you want to install the TLS libraries.
The reason this step has to come after step 1 is that nvidia-glx depends on a virtual package called 'nvidia-kernel-$NVVERSION', where $NVVERSION is the version number of the nVidia driver you've installed. This virtual package is provided by the kernel module package that you installed in step 1; so you have to complete that step first.
Update your configuration.
Update /etc/X11/XF86Config-4. Naturally, there is both a Debian way and an old-fashioned way of doing this. Click on a method title to see the instructions.

The Debian way. This method avoids many common configuration errors, because you don't write an XF86Config-4 file yourself. Instead you answer a series of questions about your mouse, keyboard, and video hardware, and then the configuration script writes an XF86Config-4 file for you.

Save yourself some possible grief later, by backing up your current XF86Config-4:

cp -p /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.bak
Tell Debian that XF86Config-4 has never been edited:

md5sum /etc/X11/XF86Config-4 >| /var/lib/xfree86/XF86Config-4.md5sum
If you don't perform this step, and you have ever edited XF86Config-4, then dpkg-reconfigure will lead you through its whole questionnaire below, and then silently fail to write a new XF86Config-4. This is Debian bug #223929.

dpkg-reconfigure xserver-xfree86
and answer all of the questions.
When asked to choose an X server driver, choose "nvidia". An open-source alternative is the "nv" driver, which has 2D but no 3D capabilities.
When asked to select X server modules, deselect (uncheck) GLCore and dri, and select (check) glx.

When you're done, ls -l /etc/X11/XF86Config-4 to be sure your new XF86Config-4 file has been written. Thanks to Dave Page for informing me about this method.
The manual way. This method is simpler, and it will preserve any customizations you've made to XF86Config-4. Just watch out for typos, and check /var/log/XFree86.0.log if you've recently edited XF86Config-4 and things go wrong.

Edit /etc/X11/XF86Config-4:
In the "Module" section, be sure that you have 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, be sure you have a line

Driver "nvidia"
An open-source alternative is the "nv" driver, which has 2D but no 3D capabilities.
Create a "video" group, and add to it any users who you want to be able to use the display. You can do this manually by editing /etc/group, or the Debian way by

addgroup --system video
adduser $USER video
for each $USER you want to add to the group.
Ensure that the nvidia module gets inserted into your kernel automatically at boot, by adding it to /etc/modules if it's not already there:

grep -q ^nvidia /etc/modules || echo nvidia >> /etc/modules

That's it. Your binary driver and kernel interface module are now installed and configured, and should work when you reboot with the new kernel and/or restart your X server.
Of course the nvidia module will have to be loaded into your kernel to work. If you've just installed the driver and don't need to reboot, then load the driver manually with modprobe nvidia or modconf before restarting your X server.
For more information about the nVidia driver, see:
These files have loads of information about options and troubleshooting for the nVidia driver. 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 "NoLogo").
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.
As I said above, you won't ever have to repeat steps 2 and 3 above, as long as you don't reverse them, of course.
On the other hand, the kernel module that you built in step 1 is specific to the kernel you built it with. If you install a new kernel that's different in any way from the old one, you'll have to install a new driver module to go with it. In that case just go back and repeat step 1.
Using this method, you don't need any of the following things:
The official nVidia installer from The Debian packages contain all of the parts of it that you need.
Any of the patch or installer files available at (But thanks to the folks at for providing those patches, during all of the time when the official nVidia drivers didn't work yet with kernel 2.6.)
The nvidia-kernel-src and nvidia-glx-src packages, which are deprecated. You can also ignore the nvidia-glx-dev package, unless you get complaints from some software (old games?) about missing (thanks to Randall Donald for this information).
You can ignore the warning at about carrying along the EXTRAVERSION information if you use --append-to-version with make-kpkg. Because you're using make-kpkg all the way through the build process, it takes care of this for you.


  1. firefly

    Mai simplu:

    HOWTO install Nvidia drivers on Debian Testing
    (in 10 easy steps):

    This guide assumes you can't be bothered/don't want to customise your kernel, and are happy with the stock kernel images in debian. You will need to do all this as root.

    Get the latest kernel image using apt. For me this was 2.6.7-1-k7, so
    apt-get install kernel-image-2.6.7-1-k7

    To check what the latest kernel-image is, do apt-cache search kernel-image and look for the latest one for your architechture (for me it was k7 (AMD Athlon), a Pentium4 would be 686)

    This will also prompt you to install the new kernel in LILO (or grub). Do so.
    Get the kernel headers for the kernel you just downloaded:
    apt-get install kernel-headers-2.6.7-1-k7
    these will be put in /usr/src

    Reboot your computer. When you start again, uname -a should tell give you the version number of the kernel you just installed.

    Install the nvidia kernel source package
    apt-get install nvidia-kernel-source

    Set a few environment variables:
    export KSRC=/usr/src/kernel-headers-2.6.7-1-k7
    export KVERS=2.6.7-1-k7
    (replace 2.6.7-1-k7 with the version of the kernel you just installed)

    Make an Nvidia-kernel package:
    cd /usr/scr/modules/nvidia-kernel
    debian/rules binary_modules

    Install nvidia-kernel-common (if not already installed)
    apt-get install nvidia-kernel-common

    Install the nvidia kernel package:
    cd /usr/src/modules
    dpkg -i nvidia-kernel-2.6.7-1-k7_1.0.6111-1_i386.deb
    (or similar filename)

    Install nvidia-glx
    apt-get install nvidia-glx

    Edit your /etc/X11/XF86Config-4 file:
    comment out the following lines (put a # in front of them):
    Load "GLcore"
    Load "dri"
    make sure the following line is there (and NOT commented out)
    Load "glx"
    look for the line that says:
    Driver "nv"
    and change it to:
    Driver "nvidia" and exit your editor. You should be done, now press ctrl+alt+backspace to restart X. Pray, and hopefully this should work. :-)

Comentariile sunt interzise la blogurile neactualizate mai mult de 90 de zile

Termeni si Conditii de Utilizare