One day you reboot your Ubuntu machine after some automatical updates and you are not able to log in. Your credentials obviously works, but a few seconds after enrering them you are back on login screen. Welcome in Login Loop Hell.
So I will suggest two more 😉 Maybe you should start with them because they are way easier than commandline tricks.
Before entering credentials, try to switch to another environment:
If problem is caused by something environment specific then you will be able to log in into UI and investigate or update.
Log in into terminal (CTRL+ALT+F1) and create alternative account:
Now try to log in via this new user “test”. If it works (my case) then there is something wrong with your profile. In my case extension “workspace-grid” was the culprit. But you have to find what is your culprit. I am afraid thay you will need to use Bisection method:
Login as another user with high rights (sudo su -)
In your home folder create folder like “TODO”
Move all files and folders (you may first try to move only .local) of your home into TODO (do not forget to move hidden files and folders starting by dot)
Move half of files from TODO back into HOME and try to log in
If it works, goto 4. unless it is empty. If it does not work move half of previously moved files back into TODO. And check login again.
By this method you should find root cause. In my case in folder /email@example.com. I just updated that extension manually and it worked like charm.
I hope this methods will be helpfull.