Nvidia driver (when changing kernels)

What do I need to do to minimize the complexity of reinstalling the nvidia driver when switching between kernels?

I recently started using Debian (kernel version 2.6.18)
It wasn't compatible with my nvidia card and I couldn't find any Debian package to make it compatible (If you have any good suggestions for that, please tell me).

After much effort I found the driver from nvidia.com that works (their driver version 71.86.01)
http://www.nvidia.com/object/linux_display_x86_71.86.01.html

Its installer needs to recompile using kernel sources. I don't know what file(s) it puts where as a result of recompiling (I'm a Linux newbie). What files it puts where may be the key to the whole issue of this post.

Later I discovered that the default kernel didn't support all the ram on my system (tyan motherboard, AMD Athlon 1800+ CPU, 3GB RAM). I installed the package for k7 image for the same (2.6.18) version of the kernel, which supports the ram correctly. (BTW, was that the best choice for the Athlon 1800+)?

I didn't install any different kernel source, but after rebooting with that kernel, the nvidia card again didn't work. I reran the nvidia installer, which said it was first deinstalling the nvidia driver it had compiled earlier, then it recompiled and the nvidia card worked again.

So now I can choose between two different kernel builds from GRUB (the default one and the k7 one), but the nvidia card only works with the k7 kernel (just as before I reinstalled it, it had only worked with the default kernel).

I probably have no future use for the non-k7 kernel image. I can just deinstall it (as soon as I figure out how). But I expect future occasions on which I change build or version of the kernel won't go as smoothly. I expect to want to switch back and forth between two kernels while working out other details. Do I need to completely reinstall the nvidia driver every time I boot with a different kernel (even if it isn't the first boot of that kernel)?

Is there a way to save whatever nvidia file(s) are needed for a specific kernel so they can be used with that kernel when I reboot that kernel after rerunning the nvidia installer for a different kernel?

Also, any clue why the nvidia driver even cares about the change to "k7"? I didn't update any kernel source when switching to the k7 image, so I don't understand where it found any information to tell it to compile differently when I reinstalled it.

0

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Nvidia driver (when changing

I don't have any useful advice, other than just stick with the kernel that works the best so that you don't have to keep reinstalling the Nvidia driver. I fear that this is just the price of using a binary driver that does not ship with the kernel.

Re: Nvidia driver (when changing kernels)

OK I know that you posted a while ago but I just worked this out and I thought it might be useful to someone.

First thing! DON'T use the install script from Nvidia.

It builds a module specific to one kernel but then it puts it in a directory general to all kernels (I can't remember which one). It should go in a sub directory of /lib/modules/[kernel_version]/ (Where [kernel_version] is the version number of the kernel that you have compiled the driver for). That way when you compile a driver for a different kernel you don't have to erase the first one because you put the new one in its own /lib/modules/[kernel_version]/ directory.

Also the installer script can change shared libraries. Not too bad in itself but it doesn't tell the Debian packaging system about it. Now the packaging system thinks all your packages are neatly installed with all their dependencies met but it ain't necessarily so. On my system this led to things breaking horribly, whilst I had no idea what was wrong. You may get away with it but my advice would be that, if you have used the Nvidia installer, you should do a reinstall to get everything back in order before you fix up your drivers.

Some useful info is here http://www.xs4all.nl/~carlo17/howto/nvidia.html
(but the nvidia package has been put back in etch)

OK so now to putting things right.

Nvidia publish the source for their driver so Debian have packaged it. It is not freely licenced so it is placed in the non-free sections on the Debian servers. To install packages in this section your /etc/apt/sources.list should have lines that reference the non_free section. Here are the lines from my file.

deb http://ftp.uk.debian.org/debian/ etch main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ etch main contrib non-free

Yours may point to a different server but they must have non-free in there.
Update your package lists.

#apt-get update

You have a linux-image-[version-no] package installed so, to install the right driver for it in the right place, install the nvidia-kernel-[version-no] package.

#apt-get install nvidia-kernel-[version-no]

Very important that the [version-no] bits match on both packages.
You can do this for as many kernels as you care to run.
You also need to install the packages shared by all kernel versions. nvidia-kernel-common & nvidia-glx

#apt-get install nvidia-kernel-common nvidia-glx

Of course it is probably easier to do all that with your favourite package manager program, so that you can see what your choices are.

That should get your pre packaged kernels working but for roll your own kernels there is a little more work to do.
Download or install your kernel sources. Patch and configure in the usual way. Build in the Debian way

$make-kpkg clean
$fakeroot make-kpkg --revision=xxxxxxx kernel_image

These commands are included in the kernel-package package.
See the Kernel Handbook for the details http://kernel-handbook.alioth.debian.org/
particularly http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s-common-building

Now install the nvidia-kernel-source package.

#apt-get install nvidia-kernel-source

You can now read /usr/share/doc/nvidia-kernel-source/README.Debian

Unpack the tar file

$cd /usr/src
$tar -xvzf nvidia-kernel-source.tar.gz

return to your linux source directory

$cd /usr/src/linux

Build the modules

#make-kpkg modules_image

You should now have a linux-image-[custom-version-no].deb
and a nvidia-kernel-[custom-version-no].deb
in /usr/src

Install them

$cd /usr/src
#dpkg -i linux-image-[custom-version-no].deb
#dpkg -i nvidia-kernel-[custom-version-no].deb

Grub should pick all this up automatically and you should now be able to boot into your working custom kernel (assuming you got it right at the configuration stage).
This method keeps your package management system in sync with what is actually on your system.

Good luck
Regards, Rob

Syndicate content