Module-assistant and nVidia

From LSDevLinux
Jump to: navigation, search

The Problem

I've found it a big pain that Debian typically upgrades its kernels without upgrading commonly-used kernel modules at the same time. The result is that I have only a text login after the next reboot. Now I've found a relatively painless solution that works well every time.

A general upgrade through the package manager will install a new kernel automatically, even though I have kernel modules installed that are not being upgraded, and which won't work with the new kernel. The problem is usually with the nVidia kernel module, and the nVidia driver in the X server (Xorg) requires the kernel module in order to function, so the X server consistently gives up with an error, and gdm is disabled.

The Solution

The solution, I've found, is to use module-assistant to rebuild the module from source every time I have a kernel upgrade. The command is simple:

sudo module-assistant auto-install nvidia

This does all the work of downloading and installing the right linux-headers package, building the module as a package, and installing the resulting package. At this point, I can either reboot, or use modprobe to load the module and restart gdm.

You can also use abbreviations as follows:

sudo m-a a-i nvidia

Ideally, I want to use module-assistant before rebooting into the new kernel, because usually I don't notice that there's going to be a problem until after I reboot, which of course is often a long time after I did the upgrade. Running module-assistant under the old kernel requires you to specifiy the new kernel version as a parameter, like this:

sudo m-a a-i -l version nvidia

where version is the version of the new kernel you are installing. It is the same as appears at the end of the name of the linux-image- package, eg 2.6.18-4-vserver-686.

You may sometimes have to install the right linux-headers package manually, or you can leave the linux-headers-2.6-686 package installed which will ensure that you always have the latest linux-headers available. This is the counterpart of having the linux-image-2.6-686 package installed, which always depends on the latest kernel.

A nice benefit of using module-assistant is that the kernel module shows up in the list of installed packages, and doesn't cause problems when Debian finally comes up with their own package to match the latest kernel.

The Prerequisites

However, this does all depend on having suitable nvidia-glx and nvidia-kernel-source packages available. Unfortunately, Debian does not have a good track record of keeping these up-to-date in its testing release (currently, lenny). It's possible to use packages from unstable (sid), but often this brings its own set of problems, requiring you to update a lot of other packages from unstable, such as xserver-xorg. Even if this isn't true today, it may be tomorrow when unstable updates its packages and the ones you were using disappear.

On the other hand, once you do have nvidia-glx and nvidia-kernel-source packages that work with your system, you don't have to update them for a long time, because you can just keep building kernel modules with module-assistant. Attached here are copies of packages based on recent nVidia drivers that work with lenny and which can continue to be used for some time to come: