I was trying to install the latest NVIDIA graphics driver on a machine. When I ran the installer, it would complain like this:
An NVIDIA kernel module nvidia appears to already be loaded in your kernel
I tried to remove the module:
$ sudo modprobe -r nvidia
But, the kernel complained that the module was being used.
I tried to see which process was using this module:
$ lsof /dev/nvidia*
This showed that no process was using the module. This was surprising.
This is what worked for me in the end. I added a
blacklist nvidia line to
/etc/modprobe.d/blacklist.conf and rebooted the machine.
I then invoked the NVIDIA driver installer with the
--uninstall option. Another reboot later, I found that the module was no longer in the kernel.
I was able to install the NVIDIA driver after that.
Tried with: Ubuntu 14.04