Using Nvidia drivers on Fedora 12 with DKMS

Although it sucks too much using closed source software, someone wants or have to use that. It’s the case of Nvidia graphics drivers: someone wants them to obtain better performances, others have to use them because their adapters don’t work well with open source drivers, and others (like me) have to use Nvidia closed drivers for developing and using CUDA applications.

This is essentially a manual installation but thanks to DKMS, Dynamic Kernel Module Support, it isn’t required anymore to reinstall the driver at every kernel update.

Fedora 12 comes with the nouveau driver, I’m not saying that it isn’t good enough, but we have to force the system to don’t use it because only a driver at a time can manage a device. The first thing that we have to do is to blacklist the “nouveau” module to prevent that the kernel loads it automatically, to obtain this we should add the row to the file /etc/modprobe.d/blacklist.conf:

blacklist nouveau

and then rebuild the initrd image with dracut, using the following command:

dracut --force /boot/initramfs-$(uname -r).img $(uname -r)

Fedora 12 comes also with KernelModesetting, it’s a service that moves the graphics mode initialization from the X server startup to the kernel, and of course we need to disable it because it would load the nouveau driver. It’s possible to disable KMS adding the “nomodeset” option to the kernel boot parameters, so to obtain this we have to add the option nomodeset to (every) kernel entry in our /boot/grub/grub.conf. Fedora kernel’s post-install scripts are smart enough to add to the new kernel all the options used by the previous one, so it isn’t needed to add manually the “nomodeset” option when it will be installed an updated kernel.

Now neither the kernel or the KMS service would load the nouveu driver, we can nevermind about the xorg.conf because the nvidia-installer will create it later.

Now we can install the Nvidia driver, I’m using an x86_64 system and I want to use the version 190.42 of the Nvidia driver so I can download the package:

wget http://us.download.nvidia.com/XFree86/Linux-x86_64/190.42/NVIDIA-Linux-x86_64-190.42-pkg2.run

And we can run the following command to install the X Server related part of the driver:

sh NVIDIA-Linux-x86_64-190.42-pkg2.run --no-x-check --silent --no-kernel-module  --run-nvidia-xconfig

It’s possible to make the installation in graphic mode (ie runlevel 5) because we aren’t going to use the nvidia driver in this session: it wouldn’t be possible, the nouveau driver is loaded and has acquired the control over the graphic adapter.

Finally we can configure dkms for building and installing automatically the nvidia kernel module when the system boots. But of course it is needed to install dkms, and enable it:

yum install dkms
chkconfig dkms_autoinstaller on

DKMS can manage many modules with different versions too, each module’s sources are located in “/usr/src/-“, so we have to create the directory:

mkdir /usr/src/nvidia-190.42

copy the module sources (extracting them from the autoinstallable package) to that directory:

sh NVIDIA-Linux-x86_64-190.42-pkg2.run -x
cp NVIDIA-Linux-x86_64-190.42-pkg2/usr/src/nv/* /usr/src/nvidia-190.42/
rm -r NVIDIA-Linux-x86_64-190.42-pkg2

and create a file that instructs dkms on how build and install the module, the file is conventionally named dkms.conf:

#
# /usr/src/nvidia-190.42/dkms.conf
#

PACKAGE_NAME="nvidia"
PACKAGE_VERSION="190.42"
CLEAN="true"
MAKE[0]="make module"
BUILD_MODULE_NAME[0]="nvidia"
DEST_MODULE_LOCATION[0]="/kernel/drivers/video/"
AUTOINSTALL="yes"

# End Of File

In dkms.conf where sayng the name and the version of the module, to use “make module” as the make command, that the name of the built module is “nvidia” and that the module have to be installed automatically. (Note: we use “true” as the clean command because the default “make clean” would erase every object file, but some of them are closed source so we can’t recreate them.)

The last thing to do is to add the module to the dkms database with the command:

dkms add -m nvidia -v 190.42

.

and then reboot the system to use the nvidia driver.

That’s all folks!

About gicoviello
Writing code in exchange for booze and food

16 Responses to Using Nvidia drivers on Fedora 12 with DKMS

  1. Pingback: Using Nvidia drivers on Fedora 12 with DKMS | Giuseppe Coviello

  2. Pingback: Using Nvidia drivers on Fedora 12 with DKMS | Giuseppe Coviello | Just linux!

  3. Pingback: News Alert » Blog Archive » Using Nvidia drivers on Fedora 12 with DKMS | Giuseppe Coviello

  4. Pingback: Using Nvidia drivers on Fedora 12 with DKMS | Giuseppe Coviello : News IT

  5. Bryan says:

    “to obtain this we should add the row:

    blacklist nouveau”

    Add that row to what?

    • cjg says:

      You’re right I forgot to say to which file one has to add that row. The file is “/etc/modproble.d/blacklist.conf”.

      Thank you for the report.

  6. Ed Greshko says:

    You have the format of the dracut command reversed.

    dracut [OPTION]…

    So, it should read….

    dracut –force /boot/initramfs-$(uname -r).img $(uname -r)

  7. ds says:

    hello, i just updated the kernel to 2.6.32.10-90 and now the driver doesn’t work, please tell me how can i fix this?

  8. Tommaso says:

    Strange…
    it looks working with 2.6.32-22 only if you put
    make module && make install
    in the dkms.conf

    Why that?
    Shouldn’t dksm think about this?

    • cjg says:

      Yes, it should because it should copy $BUILD_MODULE_NAME[i].ko in $DEST_MODULE_LOCATION[i]. But at the moment I can’t test, so thank you for the advice.

  9. Pingback: Osl

  10. Pingback: Using Nvidia drivers on Fedora 12 with DKMS | Giuseppe Coviello | Penny Stocks

  11. Pingback: World Wide News Flash

  12. Ed Greshko says:

    Has anyone tried these instructions with Fedora 15? I used this in Fedora 11 just fine and would prefer to use this method instead of rpmfusion.

  13. Pingback: Dkms nvidia | Grabadive

Leave a Reply

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

WordPress.com Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: