Fri 21 Dec 2007
5:00PM
compton

Installing Proprietary nVidia Drivers on Ubuntu Linux

This article refers to Ubuntu Gutsy Gibbon (7.10, 32-bit), but the upgrade to Hardy Heron (8.4) also messed up my screen resolutions, as I expected it would. At least this time I was prepared, and I was relieved that the script here works just as well with Hardy. It also appears to work on Debian - at least, it worked great for me on Debian amd64.

I had had a load of problems getting the default restricted drivers running when I upgraded to Gutsy, and at the time I'd tried the drivers from nvidia and found it an uphill struggle. During the process I realised that the default option in my Grub boot menu was causing Ubuntu to run with the older Feisty 2.6.20.16 kernel. Once I corrected that, I was able to switch on the restricted drivers (via System > Administration > Restricted Drivers) and enable compiz fusion with no further problems.

Since then Gutsy had been running great, with compiz silky smooth with max effects. World of Warcraft also runs fine, as does steam:- Team Fortress 2 and CS:Source are very smooth and completely playable under Wine.

Feeling adventurous, last night I decided to have another go at using Nvidia's latest drivers from the web (or ftp if you prefer). I was about to go to bed, tired and I knew it would've been a whole lot better to wait until a more suitable time, but I went ahead anyway in the hope everything would go smoothly.

It didn't.

I'd followed the instructions in the readme, but when I restarted the machine, I got the so-called 'bullet-proof' X that was introduced in Gutsy for when X cannot start normally. A sort of safe mode which loads the VESA driver, and annoys the pants off me.

This morning I managed to fix the problem, and decided to put the info here for future reference. Once you've downloaded the Linux installer from nvidia's web site, create the following script in the same location:
sudo apt-get install linux-headers-`uname -r` build-essential gcc gcc-3.4 xserver-xorg-dev sudo apt-get --purge remove nvidia-glx nvidia-settings nvidia-kernel-common sudo rm /etc/init.d/nvidia-* sudo /etc/init.d/gdm stop sudo sh NVIDIA-* sudo nvidia-xconfig --add-argb-glx-visuals sudo /etc/init.d/gdm start
It does pretty much everything you need in order to install the proprietary nvidia driver. It checks you have the required development tools (like make and gcc) installed, along with the Linux header files for the Linux kernel. Most of this is already present on a default Ubuntu install, but any that aren't will be downloaded for you.

It's also important to remove the Open Source nvidia drivers, which is what the second and third lines of the script do.

The next line shuts down the Gnome display manager ready for the installation of the graphics driver files, which is initiated by calling the nvidia installer on line 5.

(Note that this fifth line (3rd from last) won't work if you have more than one version of the nvidia driver package in the same location: if you do, you'll need to specify the exact filename in place of the *)

Save the script with a short easy-to-remember name such as instnv, make it executable by right-clicking it in nautilus, choosing Properties > Permissions, and placing a tick by Allow executing file as program.

Switch to a TTY console login by pressing ctrl-alt-F1, navigate to the directory with the install files, and run the script.

In my case at least, the installation went swimmingly with this script, and automatically compiled and installed the driver as a new kernel module.

You'll know if the new drivers are installed correctly because you'll see the nvidia logo as Ubuntu starts up.

/xkcd/ Linear Sort