Nvidia driver issue on Kubuntu 12.05

I’d upgraded Kubuntu 11.10 to 12.05, then accidentally run the Nvidia installer, overwriting my kernel module with an older module. At boot, I got the following error message:

NVRM: API mismatch-client has version 295.20 while module has version 295.40
No screens found, X cannot start. Some configurations were found but were unusable.

I could not reinstaller the NVidia installer again.

Found out the kernel module location:

[[email protected] ~]$ modprobe -l |grep nvidiakernel/drivers/video/nvidia/nvidiafb.ko
[[email protected] ~]$ ls -l /lib/modules/
total 12
drwxr-xr-x 3 root root 4096 May 8 06:47 3.0.0-12-generic
drwxr-xr-x 5 root root 4096 May 8 23:05 3.0.0-19-generic
drwxr-xr-x 5 root root 4096 May 8 23:06 3.2.0-24-generic
[[email protected] ~]$ sudo mv /lib/modules/3.2.0-24-generic/kernel/drivers/video/nvidia nvidia_old/
[[email protected] ~]$ sudo mv /lib/modules/3.2.0-24-generic/kernel/drivers/vi nvidia_old/video/ virtio/
[[email protected] ~]$ sudo mv /lib/modules/3.2.0-24-generic/kernel/drivers/video/nvidia.ko nvidia_old/
Load muon software installer and uninstall the Nvidia package.

Running the command:

dkpg-reconfigure xserver-xorg[/code]
will fix your
xorg.conf if you mess it up, but it won't fix the API mismatch (via http://ubuntuforums.org/showthread.php?t=650161)

Update: The above did not work for me this time. After purging the module, and downloading and reinstalling the Nvidia official installation, the system gave me the ubiquitous green and black screen.

What I did to solve my issue:
Boot into recovery root shell.

dpkg --purge nvidia-*[/code]
It will give a warning that nvidia-common cannot be uninstalled due to dependency issues, but that's fine.

Boot into recovery, then into graphical screen.
Open muon software installer and install the current driver.
If you're using apt, it will be:

apt-get install nvidia-current[/code]

reboot and you're good to go!


Update on the issue:

The issue recurred a few weeks later. I dont remember modifying anything in Ubuntu at the time, but somehow I got the same message that the kernel module conflicted with an API. I tried:

dpkg --purge nvidia*

But it said nvidia-common could not be removed as it was a dependency for KDE. I forced a purge with:

dpkg --purge --force-all nvidia*

Rebooting would not have started nvidia, so I rebooted to recovery and resumed.

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.