+ Post New Thread
Results 1 to 2 of 2
Scripts Thread, Script to update manually installed NVidia drivers after kernel updates in Coding and Web Development; I recently used a script written by an ubuntu forums admin that is supposed to re-compile the nvidia drivers on ...
  1. #1
    llawwehttam's Avatar
    Join Date
    Nov 2008
    Location
    Birmingham
    Posts
    223
    Thank Post
    56
    Thanked 3 Times in 3 Posts
    Blog Entries
    2
    Rep Power
    14

    Script to update manually installed NVidia drivers after kernel updates

    I recently used a script written by an ubuntu forums admin that is supposed to re-compile the nvidia drivers on update.

    here it is:

    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
    then the script called update-nvidia

    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
    Then to make it run on kernel update:

    Code:
    sudo mkdir -p /etc/kernel/postinst.d
    sudo install update-nvidia /etc/kernel/postinst.d
    EDIT: I misunderstood how the script works.Its fine when run by DPKG.

    The original is here HOWTO: Automatically update manually installed NVidia drivers after kernel updates - Ubuntu Forums
    Last edited by llawwehttam; 12th January 2010 at 09:53 AM.

  2. #2
    llawwehttam's Avatar
    Join Date
    Nov 2008
    Location
    Birmingham
    Posts
    223
    Thank Post
    56
    Thanked 3 Times in 3 Posts
    Blog Entries
    2
    Rep Power
    14
    I modified it to be run by the user if DPKG fails to run it during the update.

    My version is

    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
    KERNEL=`uname -r`
    
    # Build new driver if it doesn't exist
    if [ -e /lib/modules/$KERNEL/kernel/drivers/video/nvidia.ko ] ; then
        echo "NVIDIA driver already exists for this kernel." >&2
    else
        echo "Building NVIDIA driver for kernel $KERNEL" >&2
        sh $DRIVER -K -k $KERNEL -s -n 2>1 > /dev/null
    
        if [ -e /lib/modules/$KERNEL/kernel/drivers/video/nvidia.ko ] ; then
            echo "   SUCCESS: Driver installed for kernel $KERNEL" >&2
        else
            echo "   FAILURE: See /var/log/nvidia-installer.log" >&2
        fi
    fi
    
    exit 0
    It appears to be working.
    Last edited by llawwehttam; 12th January 2010 at 09:53 AM.

SHARE:
+ Post New Thread

Similar Threads

  1. ATI / Nvidia drivers & resources here:
    By tarquel in forum Gaming
    Replies: 22
    Last Post: 16th May 2013, 04:23 PM
  2. [Fog] Kernel Update
    By HilcrRWise in forum O/S Deployment
    Replies: 9
    Last Post: 4th August 2010, 05:46 PM
  3. Replies: 16
    Last Post: 23rd February 2009, 01:20 PM
  4. Replies: 3
    Last Post: 13th April 2007, 02:18 PM
  5. Microsoft Update prevents Flash updates
    By ajbritton in forum Windows
    Replies: 0
    Last Post: 15th June 2006, 10:57 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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