Scientific Linux Forum.org



  Reply to this topicStart new topicStart Poll

> Auto update of Nvidia and Ati drivers with a simple script
Trespasser
 Posted: Oct 20 2011, 12:21 AM
Quote Post


SLF Rookie
*

Group: Members
Posts: 18
Member No.: 77
Joined: 20-April 11









Hi,
Not long ago at this site I posted about dkms letting me down big time when a kernel update occurred. Being who I am I became obsessed with finding a solution for this problem. Well, I found it. It's a simple script and procedure that I can verify does work (at least for the Nvidia driver...I'll try the Ati part of it tomorrow). First off, you'll need the build packages installed like kernel-devel, kernel-headers, make, etc. before proceeding. With reference to building an Ati driver I had to have rpm-build installed before it would work for me in the past. I'll probably install it tomorrow just to be on the safe side. This procedure assumes you've already manually installed the Nvidia or Ati driver before hand. The script appears to only kick-in on a kernel update.

Here's the script and the procedure I used...

1) Download the latest Nvidia or Ati package from the respective sites.

2) Move the NVIDIA-*.run or ati-*.run package to /usr/src
mv NVIDIA-Linux-x86-285.05.09.run /usr/src (32bit)
mv NVIDIA-Linux-x86_64-285.05.09.run /usr/src/ (64bit)
mv ati-driver-installer-11-9-x86.x86_64.run /usr/src (32 or 64bit)
3) Create a system-link to the package you just moved. By doing this you can later remove an outdated Nvidia or Ati package with an updated one then you only need to change the system-link to point to the new package. Of course, you have to remove the old system-link afterwards. The script will remain the same.
ln -s /usr/src/NVIDIA-Linux-x86-285.05.09.run /usr/src/nvidia.run (32bit)
ln -s /usr/src/NVIDIA-Linux-x86_64-285.05.09.run /usr/src/nvidia.run (64bit)
ln -s /usr/src/ati-driver-installer-11-8-x86.x86_64.run /usr/src/ati.run (32 or 64bit)
4) Plop this script into gedit and save it as gfx

CODE
#!/bin/bash
# This is the site where I found it...
# http://idolinux.blogspot.com/2010/06/nvidia-ati-graphics-driver-script-for.html
# a script for rebuilding proprietary graphics drivers on boot as needed
# name this script gfx
### To enable this script...
# 1. download the proprietary driver installer from nvidia.com or ati.com and move it to /usr/src/
#  mv NVIDIA-Linux-x86_64-285.05.09.run /usr/src/
#  mv ati-driver-installer-11-9-x86.x86_64.run /usr/src
# 2. create a symlink to the installer as /usr/src/nvidia.run OR /usr/src/ati.run
#  ln -s /usr/src/NVIDIA-Linux-x86_64-285.05.09.run /usr/src/nvidia.run
#  ln -s /usr/src/ati-driver-installer-11-8-x86.x86_64.run /usr/src/ati.run
# 3. move this script to init.d, make it executable and link to runlevel 5
#  mv gfx /etc/init.d/
#  chmod +x /etc/init.d/gfx
#  ln -s /etc/init.d/gfx /etc/rc5.d/S99gfx
# 4. reboot

### NVIDIA driver
#
if [ -f /usr/src/nvidia.run ]; then
{
if [ -f /lib/modules/`uname -r`/kernel/drivers/video/nvidia.ko ]; then
{
echo "NVIDIA DRIVER PRESENT"
/sbin/insmod /lib/modules/`uname -r`/kernel/drivers/video/nvidia.ko
}
else
{
echo "NVIDIA DRIVER UPDATING"
/usr/src/nvidia.run -s
} fi
} fi


### ATI driver
#
if [ -f /usr/src/ati.run ]; then
{
if [ -f /lib/modules/`uname -r`/kernel/drivers/char/drm/fglrx.ko ]; then
{
echo "ATI DRIVER PRESENT"
}
else
{
echo "ATI DRIVER UPDATING"
/usr/src/ati.run
} fi
} fi


5) Move the gfx file to /etc/init.d, make it executable, then link it to runlevel 5.
mv gfx /etc/init.d
chmod +x /etc/init.d/gfx
ln -s /etc/init.d/gfx /etc/rc5.d/S99gfx
6) And that's it.

On the next kernel update this simple script will build a module for you. I let it run thru two kernel updates today and it built a new driver module (nvidia) successfully on both occasions. I can't swear by the Ati part of the script because I haven't tried it yet so use it at your own risk. I'll report back on that section tomorrow.

Like I said before...IT WORKS! http://th166.photobucket.com/albums/u117/rdshear/Smiley%20Faces/th_smiley-face-thumbs-up.gif .

Later....

Bob
PM
^
redman
 Posted: Oct 20 2011, 05:55 AM
Quote Post


Retired SLF Administrator
********

Group: Admins
Posts: 1276
Member No.: 2
Joined: 8-April 11









This sounds VERY interesting, thanks for posting http://th166.photobucket.com/albums/u117/rdshear/Smiley%20Faces/th_smiley-face-thumbs-up.gif

--------------------
"Sometimes the best helping hand you can give is a good, firm push."
PM
^
Trespasser
 Posted: Oct 20 2011, 06:05 PM
Quote Post


SLF Rookie
*

Group: Members
Posts: 18
Member No.: 77
Joined: 20-April 11









Back again...smile.gif

Well, I tried the Ati section of the script and things turned out well the first kernel upgrade but on the second it booted me up to a black screen. I couldn't even boot to Desktop on the previous kernel. I got on my laptop and did some research and found out that if you add the number 3 to the end of the kernel line in grub your system will boot to login prompt. Whew! I then opened /etc/init.d/gfx with nano and added --force ....

### ATI driver
#
if [ -f /usr/src/ati.run ]; then
{
if [ -f /lib/modules/`uname -r`/kernel/drivers/char/drm/fglrx.ko ]; then
{
echo "ATI DRIVER PRESENT"
}
else
{
echo "ATI DRIVER UPDATING"
/usr/src/ati.run --force ##< right here
} fi
} fi

to the script and the module was built successfully on the following reboot.

Things didn't go as easily as the Nvidia build but overall...not bad.

Later...

Bob
PM
^
U308
 Posted: Oct 20 2011, 06:15 PM
Quote Post


SLF Advocate
*****

Group: Members
Posts: 472
Member No.: 32
Joined: 11-April 11









Valuable information for those not installing from the repos.
I think it deserves Pinning status.

Good detective work there Trespasser. smile.gif

PM
^
Trespasser
 Posted: Oct 21 2011, 01:59 AM
Quote Post


SLF Rookie
*

Group: Members
Posts: 18
Member No.: 77
Joined: 20-April 11









I need to mention one thing about the Ati procedure. Ati doesn't have a switch (unlike Nvidia) that assumes yes/ok for every question during the building process once a kernel update occurs. So, as a result, during the bootup process, when the plymouth splash and the progressing ring are taking place, you need to press ESC to enter verbose mode because the ati-installer will execute, display the install process, and wants you to tell it what to do for 4 or 5 steps. I don't see why they don't have a switch you can add that assumes yes as your answer because all I did was press Enter. If you don't enter verbose mode the boot process will just stall there. If you wait too long to enter verbose mode the ati-installer will briefly display "Process aborted" and the screen will go black. But the good news is you can reboot and enter the build process again because no module was built previously. If you're aware of this fact then this procedure works fine.


One could add the argument...

echo "ATI DRIVER UPDATING"
/usr/src/ati.run --buildandinstallpkg RedHat/RHEL6_64a (64bit)
/usr/src/ati.run --buildandinstallpkg RedHat/RHEL6 (32bit)

to the script (I'll try it tomorrow) which should eliminate user input but you need to have rpm-build installed. Also, did you know that whenever you build an rpm package via the Ati installer a copy of that package is saved in /root/rpmbuild as well as in your home folder (~50mbs). I didn't even know it was there until I played around with fslint one day. I was a bit surprised.


It doesn't begin to compare to the Nvidia build process of this script for ease of use (no user input at all), but, hey, it does work.

Later...

Bob
PM
^
Trespasser
 Posted: Oct 21 2011, 04:12 PM
Quote Post


SLF Rookie
*

Group: Members
Posts: 18
Member No.: 77
Joined: 20-April 11









Hi,
I can confirm that if you add one of the following, depending upon whether you're running 32 or 64bit, to the Ati section of the script...

echo "ATI DRIVER UPDATING"
/usr/src/ati.run --buildandinstallpkg RedHat/RHEL6_64a (64bit)
/usr/src/ati.run --buildandinstallpkg RedHat/RHEL6 (32bit)

the ati module will be updated without any user input at all. smile.gif.

Here's the updated script...

http://ShareText.org/BUG7

Please notice that I commented out both of the above entries in the script. You'll need to un-comment the line that corresponds to the type of system you are running (32 or 64bit). Note that the module will not be built unless you do.

You'll also notice that I added the line...

rm -rf /root/rpmbuild

to the script as well. This command removes the rpmbuild folder, which contains the fglrx-*.rpm that I mentioned in my previous post, from the /root folder.

Also, you'll need to install rpm-build, along with the other build packages (kernel-devel, kernel-headers, make, gcc, etc.).

Well, that's about it. Hope this info will help someone. Lord knows I put enough time into it trying to figure it out. biggrin.gif .

Have a good one.

Later...

Bob
PM
^
Trespasser
 Posted: Oct 24 2011, 08:34 PM
Quote Post


SLF Rookie
*

Group: Members
Posts: 18
Member No.: 77
Joined: 20-April 11









Hi,
I found some mistakes in the other script I posted previously but I have hopefully fixed them. The Ati section requires no user input at all, just like the Nvidia section. For the Ati section you need to install the build packages, compat-libstdc++, compat-glibc, as well as rpm-build. You first must build a fglrx package and install it.

For example (as root)...

./ati-driver-installer-11-9-x86.x86_64.run --buildpkg RedHat/RHEL6_64a (64bit)

./ati-driver-installer-11-9-x86.x86_64.run --buildpkg RedHat/RHEL6 (32 bit)

A few more dependencies will be installed at this point.

After that whenever a kernel update takes place this script will automatically build a new module and install it for you. I've tried this script on both Scientific Linux 6.1 and CentOS 6.0 (one kernel update with SL6.1 and two for CentOS 6.0). It worked on both systems.

Here's the updated script...

CODE
#!/bin/bash
# name this script gfx
#
# a script for rebuilding proprietary graphics drivers on boot as needed
#
### To enable this script...
# 1. download the appropriate installer from nvidia.com OR ati.com and move it to /usr/src/
#  mv NVIDIA-Linux-x86-285.05.09.run /usr/src (32bit)
#  mv NVIDIA-Linux-x86_64-285.05.09.run /usr/src/ (64bit)
#  mv ati-driver-installer-11-9-x86.x86_64.run /usr/src (32 or 64bit)
#
# 2. create a symlink to the installer as /usr/src/nvidia.run OR /usr/src/ati.run
#  ln -s /usr/src/NVIDIA-Linux-x86-285.05.09.run /usr/src/nvidia.run (32bit)
#  ln -s /usr/src/NVIDIA-Linux-x86_64-285.05.09.run /usr/src/nvidia.run (64bit)
#  ln -s /usr/src/ati-driver-installer-11-8-x86.x86_64.run /usr/src/ati.run (32 or 64bit)
#
# 3. move this script to init.d, make it executable and link to runlevel 5
#  mv gfx /etc/init.d/
#  chmod +x /etc/init.d/gfx
#  ln -s /etc/init.d/gfx /etc/rc5.d/S99gfx
# 4. reboot

### NVIDIA driver
#
if [ -f /usr/src/nvidia.run ]; then
{
if [ -f /lib/modules/`uname -r`/kernel/drivers/video/nvidia.ko ]; then
{
echo "NVIDIA DRIVER PRESENT"
/sbin/insmod /lib/modules/`uname -r`/kernel/drivers/video/nvidia.ko
}
else
{
echo "NVIDIA DRIVER UPDATING"
/usr/src/nvidia.run -s
} fi
} fi


### ATI driver
#
if [ -f /usr/src/ati.run ]; then
{
if [ -f /lib/modules/`uname -r`/kernel/drivers/char/drm/fglrx.ko ]; then
{
echo "ATI DRIVER PRESENT"
}
else
{
echo "ATI DRIVER UPDATING"
# Make sure to remove the "#" from in front of the system you are running!

# rpm -e --nodeps fglrx_p_i_c # Remove installed fglrx driver (32bit)
# rpm -e --nodeps fglrx64_p_i_c # Remove installed fglrx driver (64bit)

# /usr/src/ati.run --buildandinstallpkg RedHat/RHEL6  #(32bit)
# /usr/src/ati.run --buildandinstallpkg RedHat/RHEL6_64a  #(64bit)
cd /
rm -rf rpmbuild # Remove newly built package in folder
rm -rf *.rpm # Remove newly built package
} fi
} fi


Hope you enjoy it.

Later...

Bob
PM
^
mack_guy911
 Posted: Mar 13 2012, 04:14 PM
Quote Post


SLF Member
***

Group: Members
Posts: 78
Member No.: 81
Joined: 21-April 11









i tried this today confirm its work like charm awesome work best part i like of this way is you can keep your fav working nvidia like new nvidia is pretty slow here as i have old card 8600GT so this is like http://dl.dropbox.com/u/2835777/egyptian.gif for me.

what i did is here hope it help if anyone needed

http://www.wilderssecurity.com/showthread.php?p=2028731

sorry i am not spaming but i cannot type all again wub.gif


last thanks to all for help http://th166.photobucket.com/albums/u117/rdshear/Smiley%20Faces/th_smiley-face-thumbs-up.gif

--------------------
Bhagvad gita verse 20: soul can never be created nor be destroyed, but moves on from one body to another upon death.
Science says : Energy can neither be created or destroyed......it is tranformed from one state to another.

PM
^
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll