
I recently bought an Nvidia 8800 GTX card, but had just a bit of trouble getting it to compile, install, and run under Linux.
I’ve written this tutorial to make it a piece of cake for whoever else may try.
Here are the steps:
1. Download the driver that supports your card.
2. Update your kernel
3. Install the kernel-devel package corresponding to your kernel
4. Install the pkgconfig and xorg-x11-server-sdk packages
5. Prepare your system for trouble
6. Install the driver
7. Setup your X server configuration.
8. Troubleshooting
Note for almost all of these instructions, you will need to be logged in as root. Whenever I tell you to run a command, I mean to open a terminal window, type it in, and press enter.
1. Downloading the driver
It turns out this isn’t as simple as I would have thought. At the time of this writing, the linux driver available at the nvidia site ( 1.0-9629) doesn’t yet support the 8800. Instead, I had to download the driver from the beta site: http://www.nzone.com/object/nzone_downloads_rel70betadriver.html
If you are running a 32 bit kernel, you can download the x86 drivers, for example: NVIDIA-Linux-x86-1.0-9742-pkg1.run
For the 64 bit kernel, you would use AMD64/EM64T drivers, for example: NVIDIA-Linux-x86_64-1.0-9742-pkg2.run
Of course, you should check the site yourself to see if there have been any updates. The links above were provided only for convenience.
2. Update your kernel
Your kernel is the version of linux currently running.
In Fedora, the easiest way to update your kernel is with the command: yum update -y
This will just update everything on your system; it is a good idea to run this command every once in awhile anyway. yum is the name of the updater program. Update tells it what to do (install is another option you will see). The -y option tells it to go ahead and download and install the packages once it figures out what to update (otherwise, it will ask y/n before it does anything).
If you are in a bit of a hurry, and ONLY want to update your kernel, you can instead run: yup upgrade kernel -y
Whichever method you choose, if an update occurs, you should reboot.
3. Installing the kernel-devel package corresponding to your kernel: This part can be a bit tricky as well. You need the kernel-devel package corresponding to the kernel you are actually running. This means:
a) The version number must match
b) If you are running an SMP kernel (do you have a dual core machine? hyperthreading?) you must get the SMP devel package
c) If you are running the x64 kernel, you must get the x64 devel package.
First, run the command: uname -r
This will tell you what kernel you are running. Look for the version, smp, or x64 tags to determine what kernel you need. Here’s an example:
2.6.18-1.2239.fc5smp.x86_64
Here we see the kernel version (2.6.18-1.2239) followed by the Fedora Core version (fc5) followed by the smp tag, followed by the x64 identifier.
Another example:
2.6.18-1.2239.fc5
This shows the same kernel, but 32 bit and no smp
Now, we will see what kernel-devel package you have installed on your system. Run the command: rpm -qa | grep kernel
rpm is the package manager program. The -q option tells it to perform a query, the -a option tells it to list all packages.
The “|” command is a pipe; it redirects the output of one program to another. grep is a program that can parse input, and only output lines which match it’s criteria. kernel simply tells grep what text it is looking for. Overall, this command will list any install packages with the word kernel in their title.
At this point, you should at the very least see one kernel package, like:
kernel-smp-2.6.15-1.2054_FC5
more than likely, you will see a second kernel package (the one you are currently running since you updated), like
kernel-smp-2.6.18-1.2239.fc5
you also need to look for any kernel-devel packages. If you haven’t installed them, you may not see any. If, however, you see something like:
kernel-devel-2.6.18-1.2239.fc5
it means you already have a kernel-devel package (not necessarily the correct one) installed. For example, the kernel-devel package above doesn’t match the kernel immediately above it: the kernel is smp, the kernel-devel isn’t. Instead, in this example, you would be looking for the kernel-devel package:
kernel-smp-devel-2.6.18-1.2239.fc5
If one of the kernel-devel packages listed above match with the kernel you get from uname-r, you are good to go.
If you don’t have any kernel-devel packages , you can run: yum install kernel-devel
Depending on your version of fedora, it may automatically choose the correct kernel-devel package. You can see what it chooses, and decided to choose y or n depending on if it gets it right or not.
If you have a kernel-devel package, but the version number is lower than the kernel’s version number, you can run: yum upgrade kernel-devel -y
If the version number is HIGHER than your kernel’s version number, go back to step 2 and upgrade your kernel.
If your kernel is smp or 64bit, and the kernel-devel package isn’t, you will have to force yum to get the correct verision:
smp: yum install kernel-smp-devel
64bit: yum install kernel-devel.x86_64
both: yum install kernel-smp-devel.x86_64
don’t be afraid to run uname-r and rpm -qa | grep kernel again and make sure the results match up.
4. Install the pkgconfig and xorg-x11-server-sdk packages
This is easy, just run: yum install xorg-x11-server-sdk pkconfig -y
This installs both packages.
5. Prepare your system for trouble
Installing a video card driver can render your X-server (the program responsible for desktop rendering) unbootable. If you system always tries to start the x-server as part of it’s boot process, it can cause trouble if something goes wrong. So, the first step is to make your machine instead boot into runlevel 3.
Runlevels define how much of your system starts up. Think of it kind of like windows safe mode.
Runlevel 1 just a command prompt, no logins, no networking, almost nothing.
Runlevel 3 is good for our purposes. Almost everything except the gui is started up.
Runlevel 5 is full system startup, gui and all. This is the default Fedora is installed with.
Runlevel 6 is a reboot. Under no circumstances set your default runlevel to this.
As a side note, you can change your runlevel any time you like by bringing up a command prompt and typing “init (runlevel)” where runlevel = some number. So, typing “init 3″ will shut down the x server and take you to the command prompt. Of course, if all you want is a command prompt, you can get there much more easily by pressing ctrl-alt-F2 to get to a virtual console. I mention this because sometimes with fedora, if you try to go down from 5 to 3, you won’t get a command prompt, and instead be stuck staring at a loading screen. All that’s happened here is that you just weren’t switched to the appropriate virtual console…all you have to do is press ctrl-alt-F2 or F3,etc.
Anyway, back to setting the default runlevel. Open up a console and type:
gedit /etc/inittab
This starts up the gedit program, with you editing the file /etc/inittab
The first non-commented line reads: id:5:initdefault
Change the 5 to a 3, and save the file.
Next, we need to back up your current X-Server configuration. Though older versions used XFree86, FC5 and 6 use Xorg, so I’m going to focus on that. The Xorg configuration lies in the directory /etc/X11. run:
cd /etc/X11 (to browse to that directory)
cp xorg.conf xorg.conf.original (this will make another copy of the file, in case we need to restore it)
6. Installing the driver (Finally)
Now would be a good time to print these instructions, unless you have another computer to read them on. You could also save these instructions into a simple text file, and read them with the “less” command (a simple file reader that works on a console. Use Up and Down arrows to brows the file, q to quit). Whichever way you choose, keep in mind you are going to be working on a console with no gui for a bit of the way, so prepare accordingly.
We need to get to runlevel 3, so that the X-server isn’t running. Either reboot (remember, we edited inittab to take us to runlevel 3 on startup) or type init 3.
Browse to the directory you downloaded the driver to, and type
sh NVIDIA-Linux-x86_64-1.0-9742-pkg2.run
I won’t go into too much detail, as it’s pretty straightforward. Just follow the on screen prompts, accept the license, say yes when it asks to compile and yes again when it wants to install. When it is done, it will probably offer to run nvidia-xconfig to automatically configure your xorg.conf file-this is probably a good idea. If it doesn’t do this last step automatically, you can do it yourself; just type nvidia-xconfig at the command line. If you have more than one monitor (or even more than one card), type nvidia-xconfig -a to enable all of them.
Once all this is done, you can run “init 5″ to load back up the X-server. Hopefully, it works! If it doesn’t, look below in my troubleshooting section.
7. Setup your X server configuration.
Once the server has loaded, you can use the command: nvidia-settings
to bring up a nice gui for configuring your resolution and desktops
However, if you are like me, this program may not configure things exactly as you would like them, in which case, you will need to edit the /etc/X11/xorg.conf file by hand.
Below is my xorg.conf file, through which I provide a walkthrough for what various options do.
The layout of my desktop is such:
I have 2 video cards, an 8800 in the first pci-e slot, and a 7900 in the second
I have 3 monitors, 2 on the 8800 and 1 on the 7900. I use the built in Nvidia twinview to allow the 2 monitors on the 8800 to share a desktop. TwinView is special, in that it presents 2 monitors on the same card as one big monitor to the X-Server. This works alot better, especially for 3d graphics, than the built in X-Server desktop sharing functionality. I use the X-Server functionality “Xinerama” to connect the desktop on the 7900 to the desktop on the 8800.
This results in one big desktop, stretching out across all 3 monitors.
The monitors are layed out as such:
7900 monitor-1st 8800 monitor-2nd 8800monitor
#This section defines how many screens the X-Server sees, and how they are arranged.
Section “ServerLayout”
#The Identifier can be whatever you like
Identifier “Layout0″
#This says to load the configuration for “Screen 0″ for the first screen.
#0 0 puts it in the absolute center position-all other screens should be defined in relation to it
#this screen will define what is displayed on BOTH of the monitors attached to the 8800, thanks to twinview (more on this below)
Screen 0 “Screen0″ 0 0
#This says to load the configuration for “Screen1″ for the second screen.
#LeftOf “Screen0″ tells it to position this screen to the left
#this really just affects how the mouse behaves-when the mouse goes all the way to the left on the first monitor, it will jump to the far right of the second monitor
#this screen will define what is displayed on the monitor attached to the 7900
Screen 1 “Screen1″ LeftOf “Screen0″
#this just tells the server where to load the input configurations. You will see these below.
InputDevice “Keyboard0″ “CoreKeyboard”
InputDevice “Mouse0″ “CorePointer”
EndSection
#place to define option X-server flags. You can find more of these in the NVIDIA README
Section “ServerFlags”
#Xinerama is a good option to enable-by setting the value to “1″-as it allows you to drag windows from one monitor to another
#this will allow windows to be dragged from the 8800 monitors to the 7900 monitors
Option “Xinerama” “1″
EndSection
#this is where we define the “Screen” info used by the “ServerLayout” section above
Section “Screen”
#this identifier has to match the one used by the server up above. For the sake of the tutorial, we will look at the second screen first (the 7900).
Identifier “Screen1″
#this tells the screen what device section to get it’s info from
Device “Videocard1″
#this tells the screen what monitor section to get it’s info from
Monitor “Monitor1″
#everything past this point basically tells the screen to run at “1024×768″ and 24bit color
#you can make this section alot more complicated by defining different “Display” subsections with different resolutions and depths-but who needs that?
DefaultDepth 24
SubSection “Display”
Depth 24
Modes “1024×768″ “800×600″ “640×480″
EndSubSection
EndSection
#here, we define one of the monitors referenced by a “screen” section
Section “Monitor”
# HorizSync source: edid, VertRefresh source: edid
#see how this identifier matches the “Monitor” reference in the Screen Section above?
Identifier “Monitor1″
#this info really isn’t important-put whatever you want here to help you remember which monitor you are referring to
VendorName “Unknown”
ModelName “SCEPTRE D98A”
#these settings are important-but most crts can use these defaults.
#It’s a good idea to let the nvidia-xconfig program autodetect these and use whatever it provides
HorizSync 31.0 – 95.0
VertRefresh 50.0 – 120.0
#this simply enables energy saving options for your monitor-standy, etc.
Option “DPMS”
EndSection
#this section provides the information about the card used by the screen section above
Section “Device”
#again, this identifier must match what is called in the “Screen” section above
Identifier “Videocard1″
#this defines what driver to use. “nvidia” is the full nvidia driver with 3d support-the one you just compiled.
#You can also use Driver “nv” to use the open-source nvidia driver with 2d, but no 3d acceleration.
#If that one gives you trouble, you can always use Driver “vesa”, which works with any card
Driver “nvidia”
#these next 2 really aren’t important, more for your reference
VendorName “NVIDIA Corporation”
BoardName “GeForce 7900 GT/GTO”
#this defines where the card is plugged in.
#This value is important, as it let’s the X-Server know which card you are defining-aka, which screen this card is used by.
#Here we see this card is plugged into the 2nd PCI-E slot
BusID “PCI:2:0:0″
EndSection
#now we define the first screen-the one for BOTH of the 8800 monitors
Section “Screen”
Identifier “Screen0″
Device “Videocard0″
Monitor “Monitor0″
DefaultDepth 24
#this is where things get special-we use TwinView.
#TwinView makes both of the monitors attached to the 8800 appear as one monitor
#This is why we only needed 2 screen sections for 3 monitors
Option “TwinView” “1″
#The metamodes section describes the placement of the 2 monitors in relation to eachother.
#the +1024 +0 section of CRT-0 handles the magic of shifting the secon monitor to the right of the first.
#yes, CRT-1 has a different refresh rate (85) than CRT-0. This is kind of a cludgy hack nvidia had to use to make this work with the X-Server
#also, the “metamodes” option
Option “metamodes” “CRT-0: 1024×768 +1024+0, CRT-1: 1024x768_85 +0+0;”
SubSection “Display”
Depth 24
Modes “1024×768″ “800×600″ “640×480″
EndSubSection
EndSection
#we only need one monitor section for the “Screen” section above
Section “Monitor”
# HorizSync source: edid, VertRefresh source: edid
Identifier “Monitor0″
VendorName “Unknown”
ModelName “XXX 1996F”
HorizSync 30.0 – 96.0
VertRefresh 50.0 – 150.0
Option “DPMS”
EndSection
#and here’s the device section for the “Screen” section above
Section “Device”
Identifier “Videocard0″
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “G80-300″
#this card is plugged into the first PCI-e slot
BusID “PCI:1:0:0″
EndSection
# for the Module section, as per the nvidia instructions, remove the lines:
# Load “dri”
#Load “GLCore”
#and insert the line:
# Load “glx
Section “Module”
Load “dbe”
Load “extmod”
Load “type1″
Load “freetype”
Load “glx”
EndSection
Section “Files”
#this next line is added by the nvidia-xconfig if you run it. The problem is, this file doesn’t exist
#you need to remove or comment out this line so xorg.conf uses the default rgb file
#if you don’t, tcl style apps will not work.
# RgbPath “/usr/lib/X11/rgb”
FontPath “unix/:7100″
EndSection
#configuration for the mouse
Section “InputDevice”
# generated from default
Identifier “Mouse0″
Driver “mouse”
Option “Protocol” “auto”
Option “Device” “/dev/input/mice”
Option “Emulate3Buttons” “no”
Option “ZAxisMapping” “4 5″
EndSection
#configuration for the keyboard
Section “InputDevice”
# generated from data in “/etc/sysconfig/keyboard”
Identifier “Keyboard0″
Driver “kbd”
Option “XkbLayout” “us”
Option “XkbModel” “pc105″
EndSection
Anyway, when you are done editing the xorg.conf file, just save it, and run “init 3″ to shutdown the X-Server and “init 1″ to bring it back up.
8. Troubleshooting
If you get some errors, you can delve into the NVIDIA linux driver README:
http://download.nvidia.com/XFree86/Linux-x86/1.0-9629/README/index.html
and hope it describes the error you are getting and can fix it.
If you need to get your desktop back (so you can head over to the README), all you have to do is reload your original xorg.conf-it will use the old drivers. To do this:
cd /etc/X11
rm xorg.conf
cp xorg.conf.original xorg.conf
Now, when you start the X-server, it will use the original configuration file and the original drivers.
Keep in mind, even if you don’t see a desktop, if you already ran the command “init 5″, you currently in runlevel 5, you just don’t have an X-server running. ‘init 5′ may not work for starting the X-server in such a case. Instead, you can start the X-server with the command: startx
If you forget what errors the X-server gave, or just need to doublecheck it, you can read the X-Server logs, located at:
/var/log/Xorg.0.log
/var/log/Xorg.0.log.old
The first log is the log from the most recent X-Server startup, the second is from the one before it. This second log is useful when the X-Server fails to load, then you reload your original xorg.conf to make the X-Server boot up normally. In such a situation, Xorg.0.log wouldn’t be any help, as it would just contain the information from the load that was a success; the errors you were looking for would be in the Xorg.0.log.old file instead.
To summarize:
If you didn’t reload your old configuration and are still at the command line, you can check the log with:
less /var/log/Xorg.0.log
If you did reload your old configuration and brought back up the desktop, you can check the log with:
gedit /var/log/Xorg.0.log.old
Conclusion:
I hope this article has been some help in getting your card working. If you have any specific problems, please post in the comments, and I’ll see what I can do to help you out.
Comments