How to solve 'ERROR: An NVIDIA kernel module 'nvidia-uvm' appears to already be loaded in your kernel'?

I'm trying to install cuda 10 on my ubuntu, I already have nvidia-cuda-toolkit 9.2 so this should be an upgrade

I download the installation self-extractor and execute it:

sudo ./cuda_10.0.130_410.48_linux.run 

However, when I finished all options, the following error was thrown.

ERROR: An NVIDIA kernel module 'nvidia-uvm' appears to already be loaded in your kernel.  This may be because it is in use (for example, by an X server, a CUDA program, or the NVIDIA Persistence Daemon), but this may also happen if your kernel was configured without support for module unloading.  Please be sure to exit any programs that may be using the GPU(s) before attempting to upgrade your driver.  If no GPU-based programs are running, you know that your kernel supports module unloading, and you still receive this message, then an error may have occured that has corrupted an NVIDIA kernel module's usage count, for which the simplest remedy is to reboot your computer.
ERROR: Installation has failed.  Please see the file '/var/log/nvidia-installer.log' for details.  You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

This error has never been encountered when I installed nvidia-cuda-toolkit 9.2 (despite that nvidia driver is always used). Why the latest version is unable to handle such situation? Is the support of cuda 10 for ubuntu bad?

environment:

  • ubuntu 18.04
  • nvidia-driver-410
  • nvidia-cuda-toolkit 9.2
  • no bbswitch is used

I also encountered the same problem. The reason for the error was that I accidentally selected "Install nvidia driver" during the installation of cuda.

So, during the installation of CUDA, when you encounter the following options:

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81? (y)es/(n)o/(q)uit:

Please select q , the problem will be solved.


I ran /usr/bin/nvidia-uninstall and then I could install the driver