Configuring xorg.conf for nvidia driver


I tried installing nvidia GeForce Fx Go5200 32Mb graphics card on my Dell 8600 running gentoo linux. It took a while to find the right instructions in setting up the GUI work with screen resolution 1280x800. The following instructions should also work for other screen resolutions.

Installing X-org

Install Xorg by emerging xorg-x11. This process will take some time to compile.Since xorg-x11 is a huge file, it can be downloaded first and emerged later.

# emerge -f xorg-x11
# emerge xorg-x11

After the installation is complete you might want to reinitialize some environment variables before you continue.

# env-update
# source /etc/profile

Configuring the X Server

A couple of tools are available for configuring xorg.conf but we shall use xorgcfg.

#xorgcfg -textmode

You will be greeted by a screen. Press OK and configure a monitor.(Hint: choose 1024x768 @ 70Hz for a WXGA)

Configure your video card. Leave the default card name as 'card 0'. Choose a card from the card database. In my case, i chose nv GeForce FX Go5200 32M/64M. Press next and choose "nv" for now.
Choose apt screen resolutions that work on your windows OS(Dont worry if you dont find your highest resolution. It can be configured later on). Write it to /etc/X11/xorg.conf and quit.

Emerging nVidia drivers

If you had used genkernel double check to see if the proper modules have been loaded.

#genkernel --menuconfig all

Make sure to enable the following as a ‘*’ and not as ‘M’. Please note that after you set the options it’ll take genkernel a while to complete with the compilation.

Loadable module support --->
[*] Enable loadable module support
Processor and Features --->
[*] MTRR (Memory Type Range Register) support

If you have a x86 or AMD processor you will have to remove the in-kernel nVidia driver since it conflicts with the nvidia driver we would emerge.

Device Drivers --->
Graphics Support --->
< > nVidia Framebuffer Support
< > nVidia Riva support

Enable VESA support,

Device Drivers --->
Graphics Support --->
<*> VESA VGA graphics support
( ) vesafb
(X) vesafb-tng
Input your screen resolution such as "1280x800@60"

The nvidia-kernel ebuild auto discovers your kernel version based on the /usr/src/linux symlink. Please ensure that you have this symlink pointing to the correct sources and that your kernel is correctly configured.
Make sure your simlink is pointing to the correct kernel version. The following has the kernel 2.6.15-gentoo-r1

# cd /usr/src
# ls -l

Your output must be something like:

lrwxrwxrwx 1 root root 22 Apr 23 18:33 linux -> linux-2.6.15-gentoo-r1

If the symlink is not pointing to the correct sources, you must update the link like this:

# cd /usr/src
# ln -snf linux-2.6.15-gentoo-r1 linux

Now it's time to install nvidia-kernel and nvidia-glx. Since nvidia-glx depends on nvidia-kernel, installing nvidia-glx is sufficient:

# emerge nvidia-glx

Note: You will have to run nvidia-kernel everytime you recompile your kernel. Once the installation has finished, run modprobe nvidia to load the kernel module into memory.

# modprobe nvidia

Edit /etc/modules.autoload.update/rc.conf and include nvidia so that you need not update the modules everytime you boot the system. Run modules-update.

# modules-update

Configuring xorg.conf

Open xorg.conf and make the following changes to get 1280x800 working.

#nano -w /etc/X11/xorg.conf

Under Section "Module", # dri, xtt & speedo. Make sure Load "glx" is not commented.

# Load "xtt"
# Load "dri"
# Load "speedo"
Load "glx"

Add the following to the end of your file:

Section "Modes"
        Identifier     "16:9"
# I would recommend this site to calculate your ModeLine
        ModeLine     "1280x800" 83.5 1280 1344 1480 1680 800 801 804 828

In your monitor section change your UseModes to "16:9" if you have a wide screen display

Section "Monitor"
        Identifier   "Monitor0"
        UseModes     "16:9"
        HorizSync    31.5 - 57.0
        VertRefresh  50.0 - 70.0

Under "Device" , change the driver name to "nvidia".Add "1280x800" next to modes along with the other values.

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth     24
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes    "1280x800" "1024x768" "800x600" "640x480"

Run opengl-update so that the X Server uses the nVidia GLX libraries:

#opengl-update nvidia

Edit /etc/rc.conf

#nano -w /etc/rc.conf

Make changes as follows


Save the file and Reboot the system. Start gnome session(hoping you have already emerged gnome) by using startx.


Mouse and other io devices should work by default. If not refer for tweaking your xorg.conf even further.

If you still can't load your "nvidia" driver try the troubleshooting page.

Sample xorg.conf