Page 1 of 2 12 LastLast
Results 1 to 10 of 45

Thread: HOWTO: Install Nvidia drviers including DKMS module

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Beans
    278

    HOWTO: Install Nvidia drivers including DKMS module

    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
    Code:
    shutdown -r 0
    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
    Attached Files Attached Files
    Last edited by Npl; March 10th, 2009 at 03:36 PM.

  2. #2
    Join Date
    Jan 2006
    Location
    Vancouver, Canada
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: HOWTO: Install Nvidia drviers including DKMS module

    Nifty!
    Just trying this out now, but thanks in advance

  3. #3
    Join Date
    Aug 2006
    Beans
    278

    Re: HOWTO: Install Nvidia drviers including DKMS module

    Hmm, hope everything goes well for you. The script got DL 19 times with one response, so if I dont hear back from you I will assume I`m responsible for 19 blownup Computers.

  4. #4
    Join Date
    Aug 2008
    Beans
    2

    Re: HOWTO: Install Nvidia drviers including DKMS module

    That is a nifty little script -- thanks for figuring this out and sharing the solution! Here are a few typos I noticed (and I had to remove the -q option from the dkms commands; otherwise the script would just exit at that point -- not sure what's up with that): change line 48 from

    Code:
    if [ sanity != 1 ]
    to

    Code:
    if [ $sanity != 1 ]
    and line 71 from

    Code:
    $installername --extract-only --target $tempdir/installer
    to

    Code:
    ./$installername --extract-only --target $tempdir/installer
    and line 80 from

    Code:
    cp $tempdir/installer/$installersourcedir/* $destsourcedir
    to

    Code:
    cp -r $tempdir/installer/$installersourcedir/* $destsourcedir
    (and remove the -q option from dkms commands on lines 95, 100, 103, and 106).

  5. #5
    Join Date
    Nov 2005
    Location
    Uppsala, Sweden
    Beans
    2,180
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: HOWTO: Install Nvidia drviers including DKMS module

    One more typo at row 16:
    Change from:
    Code:
    packagedepencies=(dkms build-essentials make)
    To:
    Code:
    packagedepencies=(dkms build-essential make)
    But there seems to be one more problem. When I run the script it ends with:
    Code:
    Moving kmodule-source to /usr/src/nvidia-180.22
    Creating dkms-configuration /usr/src/nvidia-180.22/dkms.conf
    Delete temporary directory
    Removing all previous DKMS Modules
    
    Error! There are no instances of module: nvidia
    180.22 located in the DKMS tree.
    Edit: I managed to get it to complete successfully by commenting out line 95, so that it does not try to remove something that is not there (is it likely that anyone would need to run the script again if the module is already in the dkms tree?).
    I don't know much about bash, but wouldn't it be possible to make the script first check if there are any nvidia modules in the dkms tree, and only try to remove them if they really are there?

    Edit 2: I tried again. First I removed the module with:
    Code:
    dkms remove -m nvidia -v 180.22 --all
    Then I reverted line 95 to it's original form:
    Code:
    dkms remove -m nvidia -v $driverversion --all -q
    And it worked without errors. So the -q needs to be there on line 95, otherwise the script will stop with an error if the module does not already exist...

    Edit 3: I added a line (72) to the script to get it to run the actual installer as well.
    So I attach a modified version of the script (with both jdillaczek's and my fixes).

    The instructions for using the script to both install using nvidia's installer and add the module to dkms:
    1. Unpack the tar.gz containing the script to the same folder as the nvidia installer (~/Desktop).
    2. Go to cli-only mode (by some reason required by nvidia's installer):
    Code:
    sudo /etc/init.d/gdm stop
    3. Navigate to where the installer and script is located:
    Code:
    cd ~/Desktop
    4. Run the script:
    Code:
    sudo ./installdkms.sh
    5. Restart gnome:
    Code:
    sudo gdm
    Attached Files Attached Files
    Last edited by jocko; January 23rd, 2009 at 07:41 AM.

  6. #6
    Join Date
    Aug 2006
    Beans
    278

    Re: HOWTO: Install Nvidia drviers including DKMS module

    Thanks for the feedback, I added jdillaczek fixes and made sure the script is not stopping at errors from the dkms-commands - they have undocumented returnvalues and generally are behaving a bit weird. Now theres a bit more verbose output since i removed the -q options aswell.

    jocko: You need to drop out of the GUI since you cant replace kernelmodules while you are using them. Also I dont want to call the NVIDIA-Installer from within the script, its complex enough to warrant its explicit call.

  7. #7
    Join Date
    Aug 2007
    Location
    Red Deer, AB-Canada
    Beans
    242
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HOWTO: Install Nvidia drivers including DKMS module

    Quote Originally Posted by Npl View Post

    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.
    I have a question (well...two).

    What exactly does Step 2 do?

    And, why I still see two nVidia driver "suggestions", 180 and 173 -to be installed- at Administration > Hardware Manager ?

    I just want to be 100% sure that the driver is properly installed before moving into troubleshooting my Compiz Fusion installation.

    Thanks.
    Ozzy - User: Linux 452359 | Ubuntu 16872 |

  8. #8
    Join Date
    Aug 2006
    Beans
    278

    Re: HOWTO: Install Nvidia drivers including DKMS module

    Quote Originally Posted by ozzyprv View Post
    I have a question (well...two).

    What exactly does Step 2 do?
    keep ubuntu from installing nvidia kernel-drivers automatically.
    Quote Originally Posted by ozzyprv View Post
    And, why I still see two nVidia driver "suggestions", 180 and 173 -to be installed- at Administration > Hardware Manager ?
    Thats a GUI-App called "Jockey", its quite possible not smart enough to look into "/etc/default/linux-restricted-modules-common" to figure out it shouldn`t/can`t install those drivers.

    Remove the packages "nvidia-173-modaliases", "nvidia-180-modaliases", "nvidia-71-modaliases", "nvidia-96-modaliases" and "nvidia-common" to make it stop displaying the nvidia-driver. you could ofcourse remove jockey altogether =)
    Quote Originally Posted by ozzyprv View Post
    I just want to be 100% sure that the driver is properly installed before moving into troubleshooting my Compiz Fusion installation.
    just run glxinfo or open the nvidia-settings. Both should tell if you run the nvidia-driver or not.
    Last edited by Npl; June 8th, 2009 at 12:18 PM.

  9. #9
    Join Date
    Aug 2007
    Location
    Red Deer, AB-Canada
    Beans
    242
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HOWTO: Install Nvidia drviers including DKMS module

    Tested again, I thought I provide some feedback.

    Updated to 2.6.28-13-server (from 2.6.28-11-server).

    All I had to do to get the nVidia driver back was to install linux-headers-2.6.28-13-server.

    It worked perfectly.

    Cheers!
    Last edited by ozzyprv; June 24th, 2009 at 06:12 AM. Reason: typo
    Ozzy - User: Linux 452359 | Ubuntu 16872 |

  10. #10
    Join Date
    Oct 2005
    Beans
    153

    Re: HOWTO: Install Nvidia drviers including DKMS module

    ok trying a modification of this: i grabbed the 190.09 drivers, and to make the scripty be happy did this:
    cp cudadriver_2.3-beta_linux_32_190.09.run NVIDIA-Linux-x86-190.09-pkg0.run

    will update here if anything worx.

    this is precipitated because i installed an older 180 driver and somehow left some kernel module remnants giving version mismatch's.

    so far we are at:

    # sh installdkms.sh 190.09Checking for kernel-sources for the running kernel
    Kernel-sources seem to be installed
    Important: You should install the correct Packages
    for ALL kernels you are using

    Installing necessary packages

    Nvidia Driver Version 190.09
    Nvidia Installer Binary ./NVIDIA-Linux-x86-190.09-pkg0.run
    DKMS Module Directory /usr/src/nvidia-190.09

    Running Kernel 2.6.28-13-generic
    Expect Kernel-Sources in /usr/src/linux-headers-2.6.28-13-generic

    DKMS Version dkms: 2.0.21.1
    Unpacking installer
    Moving kmodule-source to /usr/src/nvidia-190.09
    Creating dkms-configuration /usr/src/nvidia-190.09/dkms.conf
    Delete temporary directory
    Removing eventual existing DKMS-Modules for the same driverversion
    Done.
    Adding Module to DKMS build system
    Module Name: nvidia 190.09

    Creating symlink /var/lib/dkms/nvidia/190.09/source ->
    /usr/src/nvidia-190.09

    DKMS: add Completed.
    Doing initial module build

    Kernel preparation unnecessary for this kernel. Skipping...

    Building module:
    cleaning build area....
    make KERNELRELEASE=2.6.28-13-generic module KERNDIR=/lib/modules/2.6.28-13-generic IGNORE_XEN_PRESENCE=1 IGNORE_CC_MISMATCH=1 SYSSRC=/lib/modules/2.6.28-13-generic/build......
    cleaning build area....

    DKMS: build Completed.
    Installing initial module

    nvidia.ko:
    Running module version sanity check.
    - Original module
    - Found /lib/modules/2.6.28-13-generic/kernel/drivers/video/nvidia/nvidia.ko
    - Storing in /var/lib/dkms/nvidia/original_module/2.6.28-13-generic/i686/
    - Archiving for uninstallation purposes
    - Installation
    - Installing to /lib/modules/2.6.28-13-generic/updates/dkms/

    depmod......

    DKMS: install Completed.
    Done. Status of DKMS is:
    nvidia, 190.09, 2.6.28-13-generic, i686: installed (original_module exists)

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •