I figured out the last days how to correctly setup DKMS for newer Versions of the NVidia-Driver. In case you dont know, DKMS is a nifty little system that will ensure you dont run into trouble if you install a new kernel. Running a new Kernel requires ALL modules to be recompiled, and in the case of propietary drivers (ie drivers you dint install through apt-get) this task is left to you.
DKMS is there to automate this very task, you wont ever have to care for kernel-upgrades again.
I wrote a little script(attached) that extracts the necessary parts from the NVIDIA-Driver and can configure DKMS.
Who can use this tutorial
Theoretically the procedure should work on all Ubuntus that have the necessary packages (Gutsy and later), I only tested this on Intrepid tough. It should work with all current and future NVIDIA-Installers (180, 173, 96 and 71 Series ).
- Your OS should be Ubuntu - Gutsy or later. Earlier versions should work too if you manage to manually install DKMS but I wont cover that
- You need a Nvidia Card obviously, and the official NVIDIA-Installer Latest Versions can be found here
Heres the instructions how to use the latest NVIDIA-Driver on Ubuntu and configure DKMS for it:
Step 1: Uninstall the Nvidia-driver from the repositories (if you installed it from there)
Use the Restricted Driver Manager and/or do it by commandline.
This depends on your Version of Ubuntu and the Driver you previously installed (via apt-get or Restricted driver manager). Search for packages containing nvidia in the name in synaptic, generally you should unistall all nvidia*glx* and nvidia*kernel* packages. for example:
Step 2: Keep Ubuntu from using the driver in the repos
sudo apt-get remove nvidia-glx-180 nvidia-180-kernel-source nvidia-xconfig nvidia-settings
Open the file /etc/default/linux-restricted-modules-common
and add the modules nv nvidia_new to the list of disabled modules.
sudo gedit /etc/default/linux-restricted-modules-common
This will keep the restricted driver Manager from nagging.
Step 3: Prepare the Files and packages you will need
Packages necessary to build the kernel module:
You will also need the Kernel-header for ALL the kernels you plan to use (typically linux-headers-generic or linux-headers-rt), you need to make sure you pick the right one(s). To install the headers for Ubuntu`s normal Kernel:
sudo apt-get install dkms build-essential make
Get the NVIDIA Binary driver for your system (32 or 64 Bit). Follow the links from here
sudo apt-get install linux-headers-generic
Grab my script (attached) for configuring DKMS and unpack it in the same directory as the NVIDIA-Driver.
running the script as non-root will only do some sanity-checks so I suggest you so so now by typing (replace 180.37 with the version you are installing)
sh ./installdkms.sh 180.37
Step 4: Installing the driver
Reboot ubuntu into safe mode and choose root-prompt, this is IMHO the easiest way to drop into an environment where you can safely install the driver. You might not have internet-connectivity tough, thats why you installed all the packages before.
Now cd into the directory where you saved the NVIDIA-Driver and the script. For example:
First part is to install the Driver, the command ofcourse depends on the filename, example:
Follow the instructions, they are pretty obvious I guess. If it complains about beeing in runlevel 1 just tell it to continue anyway.
If you are on Hardy or later I suggest you dont let the Installer configure your xorg.conf but do so yourself. The Installer will produce a working configuration, but its better to do so by Hand, read up Appenix A before rebooting.
now run the script, you need to replace 180.37 with the driverversion you are going to install
If everything turns out ok, you can query the state of DKMS. Heres the output on my system:
sh ./installdkms.sh 180.37
last Step is to exit the commandline and boot into ubuntu normally
nvidia, 180.37, 2.6.27-11-generic, x86_64: installed
Appendix A: Telling X to use the nvidia driver
If you told the installer to adjust the xorg.conf file you dont need to do anything.
And if you have trouble with this step you can still do it automatically by running "nvidia-xconfig"
If you choose to edit it manually (highly recommended) then execute
Hardy and later have a pretty minimalistic or even nonexistant xorg.conf, this is the whole file for my system:
Appendix B: Script for running the nvidia-installer
VendorName "NVIDIA Corporation"
I also added a script which installs the base driver, creates a xorg.conf only if noone exists and then runs the installDKMS.sh script. This should work well if you already have xorg.conf edited or are running a fresh Ubuntu (Hardy or newer) which has no xorg.conf.
Simply follow the steps in this tutorial untill you have to run the NVIDIA-Installer and instead run (replace 180.37 with your version)
sh ./fullinstallNV.sh 180.37
Appendix C: Removing old DKMS Modules
If you installed previous drivers you will have multiple Nvidia Modules. You can delete the old DKMS Modules with
Unfortunatly that still leaves the source behind, so delete that aswell:
sudo dkms remove -m nvidia -v <oldversion> --all
sudo rm -rf /usr/src/nvidia-<oldversion>
Update 23.1.2008: Added fixes from jdillaczek and jocko - Script is at V2
Update 26.1.2008: Now also works if NVIDIA-Installer is not marked executable, added lotsa comments - Script is at V3
Update 10.3.2008: Now needs driverversion as argument, tested and worked with all current (legacy) NVIDIA Installers - Script is at V4