Page 1 of 10 123 ... LastLast
Results 1 to 10 of 96

Thread: HOWTO: Automatically update manually installed NVidia drivers after kernel updates

  1. #1
    Join Date
    Jan 2007
    Location
    $here ? $here : $there
    Beans
    3,717
    Distro
    Ubuntu 8.04 Hardy Heron

    HOWTO: Automatically update manually installed NVidia drivers after kernel updates

    Overview
    If you've manually installed the NVidia drivers from the NVidia website, when major kernel releases come out it's necessary to re-install the drivers for the new kernel. This guide aims to automate that process so that it happens when the new kernel is installed and requires no user intervention.

    This HOWTO assumes you have correctly installed the NVidia drivers from the website and that you have rebooted after installing them at least once (this is very important because, if you haven't installed them correctly, upon reboot they will not work). This guide is not aimed at users who have installed the drivers using EnvyNG or via the default Ubuntu mechanism.

    (Note: This has only been tested on 8.04 and may not work or be needed in later versions)

    Implementation

    Update: After finding an easier method to this, I've modified the directions slightly. People using the old method can continue to use it or, see this post to revert the changes from the old method.

    Another Update: I've changed the script very slightly to provide a status message depending on whether or not building the new driver worked. People can replace nvidia-update with this new script or continue to use the old. I've also changed the testing instructions slightly.

    The first thing I recommend doing this is to move the driver you are using to /usr/src and make a symlink to it. For example:

    Code:
    sudo mv NVIDIA-Linux-x86-173.14.05-pkg1.run /usr/src
    sudo ln -s /usr/src/NVIDIA-Linux-x86-173.14.05-pkg1.run /usr/src/nvidia-driver
    The reason for doing this is so that if you change the driver you are using, you can simply remove the symlink and point it at the new driver and not have to modify the script we are about to install.

    The script we will use to automate this process is here:

    Code:
    #!/bin/bash
    #
    
    # Set this to the exact path of the nvidia driver you plan to use
    # It is recommended to use a symlink here so that this script doesn't
    # have to be modified when you change driver versions.
    DRIVER=/usr/src/nvidia-driver
    
    
    # Build new driver if it doesn't exist
    if [ -e /lib/modules/$1/kernel/drivers/video/nvidia.ko ] ; then
        echo "NVIDIA driver already exists for this kernel." >&2
    else
        echo "Building NVIDIA driver for kernel $1" >&2
        sh $DRIVER -K -k $1 -s -n 2>1 > /dev/null
    
        if [ -e /lib/modules/$1/kernel/drivers/video/nvidia.ko ] ; then
            echo "   SUCCESS: Driver installed for kernel $1" >&2
        else
            echo "   FAILURE: See /var/log/nvidia-installer.log" >&2
        fi
    fi
    
    exit 0
    Essentially, what it does is check to see if the kernel we are installing has the proprietary nvidia driver installed. If not, it will build the module for that kernel.

    Name the script update-nvidia and install it with:

    Code:
    sudo mkdir -p /etc/kernel/postinst.d
    sudo install update-nvidia /etc/kernel/postinst.d
    That's it. The next time you install a kernel that doesn't have the NVidia driver, it will automatically build it for you at installation time.

    Testing
    You can test it by either waiting for the next kernel release or by temporarily installing the -386 kernel to verify that it really does work properly. If you choose the later method of testing, this is how to do it:

    Code:
    sudo apt-get install linux-image-386 linux-headers-386
    You should see a long pause as it says it's building the nvidia driver for the -386 kernel and then a success message. If it works, you can then remove the -386 kernel we installed for testing with:

    Code:
    sudo apt-get remove linux-headers-2.6.24-19-386 linux-headers-386 linux-image-2.6.24-19-386 linux-image-386 linux-ubuntu-modules-2.6.24-19-386

    Comments/Questions/Suggestions welcome.
    Last edited by sdennie; December 6th, 2008 at 08:53 PM. Reason: Minor script update
    Don't try to make something "fast" until you are able to quantify "slow".

  2. #2
    Join Date
    Aug 2007
    Beans
    51
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HOWTO: Automatically update manually installed NVidia drivers after kernel update

    Wow you must be psychic. I was just thinking of a way too do that.

    Thanks a bunch!

  3. #3
    Join Date
    Jul 2005
    Location
    FRANCE
    Beans
    162
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Wink Re: HOWTO: Automatically update manually installed NVidia drivers after kernel update

    Very usefull howto !
    Thanks a lot guy !

  4. #4
    Join Date
    Mar 2007
    Location
    Devon UK
    Beans
    1,494
    Distro
    Ubuntu Development Release

    Re: HOWTO: Automatically update manually installed NVidia drivers after kernel update

    Thank you That looks great Just on the point of manually installing the new nVidia driver on my AMD64 machine. Got fed up with trying to use 640x480 display!! Seems unlikely to me that we will see automatic nVidia driver installation very soon, so that HowTo will be invaluble.
    Desktops: AMD64X2 3GB RAM 500GB SATA2 GeForce9400GT - P4 HT 3.2Ghz 1GB RAM 250GB IDE + 2x160GB SATA ATI Radeon X740XL - Laptop AMD AthlonXP 1.6 512MB RAM 120GB HD ATI M200

    Gina's Ubuntu HowTo's for beginners (and reference)

  5. #5
    Join Date
    Jan 2007
    Location
    $here ? $here : $there
    Beans
    3,717
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO: Automatically update manually installed NVidia drivers after kernel update

    Quote Originally Posted by Gina View Post
    Thank you That looks great Just on the point of manually installing the new nVidia driver on my AMD64 machine. Got fed up with trying to use 640x480 display!! Seems unlikely to me that we will see automatic nVidia driver installation very soon, so that HowTo will be invaluble.
    You'll still have to manually install the first time because the nvidia drivers aren't just a kernel module. I'll edit the howto and make it clearer that you need to have manually installed and rebooted at least once before the tutorial will work.
    Don't try to make something "fast" until you are able to quantify "slow".

  6. #6
    Join Date
    Apr 2008
    Location
    Lyngen, Norway
    Beans
    17
    Distro
    Ubuntu

    Re: HOWTO: Automatically update manually installed NVidia drivers after kernel update

    Thank you, this is great. I'll soon get a Nvidia card and this wil be very useful.

  7. #7
    Join Date
    Jan 2007
    Location
    $here ? $here : $there
    Beans
    3,717
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO: Automatically update manually installed NVidia drivers after kernel update

    I'd like to point out that it's still possible for the nvidia installation to break when the xserver-xorg-core package updates. The drivers will still work (you'll be at normal resolution when you login) but, that package conflicts with some of the files in the nvidia manual installer and so direct rendering will be turned off (so, compiz will no longer work). If I can figure out a solution to prevent that as well, I will post it in the HOWTO.
    Don't try to make something "fast" until you are able to quantify "slow".

  8. #8
    Join Date
    Apr 2008
    Beans
    204
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Automatically update manually installed NVidia drivers after kernel update

    Vor,

    I am getting this error when I try to accomplish the renaming of the file update-grub

    sudo install update-nvidia-grub /usr/sbin
    install: cannot stat `update-nvidia-grub': No such file or directory
    when attempting to replace the kernel installation rule with the script. I am very new so I may be missing an elementary step. Any help would be appreciated. Thank You
    Ktechman

  9. #9
    Join Date
    Jan 2007
    Location
    $here ? $here : $there
    Beans
    3,717
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO: Automatically update manually installed NVidia drivers after kernel update

    Before running that command run "ls" and see if you see a file named "update-nvidia-grub". It's possible that when you saved the file, you named it something slightly different or saved it in a different location.
    Don't try to make something "fast" until you are able to quantify "slow".

  10. #10
    Join Date
    Feb 2006
    Beans
    65

    Re: HOWTO: Automatically update manually installed NVidia drivers after kernel update

    This is really cool. Thanks!

Page 1 of 10 123 ... LastLast

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
  •