I was having the same issue with Dell Vostro 1500 (GeForce 8400M GS) after updating to the recent Ubuntu 16.04.2 and using the
nvidia-340 driver. It took me almost a day to resolve it. Here in shortcut what you can try:
First of all press CTRL+ALT+F1 to get to the text console. Then log in.
cat /var/log/gpu-manager.log. If you see something like this:
Looking for nvidia modules in /lib/modules/4.4.0-72-generic/updates/dkms
Found nvidia module: nvidia_340_uvm.ko
Is nvidia loaded? yes
Was nvidia unloaded? no
Is nvidia blacklisted? yes
Then the reason for the login loop is most likely that the nvidia kernel DRI module is blacklisted. This might be because
bumblebee was previously installed with an older version of the nvidia driver (in my case
nvidia-304) and now is no longer used. If not purge deleted it leaves config files in
/etc, among them also module blacklists. The blacklisted module causes the X server to fail to initialize after logging in, which results in the login loop.
Check whether bumblebee is installed:
apt list --installed | grep bumble
If not (no output of the above command) check if
ls -l /etc/modprobe.d/bumblebee.conf
If it exists just delete it:
sudo rm /etc/modprobe.d/bumblebee.conf
And now try again either by rebooting or by running:
sudo service lightdm restart
You can also see the detailed problem analysis in my other post.