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:
Code:
sudo apt-get remove nvidia-glx-180 nvidia-180-kernel-source nvidia-xconfig nvidia-settings
Step 2: Keep Ubuntu from using the driver in the repos
Open the file /etc/default/linux-restricted-modules-common
Code:
sudo gedit /etc/default/linux-restricted-modules-common
and add the modules nv nvidia_new to the list of disabled modules.
Code:
DISABLED_MODULES="nv nvidia_new"
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:
Code:
sudo apt-get install dkms build-essential make
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:
Code:
sudo apt-get install linux-headers-generic
Get the NVIDIA Binary driver for your system (32 or 64 Bit). Follow the links from here
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)
Code:
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:
Code:
cd /home/<yourusername>
First part is to install the Driver, the command ofcourse depends on the filename, example:
Code:
sh ./NVIDIA-Linux-x86_64-180.37-pkg0.run
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
Code:
sh ./installdkms.sh 180.37
If everything turns out ok, you can query the state of DKMS. Heres the output on my system:
Code:
dkms status
nvidia, 180.37, 2.6.27-11-generic, x86_64: installed
last Step is to exit the commandline and boot into ubuntu normally
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
Code:
vim /etc/X11/xorg.conf
Hardy and later have a pretty minimalistic or even nonexistant xorg.conf, this is the whole file for my system:
Code:
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
EndSection
Appendix B: Script for running the nvidia-installer
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)
Code:
sh ./fullinstallNV.sh 180.37
Then reboot
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
Code:
sudo dkms remove -m nvidia -v <oldversion> --all
Unfortunatly that still leaves the source behind, so delete that aswell:
Code:
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
Bookmarks