Ubuntu Login Screen Loop

The Problem

I was suddenly locked out of my computer and I was stuck at the login screen. First I enter my credentials, and once approved, I get a black screen. Then, It keeps on displaying the login screen again asking for credentials.

The Solution

I have googled many solutions and only one was particular to my case. I will share it with you, so it may save you some trouble in the future.

First of all, press Alt+Ctrl+F3 and login to the terminal using your credentials.

A post on Ubuntu suggested changing the owner of /tmp using

$ sudo chown my-user-name /tmp

Another post suggested checking the permissions of the /tmp using

$ ls -ld /tmp
$ sudo chmod a+wt /tmp

Another one suggested changing the owner and permissions of .Xauthority using

$ sudo chmod 777 .Xauthority
$ sudo chown my-user-name .Xauthority

Another one suggested to reconfigure the login service lightdm using

$ sudo dpkg-reconfigure lightdm

Then after each trial, one should restart the login service using

$ sudo service lightdm restart

The one that pinged with me was trying to change the lightdm to gdm using

$ sudo apt-get install gdm

Even though I haven’t done that, but I received an error message suggested that I don’t have any remaining disk space on my machine.

I have quickly recalled downloading a dozen of docker images to play with.

The following command gives disk usage information in a human readable format

$ df -h

The following command gives the total disk usage by a certail directory

$ du -sh /var/lib/docker

The following command gets the docker images with storage info

$ docker images

The following command gets the dangling images

$ docker images -f dangling=true

The following command removes the dangling images

$ docker images -f dangling=true | xargs docker rmi

The winning horse in this racing was this command

$ find / -size +100M

I found a virtual box machine file that went beyond 10GB because I was using it as a sandbox for trying docker images. I have deleted it and I restarted the lightdm, and here I’m writing this blog to share this experience.


Docker is a very easy way to have applications up and running in no time, but be careful when it comes to pulling images from the registry. One can get very excited and keep on pulling images to try, but always remember either:

  1. Only download the images you need the most
  2. Redirect Docker to save images on another disk partition
  3. Kill dangling images and containers


  1. 10 Useful du (Disk Usage) Commands to Find Disk Usage of Files and Directories
  2. Ask Ubuntu: No space left on left on Drive after deleting everything. /dev/sda6 100% used
  3. Ask Ubuntu: Ubuntu gets stuck in a login loop
  4. Remove dangling docker images

One thought on “Ubuntu Login Screen Loop

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s