Stuck in login loop, but only for one user

id flag

I was working on my Lenovo Idea Pad with Ubuntu when suddenly the screen froze, I could move the mouse and see the cursor moving, but clicking or pressing the keyboard keys had no effect, so I decided to reboot the computer holding the physical power button.

When the computer turned on again, I was presented with the login screen as usual, I choose my user and entered my password. The screen then became black and after a few seconds I was again in the same login screen. I tried several more times and the same happened. I tried entering a wrong password and the message of invalid password correctly appeared.

I searched in many sites and I found a bunch of people in my same situation, and every article or answer in Ask Ubuntu points to one of 4 solutions:

  1. problems with .Xauthority file
  2. problems with tmp folder
  3. problems with not enough disk space
  4. problems with gdm or lightdm

For number 1), I couldn't even try the proposed solutions because I don't have any file with that name. So I ignored that situation.

For number 2), I triple checked and I have the correct permissions for that folder, so that can't be the problem either.

For number 3), I checked several times and I have plenty of free space in my disk and partition (69% full). Still, I removed several videos using the console in order to free more space, just in case, but it didn't work either.

For number 4), I tried removing and reinstalling and reconfiguring both GDM3 (that was the package I was using) and LightDM, and nothing changed, I get the exact same problem with both.

One strange thing is, I have two users for this computer. My main user is the one having problems. But if I try to log in with the other user, it just works ok.

Any idea of what can I Do? I already checked this question Ubuntu gets stuck in a login loop and other similar to that one.

Disk space proof Tmp has the correct permissions tried both lightmd and gmd3 No . Xauthority file proof

Update 1:

If someone finds himself in the same situation, I discovered that I can log in to the user without the problem via UI, then from there go to the power menu and choose "Switch user" (right near "log out", below the Suspend, Restart and Power Of options). After choosing "Switch user" I was able to login to my main user (the one with the loop problem) normally, via the UI.

Update 2: Solution

Using @user10489's method, I was able to find the problem: I put all my hidden files from the home folder into a "broken" folder and then I was able to login normally. So then I restored all the hidden files and tried moving them to the broken folder one by one, each time trying to login to see where it broke. It turned out that I had an extra line in my .profile file that was miswritten and that was causing the login issue.

hr flag
I do see a `.Xauthority` file in your last screenshot - and also a `.xsession-errors`. The output of `cat ~/.xsession-errors` might be helpful.
Geropellicer avatar
id flag
@steeldriver right. At first when I saw your comment I couldn't believe it, because I had triple-checked and neither of those files were there before the photo! I thought I was crazy until I ran `cat ~/.xsession-errors` and all the error are lightdm related. So what happened is: when I first was getting this error those files didn't exist. When I was trying one of several solutions, I installed ligthdm (I was using gdm3 prior to that) and when I did that, that created those files. So they don't have any information regarding these errors.
in flag

Problems with .Xauthority only affect X11. If you are using Wayland, it does it differently, so if you don't have that file, likely you are using Wayland.

You not only have to check free disk space, but your disk quota. Shared systems sometimes set disk quotas so that a single user can't fill up the disk, spoiling things for everyone else. If you don't have a system administrator or they don't try to deal with fair resource allocation, you may not have a disk quota.

There are many possible problems with the graphical environment. If it works for other users, then reinstalling and reconfiguring is pointless, because there is nothing wrong with the system installation of them.

Checking if other users can log in is a very good diagnosis tool.

This points to one of two possibilities -- either the user who can't log in is using a different desktop environment than everyone else and it is broken (and needs reinstalling or reconfiguring), or, more likely there is something broken in that user's account and nobody else's.

First, check that the problem user doesn't have any stray programs running (like an insane dbus daemon) that may be breaking their desktop (or taking up memory and causing them to reach per-user memory limits before they are fully logged in).

If there is nothing of theirs running when they are not logged in, then it is likely one or more configuration files in their account are corrupt. When I encounter this situation, I log in in text mode (or su from another user's account) and create a directory called broken in the home directory and then start selectively renaming hidden files (ls -a) into the broken directory until it becomes possible to log in. Files also present in ls -a /etc/skel probably shouldn't be touched (or should be compared with the defaults in skel). Some of the other files will be recreated after login attempts when they are renamed.

se flag

I have also experienced the same situation of login loop in GUI mode and after modifying files like .xauthority does not fix it. So I reboot my system and go to CLI mode and login the user. In CLI mode you login easily without any error of getting into loop. After that I reinstalled my ubuntu desktop.

sudo apt-get remove ubuntu-desktop

and then make sure you system is up to dated and then reinstall it by

sudo apt-get install ubuntu-desktop

Hope so it will work.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.