Sandipt’s suggestion is totally correct. I have figured it out by following a few steps. I met the same problem like you.
first of all. you need to uninstall all nVidia drivers, especially the culprit nvidia-331-uvm. 1) uninstall both cuda and nvidia driver by :
1)To uninstall the CUDA Toolkit, run the uninstallation script provided in the bin directory of the toolkit. By default, it is located in /usr/local/cuda-7.0/bin:
$ sudo /usr/local/cuda-7.0/bin/uninstall_cuda_7.0.pl
2)To uninstall the NVIDIA Driver, run nvidia-uninstall:
$ sudo /usr/bin/nvidia-uninstall
- be sure to use apt-get to remove all nvidia-*
sudo apt-get remove --purge nvidia-*
in step 3) because all your drivers have been removed, you might need a default driver for your X. refer to this thread for. You’d better confirm if it’s successfully removed by sudo find it from /.
during the uninstall of nvidia driver, you might need to consider of disable of nouveau, which is also the requirement of CUDA installation.
Be sure all the above jobs are done in text mode, including the reinstall of CUDA. refer to this blog on how to enter text mode, which is quite helpful.
don’t forget to update your grub by ‘sudo update-grub’
After all these jobs done, I believe you will have no any problem of CUDA, of course, those two environment variables and LD_LIBRARY_PATH need to be set up correctly.
then you can go to the folder where you deposit the 7.0 CUDA tools kits, it will also install the nvidia driver together. you can test the deviceQuery in text mode without reboot if you have pre-compiled them.
reinstall grub and update grub will get you back to X.