Apparently it is not an easy task to install nVidia graphic card driver and CUDA toolkit on Ubuntu Linux system. The CUDA package is shipped with its own driver which seems to cause lots of trouble after replacing the default Linux driver. I installed the CUDA toolkit 7.0 by following nVidia’s official website, however it ended up to be an infinite login loop error. I was struggling for almost two days to try to figure out how to do it nicely and properly. There are multiple tutorials and guidelines available on internet but most of them didn’t works for my case and it actually causes me a lots of trouble of rebooting and reinstalling various packages and kernels. Finally, here is the one solution for me. ps: I have a GT 610 for display, Quadro K4200 for CUDA computing.
0) Download relevant CUDA.run file: mine was: cuda_7.0.28_linux.run (cuda_7.5.18_linux.run has hard time of finding my kernel source file, don’t know why)
$sudo apt-get remove --purge nvidia-* && apt-get autoremove $sudo apt-get install build-essential
1) start off with the regular GUI and Ubuntu working with no login problems.
2) No need to create an xorg.conf file. If you have one, remove it (assuming you have a fresh OS install).
$sudo rm /etc/X11/xorg.conf
3) Create the /etc/modprobe.d/blacklist-nouveau.conf file with :
blacklist nouveau options nouveau modeset=0
$sudo update-initramfs -u
4) Reboot computer. Nothing should have changed in loading up menu. You should be taken to the login screen. Once there type: Ctrl + Alt + F1, and login to your user.
5) Go to the directory where you have the CUDA driver, and run
$chmod +x cuda_7.0.28_linux.run
7) Now, run
$sudo service lightdm stop
The top line is a necessary step for installing the driver, it turns off the X window and prevents driver conflicts.
8) Run the CUDA driver run file. Notice to turn OpenGL flags off when install (IMPORTANT):
$sudo bash cuda-7.0.28_linux.run --no-opengl-libs
9) During the install:
Accept EULA conditions
Say YES to installing the NVIDIA driver
Say YES to installing CUDA Toolkit + Driver
Say YES to installing CUDA Samples
10) Installation should be complete. Now check if device nodes are present:
Check if /dev/nvidia* files exist. If they don’t, do :
$sudo modprobe nvidia
11) Set Environment path variables:
$export PATH=/usr/local/cuda-7.0/bin:$PATH $export LD_LIBRARY_PATH=/usr/local/cuda-7.0/lib64:$LD_LIBRARY_PATH
12) Verify the driver version:
13) Check CUDA driver version:
[Optional] At this point you can switch the lightdm back on again by doing:
$sudo service lightdm start
You should be able to login to your session through the GUI without any problems or login-loops.
14) Create CUDA Samples. Go to your NVIDIA_CUDA-7.0_Samples folder and type
15) Go to NVIDIA_CUDA-7.0_Samples/bin/x86_64/linux/release/ for the demos, and do the two standard checks:
to see your graphics card specs and
to check if its operating correctly.
Both tests should ultimately output a ‘PASS’ in your terminal.
16) Reboot. Everything should be ok.