Hey, I just had a weird problem today that I wanted to share in case you run into it. While I was unplugging a USB drive today, my hand accidentally hit the reset button on my PC. Upon booting back up, I found that I could not log in - lightdm was running fine, there were no errors that I could see in the journal. I would simply get sent back to the lightdm login after a brief black screen.
I assumed it was the bad reset corrupting something, I went to the solus matrix and tried getting help (Reilly graciously helped me out for like an hour) but nothing seemed to work. There were no services broken, an eopkg update didn't help, etc.
I eventually tried making a second user, and that user could login just fine, so I had narrowed it down to something specifically about my main user that was going wrong. I googled for a while, and saw some fixes that didn't help (deleting .Xauthority), but eventually I saw .xsession-errors in my home directory had a new line in it that isn't usually there, complaining about an error in my .bashrc. So I moved my .bashrc and voila, I could login again!
I eventually figured out that the problem was a new function I had added earlier that day - apparently it DOES NOT LIKE IT when a function name has a hyphen in it. I fixed that and moved my .bashrc back and everything is hunky dory again. It kind of blew my mind that a .bashrc error would break logging into a graphical session - I would have only really expected it to break going into a terminal at worst.
So heed my warning - don't make functions with a hyphen in the name in your .bashrc! And if you get a weird login loop with lightdm, but you can still login in a TTY, check your .xsession-errors file in your home directory!
Now I'm gonna go drink heavily to bring my heart rate back down. And also sweep up all the hair I pulled out of my head working this out. 😵💫