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.

If you’re thinking about purchasing a new GPU, we’d greatly appreciate it if you used our Amazon Associate links. The price you pay will be exactly the same, but Amazon provides us with a small commission for each purchase. It’s a simple way to support our site and helps us keep creating useful content for you. Recommended GPUs: RTX 5090, RTX 5080, and RTX 5070. #ad

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.

Be the first to comment

Leave a Reply