After Upgrade from 14.04 to 16.04 login screen runs in a loop while console login works

I ran into this after updating from 15.10 Wily Werewolf.

I use Nvidia's prime-select command to enable and disable the dedicated graphics card. (After using Ctrl+Alt+F1 and logging into the console) I disabled my GT 540M graphics card with sudo prime-select intel followed by sudo reboot. Upon reboot I was able to log into Unity.

Obviously this is more of a short-term fix and as the other answers have indicated, perhaps the long term solution will be related to replacing or upgrading the Nvidia drivers or allowing the existing unsigned driver to run by disabling secure boot. But hopefully this at least gets you to the desktop!

Edit: The Nvidia driver can now be installed using the official PPA, per this answer:

sudo apt purge nvidia-*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-364

I had the same problem after upgrading from 15.10

What was the problem?

For me, the problem was that UEFI Secure Boot was enabled. The NVIDIA drivers are compiled locally and are therefore not signed.

Ubuntu 16.04 does not allow unsigned kernel modules when Secure Boot is enabled.

I disabled Secure boot, but still, I ended up in a login loop.

Well, that was my own fault. In the meantime I switched to a terminal using Ctrl+Alt+F1 and started an Xserver using sudo. It then changed files in my home directory and set the ownership to root.

After running sudo chown username:username -R /home/username (change all three username to your personal user name) I was able to log in to a normal X session.


I got the same problem after a fresh install.

Ctrl+alt+F1

then

sudo apt-get dist-upgrade

Worked for me.

It looks like there were some packages left behind


I have exactly the same laptop and the same problem. After this command:

sudo apt-get purge nvidia*

I'm able to login again but to my surprise the system is not 16.04. I'm back at 14.04 - absolutely strange.

Update: Actually, I'm running 16.04 but system settings are telling me it's 14.04. And after activating nvidia proprietary drivers the login problem is back again.