I recently was stuck in an infinite login loop after attempting to install Cuda tookit 8.0 using the runfile method on a linux PC (Ubuntu 14.04) I wanted to share what I learned and how I recovered from it. A lot of posts suggested that you needed to reinstall desktop or even the OS to fix it. I avoided that, but it took a day and half of searching and trying different suggestions. I appreciate any comments on what I might have done wrong initially to cause this to happen and how to fix if it happens again. I have some guesses below.
$ lspci | grep -i nvidia
4b:00.0 VGA compatible controller: NVIDIA Corporation GP102 [TITAN X] (rev a1)
4b:00.1 Audio device: NVIDIA Corporation GP102 HDMI Audio Controller (rev a1)
$ uname -m && cat /etc/*release
DISTRIB_DESCRIPTION=“Ubuntu 14.04.5 LTS”
VERSION=“14.04.5 LTS, Trusty Tahr”
PRETTY_NAME=“Ubuntu 14.04.5 LTS”
$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
$ uname -r
I ran the following:
sudo apt-get install linux-headers-$(uname -r)
I first attempted a deb install and that seemed to work until I tested the deviceQuery code which resulted in FAIL. At that point, I somehow convinced myself from reading other posts that I should have done the runfile install instead. Here is a place where I may have gone wrong. I may not have completely uninstalled the deb package before doing the runfile install, or not done it properly. I recall that I did run sudo apt-get --purge remove cuda but now I am not so sure. At any rate, I then followed the install instructions for the runfile installation. I made the mistake of saying yes to the openGL and the X config options. When I rebooted I was then in an infinite login loop. The desktop would come up and it would show my name and a guest login option. When I typed my password the screen would go black and then come right back with the same prompt for password again.
I saw many posts on similar problems, some were fixed by .Xauthority permission or xorg.conf. Others by simply purging nvidia and re-installing drivers. NONE of this worked for me. I ran the --uninstall option on the runfile and tried to re-install driver by runfile again and not choosing openGL and X options and then tried deb install again after that, everything resulted in same infinite login.
Finally I came across the following post and there was an answer at the bottom that was not upvoted. I tried it along with a deb driver install and I got my system back. The post that I followed to get things to work is below, HOWEVER I used the answer by user Ashu at the bottom of the post which has you interrupt the boot process and type noveau.modeset=0 in the GRUB menu after the linux line.
The only thing I did differently was to use
$ sudo ubuntu-drivers devices
to get a list of nvidia drivers. The recommended one from this list was nvidia-375. I installed that one with sudo apt-get install nvidia-375 instead of the driver mentioned in the post. This got my normal desktop back and got me out of the infinite login loop. Hope this helps someone else.
Then I did a complete uninstall of the runfile install including removing the cuda-8.0 directory manually. Then did a deb install. After deb install, I still had to install the nvidia-375 driver using sudo apt-get install nvidia-375 in order to get the deviceQuery sample code to PASS. It failed immediately after following the deb install instructions at http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#axzz4VWRXgvDF
If anyone can explain why I had so much trouble in the first place, I would love to hear it. Or if I really needed nvidia-375 instead of nvidia-367 to make all this work with TITAN X (Pascal).