How I solved my nVidia driver kernel module API mismatch problem.

I recently ran into a problem with my proprietary nvidia video driver on Ubuntu Linux 9.04.  It seems that there was a conflict between the driver I downloaded directly from and the driver installed by Ubuntu’s restricted driver manger (found on the gnome System menu under Administration | Hardware Drivers).  The problem was that the kernel module API installed by Ubuntu did not match the driver installed by the installer I downloaded and the end result was that my screen was completely black/blank and no tty’s worked so pressing Ctrl+Alt+F[1-6] wouldn’t take me to a terminal.  (Executing dmesg at a command prompt would show messages indicating that there was an API mismatch.  This message would also be shown by running “startx” at the command prompt.)

Simply pressing the power button once was sufficient to get Ubuntu to gracefully shutdown the machine, thankfully.  After powering back up I selected the recovery item on the grub boot menu to boot into a root console.  If you don’t have a recovery menu item then add “single” (without the quotes) to the kernel command line in the grub menu and boot from there.  From the root console I did three things: I uninstalled the nvidia drivers that I manually installed earlier (that broke my system), I unloaded the nvidia kernel module, and then I manually searched for and removed all nvidia kernel modules.

Uninstalling the nvidia drivers I installed manually was easy.  All I had to do was run “nvidia-installer --uninstall”.  I got a waring because I was running in single user mode so I had to tell the installer to proceed anyway and it worked fine.  You will also get an error if X is running.  To terminate X you need to kill gdm by executing “/etc/init.d/gdm stop” as root, however it should not be running if you booted into the recovery console.

Unloading the nvidia kernel module was easy.  Simply execute “rmmod nvidia” as root.

Searching for and removing all nvidia kernel modules was tedious, but also easy.  This procedure is not the ideal solution, but I had no working video or networking and had to take relatively drastic measures.  First I had to find all the drivers.  I did this by executing “find / -type f 2> /dev/null | grep -i nvidia | grep -i \\.ko” as root.  This generated output similar to this:


Then I manually removed each kernel module by using the “rm -f <pathname_of_file>” command.

Finally I reran the nvidia installer, did a full install of the video driver, and then rebooted the machine by executing the “reboot” command as root.  When the machine finished booting I had video back and all was well in my world again.


, , , , , , , ,

  1. #1 by babagau on August 16, 2010 - 10:07 pm

    thanks, have same problem now, you gave me a clue!

  2. #2 by Omar Qureshi on February 4, 2011 - 7:00 pm

    Nice tip – to avoid yourself from having to rm -f everything, you could have done:

    find / -type f 2> /dev/null | grep -i nvidia | grep -i \\.ko | xargs rm -f

    That will take care of them all in one swoop!

  3. #3 by Edgar on August 7, 2011 - 4:30 am

    I was wondering why what I was doing wasn’t working … you pointed out a step I was missing. Thanks a lot

  4. #4 by Adam on October 1, 2011 - 2:05 am

    I ran into the same problem and this got me back on track.

    I also added :

    | grep -i `uname -r`

    …to only remove those from the current release.


  5. #5 by Tim on November 2, 2011 - 7:06 pm

    This really helped me out with the issues I was having with the latest nvidia drivers on Ubuntu 11.11. Thanks!

  6. #6 by Mr Sheen on February 1, 2012 - 5:23 pm

    Big thank you from London.
    ubuntu 11.10, needed nvidia official drivers, but compatability issues with ubuntus own drivers.

    thanks also to Omar for
    find / -type f 2> /dev/null | grep -i nvidia | grep -i \\.ko | sudo xargs rm -f

  7. #7 by Anonymouse on August 11, 2013 - 6:13 pm

    I just had the same problem with FreeBSD 9.1 after upgrading ports. No need to reboot, just need to unload and load the nvidia module again because the kernel still has the old one. No need to go through all the steps. After the upgrade, simply:
    /usr/local/etc/rc.d/gdm stop
    kldunload nvidia.ko
    kldload nvidia.ko
    /usr/local/etc/rc.d/gdm start

    And you’re done.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: