I've installed cuda 7 on my 64bit ubuntu 14.04 using this guide. After disabling nouveau drivers following this and rebooting, I needed to disable graphics with Ctrl+Alt+F1, login, and then stop lightdm

sudo stop lightdm

then ran the installer .run file. Installation finished successfully. After installation finished I rebooted with:

sudo  reboot

But after the reboot when I tried to login, the login page reappeared. I have tried almost all the solutions suggested here but nothing changes. More specifically I've tried correcting ownership of .Xauthority, .ICEauthority, and .gvfs. I've tried removing .Xauthority and /tmp. I've tried reconfiguring lightdm with:

dpkg-reconfigure lightdm

and also tried removing and restarting lightdm. But nonof them has worked. What should I do?


1- First, you must uninstall nvidia packages. apt-get purge nvidia-*
2- Try re-install ubuntu-desktop.
3- Reconfigure lightdm package. (dpkg-reconfigure lightdm)
4- Reboot

It must work, if not; try modprobe nouveau to load nouveau kernel module

  • Thank you for the quick reply but neither worked. Is there anyway I can make sure what is causing this problem? – soroosh.strife Jun 5 '15 at 13:22
  • Nope, at least I don't know any – M.Fooladgar Jun 5 '15 at 13:25

I also encounter the same problem. So I switch to TTY (Ctrl+Alt+F1) and created a new user and found out that I can login using the new user. Then I realize that if I use the new user's $HOME/.profile, I can login too. Finally, the problem lies in the $HOME/.profile, LD_LIBRARY_PATH=\*/cuda\*:\*/nvidia\*:$LD_LIBRARY_PATH

It turns out that if your current graphics card is not compatible with the Nvidia driver or CUDA library, login will crash the X session. It seems like a bug in the gnome-session.

Your case might be different though.

My problem now solved.


Do you have an Intel Graphics on your machine? I had the same problem before (HD4600 + NV860M + Ubuntu 14.04), it was caused by overwriting the original opengl of Intel. I have solved the problem with --no-opengl-libs while running the runfile as described in the official documentation (the same as yours).

I also suggest you to reboot to the pure text mode by changing the boot info while choosing the system.

If you have a similar laptop, you can refer to my another answer. I hope you can find your way out soon. I personnally have reinstalled Ubuntu a dozen of times for this, do not give up!


Just wanted to add my five cents here.

I was running a fresh install of Ubuntu 16.04, after installing CUDA 9 I also got stuck in a login loop.

At first I also thought I made a mistake in updating the .profile but it turned out that UEFI secure boot was enabled in the BIOS. This caused 3rd party drivers not to be used. After disabling secure boot every thing worked fine.


Actually, I have also encountered exactly the same problem before. After trying numerous ways, my final conclusion is that if you want to install CUDA using the .run file, do NOT install the bundled Nvidia graphics driver (type "no" when you see the prompt) in the .run file, just install the CUDA library (or maybe the sample code).

If you want to install the driver, follow the standard procedure below:

sudo su
add-apt-repository ppa:graphics-drivers
apt-get update
apt-get install libcuda1-390 nvidia-390-dev nvidia-390 nvidia-libopencl1-390 nvidia-opencl-icd-390

where the *-390 is to be replaced by the latest Nvidia driver version.

I suspect there might be some post-installation scripts to be run after driver installation in order to make it work on X11 desktop. These scripts might not be present in the bundled .run file. You may want to check the X11 crash log at /var/log/Xorg.0.log as well.


I still use Ubuntu 14.04, and my laptop has dedicated Nvidia GE-Force 920M and Intel i915 Hybrid GPU.

I wanted to install CUDA (nvcc) for trying some HPC codes. So, I installed CUDA; following the official way. But, when I rebooted, I was facing the well known Login Loop Problem

I tried all of these ways:

Nothing really worked...

Finally I was able to solve this problem by Un-Doing what I did earlier (which caused the login-loop). I uninstalled Nvidia drivers, and completely purged CUDA:

Uninstall just nvidia-cuda-toolkit

sudo apt-get remove nvidia-cuda-toolkit

Uninstall nvidia-cuda-toolkit and it's dependencies

sudo apt-get remove --auto-remove nvidia-cuda-toolkit

Purging config/data

sudo apt-get purge nvidia-cuda-toolkit


sudo apt-get purge --auto-remove nvidia-cuda-toolkit 

I suggest you to find out what actually caused the problem, and trying to remove it completely might help you, instead of just blindly following all the solutions from Google.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.