I had this and after looking at
/var/log/Xorg.0.log I found out that it’s a Nvidia problem (there was a line saying
Xlib: extension "GLX" missing on display ":0).
I realized I have Nvidia drivers from official website which are not really stable and tested (so I’ve read and also experienced in the past).
The solution here was to install package
nvidia-current from Ubuntu repos; it is an awfully outdated version, but it’s tested properly at least. Its installer is quite capable too and it uninstalled successfully my hack-installed unstable version from Nvidia website.
TL;DR, just try logging into the shell (Ctrl+Alt+F2 or whatever F between F1 and F6) and type
sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt update sudo apt install nvidia-367
If it succeeds, reboot.
If you’re lucky enough, problem solved, you should be able to login to Unity.
Please note that sometimes
nvidia-current might install the wrong driver. In that case, search the latest compatible driver for your video card and install it. For example, on Ubuntu 16.04,
nvidia-current points to the version: 304.131-0ubuntu3. This might be incompatible with your graphics card; therefore, search with
sudo apt-cache search nvidia-[0-9]+$ for the package you need, and install it.