Ubuntu and black screen log in loop

Posted on: May 1st, 2018
Category: General, Linux
Tags: , ,

Issue is very straight forward, system boots up, we see the greeter, and after logging in… nothing, a black screen (sometimes there is flickering). After a short time it will come back to the greeter with option to log in, “again”, but if we try to do that the process repeats; hence why the issue is sometimes being referred to as “black screen loop”.

Personally I experienced this on Ubuntu Gnome 16.04 (multiple times, for “sort of” different reasons), but quick search can show that the problem goes back to Ubuntu 12 and the same solutions works with 14.04 and 16.04.

Pre-solution
There is not much one can do about this problem when in the greeter, so before we can start troubleshooting or testing fixes, we need to get console access. In order to be able to start typing commands, use `ctrl + alt + f2`, it will open console with login prompt (it should be possible to login, black screen issue doesn’t affect this mode).

Solution 1
First and probably the most popular source of the problem is unfinished/corrupted installation of updates. Something went wrong during dpkg’s (Debian’s package manager) activity and there are problems with configurations. To fix that we can order the system to do a configuration of unpacked, unconfigured packages:

sudo dpkg --configure -a

After executing the command we can see a growing list of packages which are being configured – it may take a moment, be patient. It’s good to follow with `apt` update and upgrade, everything should just fine after reboot.

For full list of commands visit the source of the solution, Seravo blog.

Solution 2
A corrupted configuration may be as bad as no configuration, in this case it’s likely that desktop environment has been affected by an update. We could install different DE, next to the current one, but reconfiguration is worth a try:

sudo dpkg-reconfigure

where `` is shortcut for you current DE (e.g. gdm3 for Gnome3, kdm for KDE, lightdm for LightDM). Depending on DE there might be some questions regarding configuration, just like with a fresh install. After reboot logging in may be possible again.

Remember that it’s destructive move and your current configuration will be wiped in favour of clean one.

Solution 3
Sometimes issues may be coming from X server or a component which i causing it to fail. It’s broad issue and there is no single solution to all the problems that may come. Good point to start is:

startx

It will (try to) spawn a single session for window interface, which may provide useful error message. I also encountered different scenario which would do “nothing” for an extended period of time, with black screen (just like the black screen loop after logging with DE) and eventually return to the console. After reboot, DE was able to start normally after log in. It’s a long shot, but worth giving a try if nothing else helped – best case scenario you will be able to log in, worst you will get an error to investigate.

Solution X
Above solutions worked for me. However, there are other sources of the issue I (fortunately) didn’t have to investigate, like proprietary GPU drivers or kernel-drivers mismatch.
Good luck.