Tuesday, June 2, 2015

Ubuntu 14.04: Install NVIDIA driver


sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get install nvidia-364

If ./devicequery runs only with sudo:

Try executing:
1) modprobe nvidia (or nvidia-331, or nvidia-current, whatever the name of the module is)
and run ./deviceQuery ... does it work now?

2) sudo nvidia-smi
and run ./deviceQuery ... does it work now?

3) sudo ./deviceQuery
does it work now?


I use Nvidia drivers from nvidia-331 package from official Ubuntu repository on Ubuntu 14.04.2.
Recently something changed in drivers packages and CUDA stopped working, the symptom was error 30 ("Unknown error") in first CUDA-related operation.
After some debugging I investigated that problem was with missing nvidia_uvm kernel module. Check that it is loaded:
$ lsmod | grep nvidia
nvidia_uvm             34855  0 
nvidia              10744943  84 nvidia_uvm
drm                   303102  2 nvidia
If it's not loaded, check that you have installed appropriate package, for 331 version it is nvidia-331-uvm:
sudo apt-get install nvidia-331-uvm
But this is not enough: nvidia_uvm can't be loaded in straightforward way (e.g. by running modprobe nvidia_uvm), you need to either run you program as root (once, then module will be loaded and root permissions will no longer be required), or (recommended) install nvidia-modprobe package and reboot:
sudo apt-get install nvidia-modprobe



To fix:  /usr/local/lib/libcudnn.so.6.5 is not a symbolic link

rename /usr/local/lib/libcudnn.so.6.5, because the symbolic link of that lib has been defined in the /usr/local/cuda-6.5/lib64, so there a duplication occurs in /user/local/lib

Cannot load libcuda...


32-bit: sudo ldconfig /usr/local/cuda/lib
64-bit: sudo ldconfig /usr/local/cuda/lib64


create a nvidia_settings.conf file in /etc/ld.so.conf.d/ and add the path to the libs in the file nvidia_settings.conf
Now to update the changes run the following command:
sudo ldconfig


  1. http://stackoverflow.com/questions/32408264/how-can-i-compile-a-cuda-application-that-targets-both-kepler-and-maxwell-archit

  2. http://askubuntu.com/questions/731990/gpu-manager-overwrites-xorg-conf