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:
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 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:
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="make module" BUILD_MODULE_NAME="nvidia" DEST_MODULE_LOCATION="/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!