Ubuntu – How to install CUDA 8.0 on Ubuntu 16.04 with Nvidia GeForce GTX 1080


I am attempting to install CUDA 8.0 within Ubuntu 16.04 for the Nvidia GeForce GTX 1080. I had CUDA 7.5 installed, but it did not appear to be compatible with the GTX 1080. I downloaded the .run installer from Nvidia's developer page, but the installation fails and outputs the following to a nvidia-installer.log

   An NVIDIA kernel module 'nvidia-drm' 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.

I have rebooted the computer, but that did not resolve the problem. How do I unload the 'nvidia-drm' module so that I can install the 8.0 CUDA?

Best Answer

From reading your log, it appears you are attempting to install your Cuda driver whilst your start X is running and thus using your gpu.

You need to stop it from using your GPU first:

  • Remove the current drivers: sudo apt-get purge nvidia-cuda*

  • (optional) - If you want to install the drivers too, then run: sudo apt-get purge nvidia-*

  • Logout from your GUI(Your not logging out is the reason you are getting the error message). To logout, press ctrl + alt + F2.

  • Stop lightdm: sudo service lightdm stop

  • Now you can go ahead and install the drivers, in your case you will have to run something like: sudo sh cuda_8.0.18_linux.run (replace cuda_8.0.18_linux.run with your .run file's name).

  • NB: You need to make sure that you select/agree the option to create a symbolic link.

  • when the installation finishes, reboot your machine: sudo reboot

Related Question