Wednesday, August 5, 2009

NVIDIA on Debian Lenny

When I first installed Debian, the screen was stretched horizontally due to a bad resolution setting. I fixed this by installing NVIDIA's drivers from their website.

Go to www.nvidia.com/page/drivers.html

Choose your card, and the page should recognize the OS you're running. In my case, "Linux 64-bit"

After you download the driver, you have to restart the computer and choose "single-user" mode at the GRUB boot loader. This will bring you to the shell, without loading x-windows.

To run the installer, go to the directory you downloaded it to and type:

sh NVIDIA-Linux-x86_64-185.18.31-pkg2.run

This installer will look for precompiled drivers on your computer and on NVIDIA's ftp. Most likely it won't find them. Then it will attempt to compile the drivers on your computer. You will need a few additional packages installed for this.

Here are the commands to install the necessary pacakges:

apt-get install binutils
apt-get install gcc
apt-get install make
apt-get install linux-source-2.6.26
apt-get install linux-headers-2.6.26-2-amd64

For the last two make sure you are choosing the correct versions. You need to get the same version as the kernel you are currently running. To see the version of your kernel type:

uname -a

Finally, you can run the installer:

sh NVIDIA-Linux-x86_64-185.18.31-pkg2.run

Oops, not done yet. You will probably get a message saying that gcc is not the correct version. (I did.) You need to have the same version that was used to compile your kernel. In my case it told me that my kernel was compiled with gcc version 4.1 (and I had just installed version 4.3 of gcc.) Not to worry; Install the older version then redirect the environment variable "cc" to this older version with the following commands:

apt-get install gcc-4.1
export cc=gcc-4.1

Finally you should be all set to run the installer without any issues. It should compile the drivers and set up X-windows correctly. You know it worked when you reboot and see the NVIDIA logo just before the login screen.

No comments:

Post a Comment