How to Fix the Infinite Login Loop on Ubuntu 18.04

We recently turned on an Ubuntu machine which has been off for a while. It booted up ok, but I could not logon to the machine even I knew the password. After I entered the password, the screen flashed once and back to the login screen. If I entered the password again, same thing happened again.

I googled the problem and found that it could be caused by the permissions of files in your home directory. The other possible cause is the package conflict.

This is what I did to get the machine back to normal

  • Shutdown the machine.
  • Turn the machine on. At the grub screen select Advanced Options for Ubuntu and press enter.
  • At the next screen, select the entry with (recovery mode) and press enter.
  • Select dpkg to repair broken packages and press enter. Wait until the process is done.
  • Select root to drop to root shell prompt and press enter.
  • Enter the following commands. (replace the user_name with your user name)
    chown -R user_name:uer_name /home/user_name
    apt update
    apt upgrade
    apt autoremove
  • Finally enter reboot to reboot the machine.

Does this fix your infinite login loop problem? Share your experience in the comment section.


This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.