Ubuntu 16.04 login loop with custom NVIDIA driver

The real reason why this happened for me was this: I had NVIDIA custom driver installed which compiles a kernel module underneath and everything was working fine for a moment.

Since it was a fresh install, Ubuntu decided to download some updates and during the upgrade it updated the kernel, and potentially some other libraries that compiled NVIDIA driver was dependent on and that broke their binary compatibility.

At that point after reboot I got stuck in login loop in lightdm, and was unable to run my X sessions with startx also. It looks like upgrade broke compatibility not only with the NVIDIA HW accelerated rendering module, but also SW module, so Unity/Gnome had nothing to render with at all.

To fix this, I just ran the NVIDIA install script that I downloaded once again, and after a recompile things went back to normal. Hope that helps someone.

P.S. I'd like to point out that in my solution returning back to crappy video card drivers was unnecessary.