03 March 2012

91. Downgrading nvidia drivers from 295.20 to 290.10 on debian testing

How to downgrade your nvidia drivers

WARNING -- you must use the terminal during these steps. If you don't know how to use e.g. cd, ls and nano or vim you will want to be careful:
1. Make sure that you have internet access even without a graphical environment
2. Make sure that you have a basic understanding of how to navigate in the terminal
3. Print out or write down these instructions before startintg

I typically test all my instructions on several different computers as a form of proof-reading. For various reasons I can't do that with this blog post, so read through the instructions first to understand what they do and that typos won't throw you off.

If you've been having the gnome-shell crash bug
[ 7011.967820] gnome-shell[32742]: segfault at 10 ip 00007fa1b6d98c0f sp 00007fa1914a1638 error 6 in libnvidia-tls.so.295.20[7fa1b6d98000+3000]
or the evolution crash bug
[22129.426444] evolution[20435]: segfault at 10 ip 00007f2a05bf8c0f sp 00007f29e5725508 error 6 in libnvidia-tls.so.295.20[7f2a05bf8000+3000]
which are both caused by nvidia driver 295.20, here's how to gracefully downgrade to the previous version of the nvidia driver: 290.10. Be aware that evolution crashes occasionally under 290.10 too, but not nearly as consistently as under 25.20 -- chances are that evolution is a bit buggy on its own.

This will make use of the dkms package, which is what you should use anyway. We'll pull the old stuff from a snapshot archive.

1. Setting up your computer 
I prefer not to be forced to boot into X when I'm mucking about with graphics drivers, so:

Edit your /etc/default/grub
find your
line and add "text" to it e.g.
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset nouveau.modeset=0"
GRUB_CMDLINE_LINUX_DEFAULT="text nomodeset nouveau.modeset=0"
sudo update-grub

Now is a good time to do a reboot to see if you have internet in text-only mode. 
sudo shutdown -r now
To start your graphical environment again do 

2. Set up snapshot archive
To your /etc/apt/sources.list add this line:
deb http://snapshot.debian.org/archive/debian/20120120T092809Z/ wheezy main contrib non-free
Also, create a
file with the following in it:
Check-Valid-Until "false";
sudo apt-get update
Don't install anything yet.

3. Get the nvidia binary driver
Go to e.g. ~/tmp and
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/290.10/NVIDIA-Linux-x86_64-290.10.run
chmod +x NVIDIA-Linux-x86_64-290.10.run

Don't forget where you put it.

4. Remove your existing drivers and packages:
First reboot:
sudo shutdown -r now
You'll now boot into a text-only environment, so you had better printed this out first.

sudo apt-get autoremove nvidia-*
The following packages will be REMOVED:
  diffstat glx-alternative-mesa glx-alternative-nvidia glx-diversions libcublas4 libcuda1 libcudart4 libcufft4
  libcurand4 libcusparse4 libgl1-nvidia-alternatives libgl1-nvidia-glx libglx-nvidia-alternatives libnpp4
  libthrust-dev libvdpau-dev nvidia-alternative nvidia-glx nvidia-installer-cleanup nvidia-kernel-common
  nvidia-kernel-dkms nvidia-support nvidia-vdpau-driver opencl-headers quilt xserver-xorg-video-nvidia
0 upgraded, 0 newly installed, 26 to remove and 3 not upgraded.
After this operation, 435 MB disk space will be freed.
Do you want to continue [Y/n]?Y
Reboot for good luck:
sudo shutdown -r now

If you do
locate nvidia.ko
chances are you'll find
where 3.2.9 is the current kernel version.

sudo updatedb
locate nvidia.ko
to make sure that the nvidia.ko is gone from your current kernel.

5. Install your old nvidia driver:
Go to the directory you downloaded the driver in, e.g. ~/tmp
sudo ./NVIDIA-Linux-x86_64-290.10.run
Reboot afterwards:
sudo shutdown -r now

After the reboot do

Did it work? If yes, you're in good shape.
 dmesg | grep nvidia
[    7.540166] nvidia: module license 'NVIDIA' taints kernel.
[    8.509525] nvidia 0000:01:00.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18
[    8.509600] nvidia 0000:01:00.0: setting latency timer to 64
6. Setting up the kernel-dkms
You really want to use dkms so that you don't have re-install the graphics driver each time you upgrade your kernel.

First check
apt-cache showpkg nvidia-kernel-dkms
295.20-1 - nvidia-kernel-295.20
290.10-1 - nvidia-kernel-290.10
195.36.31-6 - nvidia-kernel-195.36.31

OK, time to get rocking:
sudo apt-get install nvidia-kernel-dkms=290.10-1 nvidia-glx=290.10-1 libgl1-nvidia-glx=290.10-1 xserver-xorg-video-nvidia=290.10-1 nvidia-vdpau-driver=290.10-1 nvidia-alternative=290.10-1

You'll be warned about remove nvidia-install etc. That's fine.

Once the installation is done it's time to put holds on the packages so they don't accidentally upgrade

sudo su
echo "nvidia-kernel-dkms hold"| dpkg --set-selections
echo "nvidia-glx hold"| dpkg --set-selections
echo "libgl1-nvidia-glx hold"| dpkg --set-selections
echo "xserver-xorg-video-nvidia hold"| dpkg --set-selections
echo "nvidia-vdpau-driver hold"| dpkg --set-selections
echo "nvidia-alternative hold"| dpkg --set-selections

7. Cleaning up
Things to do:
a. comment out the snapshot in /etc/apt/sources.list
b. move the /etc/apt/apt.conf.d/60ignore_repo_date_check file out of the way
c. sudo apt-get upgrade
Reading package lists... Done
Building dependency tree    
Reading state information... Done
The following packages have been kept back:
  libgl1-nvidia-glx nvidia-alternative nvidia-glx
  nvidia-kernel-dkms nvidia-vdpau-driver xserver-xorg-video-nvidia
d. edit your /etc/default/grub and remove the "text" item you added.
e. Run sudo update-grub
f. You can now reboot and your computer will be back to normal, sans nvidia 295.20


8. In the future
Once it is safe to upgrade, all you need to do is

sudo su
echo "nvidia-kernel-dkms install"| dpkg --set-selections
echo "nvidia-glx install"| dpkg --set-selections
echo "libgl1-nvidia-glx install"| dpkg --set-selections
echo "xserver-xorg-video-nvidia install"| dpkg --set-selections
echo "nvidia-vdpau-driver install"| dpkg --set-selections
echo "nvidia-alternative install"| dpkg --set-selections
sudo apt-get update && sudo apt-get upgrade

Links to this post:


  1. Thanks for this great walkthrough, very very useful!
    There might be something wrong in step 6 and 8. Looks like you renamed some packages:
    nvidia-glx -> nvidia-kernel-glx
    xserver-xorg-video-nvidia -> xserver-xorg-nvidia
    Apart from that, great stuff!

    1. I think you may be right -- I can't find any
      nvidia-kernel-glx or xserver-xorg-nvidia in the repos either, and google doesn't indicate that these packages ever existed.

      It's been a while, but this is what I get for
      dpkg --get-selections|grep hold
      libgl1-nvidia-glx:amd64 hold
      nvidia-alternative hold
      nvidia-kernel-dkms hold
      nvidia-vdpau-driver:amd64 hold

      Cheers for letting me know!

  2. Thanks for this great documentation.
    After upgrading to Wheezy I have issues with Gnome and evolution as well but I am not quit sure if they are related to this post.
    I am running Nvidia drivers (295.40-1) for my X1400 as well.
    If im trying to start evolution I get:

    (gdb) run
    Starting program: /usr/bin/evolution
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

    Program received signal SIGSEGV, Segmentation fault.
    0x00007fffee7d99c0 in ?? () from /lib/x86_64-linux-gnu/libc.so.6

    dmesg reports
    evolution[6472]: segfault at ffff808e2fbe330e ip 00007f71722619c0 sp 00007fff40ff2018 error 4 in libc-2.13.so[7f7172144000+17d000]

    Different to your statement that
    strace -o evolution.log evolution

    will not crash I get a SIGSEGV (Segmentation fault) here as well.

    Do you have any recommendations what to do?
    Do you think a driver downgrade will help here as well?

    Thanks Nic

    1. Hi Nic,
      my gut feeling is that this is unrelated -- what linked the evolution crash to nvidia was the nvidia-tls message. Do you have any indication that this relates to your nvidia drivers?

      It reminds me more of a problem I had which arrived after an update and was more or less solved by (windows flashback) simply rebooting.

      You should try starting evolution from the command line with
      CAMEL_DEBUG=all evolution >& evo.log

      See if it goes through the same steps before each crash.

    2. Thanks for you answer,
      I have no indication that it is related to nvidia.
      I struggled with nvidia driver, gnome startup (still not possible) before and was wondering if these issues could be releated. Your post was the first one which came up entering all the keyword in google.

      As you recommend I executed
      CAMEL_DEBUG=all evolution >& /tmp/evo.log
      and surprisingly the file ('evo.log') is completely empty.
      The only statement below this line is'segementation fault'.

    3. Do you see stuff fly by in the terminal if you just start using
      CAMEL_DEBUG=all evolution

      Or is it all just misery and instant segfault?

      Unless you see an indication that it's connected to the nvidia drivers I probably wouldn't go through the hassle of downgrading them.