How to configure Nvidia graphics card in Debian

I got most of this information from the Debian wiki but it is a little complicated, so here’s a summary of the way it worked for me. This method involves a re-build of the kernel, but it’s not as scary as it sounds.

Firstly modify /etc/apt/sources.list so that the Debian source is the ‘main contrib non-free’ one. This is because the nvidia driver is not open source. The line probably looks like this:

deb etch main contrib non-free

Make a note of the architecture you’re currently running. This way when you get upgrades you’ll know whether the kernel will need to be re-built.

uname -r

Mine is currently at 2.6.18-6-amd64.

Ensure the necessary applications are installed.

sudo apt-get install module-assistant gcc nvidia-kernel-common nvidia-glx

Now to re-build the kernal using module-assistant. Each of these commands may take a while to run:

sudo m-a update
sudo m-a prepare
sudo m-a auto-install nvidia

There! Wasn’t so hard, was it! ;) These three steps will be needed whenever there is a new build of Linux headers.

Now there is a little bit of configuration to do, so firstly backup the xorg.conf file to have something to restore if it all goes horribly wrong.

cd /etc/X11
sudo cp -p xorg.conf xorg.conf.backup

I find it easiest to run the auto-configure tool rather than changing the xorg.conf file by hand. Be aware this will overwrite xorg.conf, losing any changes you may have made. Just double-check that the backup is there.

sudo dpkg-reconfigure xserver-xorg

This brings up a series of dialogs to change settings. Most of them can simply be left as default unless there are specific changes you want to make. For example, i set the resolution to 1440 x 900.

Here are some specific things you do need to ensure are set correctly:

X server driver: make sure ‘nvidia’ is chosen, not ‘nv’.
X server modules: unselect ‘GLCore’ and ‘dri’. Select ‘glx’.

Now we need to ensure that Nvidia runs at boot time. It’s as simple as adding ‘nvidia’ to /etc/modules. This line will add it, if it’s not already there:

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

Load the nvidia module:

sudo modprobe nvidia

Note to self: if you have just reinstalled Debian, do remember to take the DVD out before rebooting!

Now reboot.

Any problems … check the wiki!

As i mentioned above, whenever a new build of Linux comes through, it normally tells you “You need to reboot soon”. Take this as a hint that you may also need to re-build the kernel to accept nvidia again. It’s just these three lines:

sudo m-a update
sudo m-a prepare
sudo m-a auto-install nvidia

One comment on “How to configure Nvidia graphics card in Debian

  1. Pingback: A little place of calm » Blog Archive » How to install Beryl/Emerald on Debian

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s