Thursday, 6 December 2012

NVIDIA Driver on Debian Squeeze

I usually avoid proprietary graphics card. But last time my vendor gave me the nvidia graphics card GeForce 9600 GT. The desktop runs Debian on a Intel core i7 processor.

I got the graphics card working using the free drivers nv and later nouveau. I was fine with it because I don't use my PC for gaming. But the fan used to run in full speed creating constant noise in my office room. I had to, at least, fix the sound pollution. I didn't want to fiddle with fan speed by other means. I felt that nvidia driver might  fix the issue and decided to use non-free driver the Debian way. This blog is on what I did to get my fan speed under control.

I use the current stable version of Debian, Squeeze, with pre-built kernel 2.6.32. To find which graphics card you use:
$ lspci | grep VGA

For any other graphics card follow the instructions in the page http://wiki.debian.org/NvidiaGraphicsDrivers.  My graphics card was bought in 2010 and falls under the 173xx legacy driver series. To find out which Debian version package you should use for your driver, use the script here.

As the first step, make sure to include non-free and contrib,  in addition to main, in your repository file /etc/apt/sources.list. For example, add the line

deb <your-repository-domain> squeeze main non-free contrib

in your /etc/apt/sources.list. Now install the packages module-assistant and nvidia-kernel-common.

# apt-get install module-assistant nvidia-kernel-common

We now build and install the nvidia kernel module by running the command

# m-a auto-install nvidia-kernel-legacy-173xx-source 
 
Time to install the X driver and libraries package.
 
# apt-get install nvidia-glx-legacy-173xx
 
I did not have a /etc/X11/xorg.conf, so I created one. If you already have one just edit the relevant sections in that file. A good practice is to make a backup of the file before you edit an existing one. Thus, I created the file
/etc/X11/xorg.conf with following entries:

Section "Module"
    Load        "glx"
EndSection

Section "Device"
    Identifier  "Video Card"
    Driver              "nvidia"
EndSection

We are done! Since I don't use a display manager (viz. gdm, kdm, xdm), I closed my session to come back to console and tried starting X again. Oh! It didn't work. X didn't start. This was because nouveau module was loaded
 $ lsmod | grep nouveau

The command   

# rmmod nouveau

did not work  because the console was using it.  Of course, I had to blacklist nouveau in the file /etc/modprobe.d/blacklist.conf with the entry "blacklist nouveau". But I had to leave home because it was late, so I shutdown my PC and left for home thinking to continue next morning. A start-up next morning did not load nouveau and my X worked on the new driver. The moment X started, my PC was noiseless. Now, I live in a peaceful office!