Random crash of the X server in Jaunty

I experienced a lot of random X server crashes using the proprietary driver for the NVIDIA graphic card on my Thinkpad T61 running Ubuntu 9.04 x86 with Compiz activated.
I managed to fix the problem by installing the lastest NVIDIA driver. I wrote a little script to automate the process and save time. I recommend you to run this in command line mode. Here it is:

#!/bin/bash
 
# Check if the X server is running
pid_of_X=`ps aux | grep X | grep -v 'grep' | grep root | awk '{ print $2 }'`
 
if [ -z "$pid_of_X" ];
  then
    echo -e '\n\n\n\n\n\n\n\n\n'
    echo -e 'X is not running! - Good!\n'
	# Stop the xserver (GDM)
	sudo /etc/init.d/gdm stop
	cd $HOME/Desktop
 
	if [ -e latest.txt ]; # Check for 'latest.txt' file
	  then
	    rm -f latest.txt
	fi
 
	if [ -e NVIDIA-Linux-x86-* ]; # Check for 'NVIDIA-Linux-x86-*' file
	  then
	    rm -f NVIDIA-Linux-x86-*
	fi
 
	# Get the latest driver from NVIDIA's ftp
	nvidia_ftp='ftp://download.nvidia.com/XFree86/Linux-x86'
	wget -c -T 10 $nvidia_ftp/latest.txt
 
	new_driver_version=`cat latest.txt | awk '{ print $1 }'`
	new_driver_filename=`cat latest.txt | awk '{ print $2 }'`
 
	wget -c -T 10 $nvidia_ftp/$new_driver_filename
 
	chmod +x $HOME/Desktop/NVIDIA-Linux-x86-*
 
	# Remove all nvidia* packages in the system
	sudo dpkg -l | grep nvidia | awk '{ print $2 }' | xargs sudo aptitude -y purge
 
	# Remove all the nvidia kernel objects currently installed
	export kernel_version=`uname -r`
	sudo rm -f `find /lib/modules/$kernel_version -iname nvidia.ko`
 
	# Install the new driver
	sudo sh $HOME/Desktop/NVIDIA-Linux-x86-*.run
 
	rm -f NVIDIA-Linux-x86-*
	rm -f latest.txt
 
	echo -e '\n\n\n\n\n\n\n\n\n'
	echo -e '---------\n'
	echo -e 'All done!\n'
	echo -e 'Starting GDM in 5 seconds...\n'
	sleep 5
 
	# Start GDM
	sudo /etc/init.d/gdm start
 
  else
    echo -e '\n\n\n\n\n\n\n\n\n'
    echo -e 'X is running!\n'
    echo -e 'You should run this script in console mode!\n'
 
    echo -e 'Press CTRL+ALT+F1 to go to console mode, then run this script again!\n'
    echo -e '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'
    echo -e 'Aborting in 5 seconds!'
    echo -e '\n\n\n\n\n\n\n\n\n'
    sleep 5
    exit 0
fi

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close