Installing NVIDIA drivers manually on FC4 (cumbersome way)

From FedoraNEWS.ORG

IMPORTANT This is not the best way of upgrading NVIDIA drivers manually. Please go check the updated version.


Written by Andre Costa on 2005-12-25

Installing NVIDIA Linux driver (http://www.nvidia.com/object/unix.html) when a new driver or kernel version comes out can be a somewhat complicated task (been there, done that...), and it's common to see lots of questions about it on Fedora forums.

livna.org (http://rpm.livna.org/livna-switcher.html) provides RPMs for NVIDIA drivers, which should allow a painless installation in most cases. However, if you use apt-get (https://moin.conectiva.com.br/AptRpm) or yum (http://linux.duke.edu/yum) for package management, you might want/need to avoid livna.org for a couple of reasons (http://dag.wieers.com/home-made/apt/FAQ.php#D1), depending on your repositories configuration.

So, if for any reason you find yourself in need to tackle with NVIDIA driver installation with your bare hands, hopefully this mini-HOWTO will help you down the road.

DISCLAIMER: I don't claim this to be neither the correct nor the best way of doing this, they're the result of my personal efforts to deal with these upgrades (and, yes, I eat my own dog food ;-)). If you have any corrections/suggestions, please send them to me (mailto:blueser@gmail.com). Also, please note that X11 driver problems could lead to lockups or text-only boot. Please follow instructions below at your own risk. However, instructions do not involve anything much different than a "standard" installation, so chances are that if you face any problems you would face them anyway.

Table of contents

Basic Steps

Whether you're upgrading kernel or driver (or both), you will need to have kernel sources installed. This happens because NVIDIA driver comes with precompiled kernel interfaces, and most likely in your case your kernel will not be among the available options. So, grab your kernel .src.rpm from official Fedora upgrade site (http://download.fedora.redhat.com/pub/fedora/linux/core/updates/4/SRPMS/). Also, if you don't have it yet, donwload NVIDIA driver from NVIDIA site (http://www.nvidia.com/object/unix.html).

Kernel Configuration

First off, let's install kernel sources and prepare compilation. I'll assume for the rest of this document that we will be using kernel-2.6.14-1.1653_FC4.src.rpm (http://download.fedora.redhat.com/pub/fedora/linux/core/updates/4/SRPMS/kernel-2.6.14-1.1653_FC4.src.rpm) and NVIDIA-Linux-x86-1.0-8178-pkg1.run (http://download.nvidia.com/XFree86/Linux-x86/1.0-8178/NVIDIA-Linux-x86-1.0-8178-pkg1.run), which are the latest versions available as of this writing.

image:idea.png Before we proceed, a word of caution: it is not a good idea to build RPMS as root. In order to avoid this, you should follow a few simples steps involving ~/.rpmmacros file. Some guidance can be found here (http://freshrpms.net/docs/fight/).

Installation can be done with:

rpm -ivh kernel-2.6.14-1.1653_FC4.src.rpm

This will install all source files on [topdir]/SOURCES and spec file on [topdir]/SPECS. ([topdir] corresponds to what you've assigned to %_topdir setting on ~/.rpmmacros)

Sources Preparation

With sources in place, go to [topdir]/SPECS and run

rpmbuild -bp kernel-2.6.spec

image:idea.png You might need to specify the arch to be used, such as in rpmbuild --target i686 -bp kernel-2.6.spec

This will prepare a build environment on [topdir]/BUILD, extracting source files and applying all patches. It will not compile the kernel (you don't need to do it).

Next, there's still some additional preparation that needs to be done:

cd [topdir]/BUILD/kernel-2.6.14/linux-2.6.14/
make prepare
make scripts

image:idea.png make prepare and make scripts steps can change from one kernel version to another (this happened from 2.6.13 to 2.6.14).

Now we're ready for NVIDIA driver compilation.

NVIDIA driver compilation

In order to compile the driver kernel interface, go to the directory where you copied NVIDIA-Linux-x86-1.0-8178-pkg1.run file, and run as root:

./NVIDIA-Linux-x86-1.0-8178-pkg1.run -a -q --add-this-kernel \
   --kernel-source-path=[topdir]/BUILD/kernel-2.6.14/linux-2.6.14/

NOTE: the "\" is not necessary, it has just been used here for formatting purposes.

image:idea.png For a list of NVIDIA installer's command-line parameters, you can run ./NVIDIA-Linux-x86-1.0-8178-pkg1.run -A.

After this, a NVIDIA-Linux-x86-1.0-8178-pkg1-custom.run file will have been created on the same directory as the original file. This file will have the precompiled interface for your kernel.

Driver Upgrade

In order to actually upgrade the driver, X11 needs to be shutdown. You can do this a couple of different ways, I will just suggest one here, use the one you feel more comfortable with.

I usually follow these steps:

  • go to first text console with CTRL+F1
  • switch to runlevel 2 with command init 2 (as root)

Now, all is set for the upgrade itself. Just run (as root):

./NVIDIA-Linux-x86-1.0-8178-pkg1-custom.run -a -q -n \
  --kernel-source-path=[topdir]/BUILD/kernel-2.6.14/linux-2.6.14/

This will uninstall any previous version and install the new one. Assuming you're simply upgrading from another NVIDIA driver version (which means your X11 configuration is correct), you can test the new driver with:

startx

If all goes well, your desktop will appear as it was supposed to do (login screen is skipped). Just logout from this session, and go back to runlevel 5 with

init 5 ; logout

X11 Configuration

X11 configuration is beyond of the scope of this document. Please consult /usr/share/doc/NVIDIA_GLX-1.0/README.txt for additional information.

[UNTESTED] Alternatively, you can try a new feature introduced with driver v8178, which asks NVIDIA installer to configure X11 for you. Just add -X parameter to upgrade command-line as in:

./NVIDIA-Linux-x86-1.0-8178-pkg1-custom.run -a -q -n -X \
  --kernel-source-path=[topdir]/BUILD/kernel-2.6.14/linux-2.6.14/

However, as I said earlier, you shouldn't need to tweak X11 settings on /etc/X11/xorg.conf if you're upgrading from a previously configured NVIDIA installation.

Final Words

I hope this mini-HOWTO has been helpful. Let me know (mailto:blueser@gmail.com) if you believe I could improve this in any way, or if there is any incorrect information listed here.

Personal tools