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:


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

sh --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 -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

MAKE[0]="make module"

# 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!

16 thoughts on “Using Nvidia drivers on Fedora 12 with DKMS

    1. 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.

  1. You have the format of the dracut command reversed.

    dracut [OPTION]…

    So, it should read….

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

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

  3. 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?

    1. 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.

  4. Pingback: Osl
  5. 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.

Leave a Reply

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

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