Ubuntu gets stuck in a login loop

1,255,110

Solution 1

Did you end up here after running sudo startx? Nevertheless:

Press Ctrl+Alt+F3 and login into the shell.

Now run ls -lA. If you see the line

-rw-------  1 root root   53 Nov 29 10:19 .Xauthority

then you need to do chown username:username .Xauthority and try logging in (you may also need to do the same for for .ICEauthority).

Else, do ls -ld /tmp. Check for the first 10 letters in the left: they should read exactly so: drwxrwxrwt.

drwxrwxrwt 15 root root 4096 Nov 30 04:17 /tmp

Else, you need to do sudo chmod a+wt /tmp and check again.

If not both, I'd recommend you either

  1. sudo dpkg-reconfigure lightdm
  2. or uninstall, reinstall it.

Now press Alt+ until you reach the login screen again, and restart.

Solution 2

I had this and after looking at /var/log/Xorg.0.log I found out that it's a Nvidia problem (there was a line saying Xlib: extension "GLX" missing on display ":0).

I realized I have Nvidia drivers from official website which are not really stable and tested (so I've read and also experienced in the past).

The solution here was to install package nvidia-current from Ubuntu repos; it is an awfully outdated version, but it's tested properly at least. Its installer is quite capable too and it uninstalled successfully my hack-installed unstable version from Nvidia website.

TL;DR, just try logging into the shell (Ctrl+Alt+F2 or whatever F between F1 and F6) and type

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-367

If it succeeds, reboot.

sudo reboot

If you're lucky enough, problem solved, you should be able to login to Unity.

UPDATE

Please note that sometimes nvidia-current might install the wrong driver. In that case, search the latest compatible driver for your video card and install it. For example, on Ubuntu 16.04, nvidia-current points to the version: 304.131-0ubuntu3. This might be incompatible with your graphics card; therefore, search with sudo apt-cache search nvidia-[0-9]+$ for the package you need, and install it.

Solution 3

I encountered this exact problem and none of the suggested fixes above worked for me. After almost giving up I looked at the .xsession-errors and noticed I had a typo in my .profile (I had an extra } in the file after I edited it earlier in the day).

That was causing the login loop. It might be another place to look if the other suggested fixes don't work for you.

Solution 4

I had a nearly identical problem a few months ago. Switching into a console from the LightDM login screen (Ctrl-Alt-F1), logging in with administrative username and password, and entering the following commands resolved the issue:

sudo mv ~/.Xauthority ~/.Xauthority.backup
sudo service lightdm restart

Solution 5

My home folder was full :-( df -h will give you this answer I had to connect through ssh made some space and worked like a flower

ctrl+alt+F1, login as user, free up some space and restart your X server! mostely sudo service sddm restart

Share:
1,255,110

Related videos on Youtube

Calvin Wahlers
Author by

Calvin Wahlers

Updated on September 18, 2022

Comments

  • Calvin Wahlers
    Calvin Wahlers over 1 year

    My Ubuntu is stuck in a login loop when trying to enter my desktop. When I login, the screen gets black and soon after that the login screen comes back.

    I've read that the problem might be caused by an error depending on the graphics, here's my graphics card: ATI Radeon 7670M

    • offby1
      offby1 about 12 years
      Look in ~/.xsession-errors; there might be a clue there.
    • Lucio
      Lucio over 11 years
      @CalvinWahlers Since you installed Quantal, you couldn't start the system correctly? Have you installed drivers some? Could you connect from some TTY (Ctrl+Alt+F1..F6) with any user?
    • Calvin Wahlers
      Calvin Wahlers over 11 years
      no, it worked fin for I think month... But suddenly that happened
    • Ivan Ferrer Villa
      Ivan Ferrer Villa about 10 years
      seems that I can't post an answer. I had a similar problem and after trying all workarounds mentioned here with no success, I found that my sessions where messed up in /usr/share/xsessions. Moved all files there to my /home dir (to have a copy) and tried to login using kdm (I use Kubuntu). To select kdm as login screen, I executed sudo dpkg-reconfigure lightdm and selected kdm. With kdm you can select a previous session or a default one. This was the way to go.
    • NobleCreed
      NobleCreed almost 9 years
      I have same graphics card ATI Radeon HD 7500/7600 M. I also got into bootloop yesterday. Reason : I did a restore using sbackup, everything worked but after restart I got into login loop. For me nothing mentioned in answers worked so i did a fresh system install. I commented my part so that any link between both can help community. Things i restored were folders : home, etc,usr,var.
    • Dan King
      Dan King over 7 years
      Just as a note that I had this same issue but was caused by a disk that was full. I logged into shell, ran some du commands and realized it was due to a process I left running on my computer for a long period of time. I deleted some of the 50+ GB log files and all was restored
    • Ignorante
      Ignorante over 7 years
      I had the same problem and it was simple. My Virtualbox Lubuntu 16.04 had run out of disk space. I cleared some space and - Shazam! Back again.
    • kabdulla
      kabdulla about 7 years
      I don't have enough reputation to answer, but what worked for me was following instructions here. In short do sudo ubuntu-drivers devices, and then sudo apt-get install the recommended driver.
    • Daniel Dinnyes
      Daniel Dinnyes almost 6 years
      The most likely cause of this issue is syntax errors in ~/.profile as implied by Dan Cundiff's answer. Much more likely than all the other suggestions. You fuck up your .profile, and you can't log in next time. That simple.
    • Mohsen Kashi
      Mohsen Kashi almost 6 years
      after trying many ways, I found that the problem was because of installing indicator-multiload . With purging it my problem resolved. I can not answer so I write my experience as comment!!
    • malypetu
      malypetu almost 6 years
      Guys, I managed to fix the exact problem. Background, my machine (desktop) runs 16.04 with latest patches up until June 2018 12Gb Ram. Having tried most solutions offered, I found the problem was missing /usr/bin from the PATH. The way to find it, if you do have this problem is: When you get your login screen drop to the terminal by issuing ctrl+alt+f1 then issue any command IE vim if you get an error "The command could not be located because /usr/bin is not included... Then you have the same problem. Edit the file /etc/environment add :/usr/bin: save it / exit /reboot.
    • Lanti
      Lanti over 5 years
      I just had this error on my freshly installed vbox Debian. I tried everything mentoined below in the accepted answer, but didn't worked. I logged into recovery mode and I noticed that a zero-fill file (which I created to minimize the disk space) didn't deleted by the last command of my script... I think it's worth to note that non-available disk space can also create similar issue, where you think there's some problem with lightdm.
    • Lucio Paiva
      Lucio Paiva about 5 years
      Happened to me today, Ubuntu 18.04. Curisouly, just restarting the machine did the trick. Go figure.
    • dferrazm
      dferrazm almost 5 years
      Happened to me today, Ubuntu 18.04. If none of the answers here work, look at /var/log/syslogand check for any error that might relate to something you did recently. My issue was an error related to flatpak, which I've installed the day before but ended up not needing it. After uninstalling it, everything went back to normal.
    • Mostafa Ghadimi
      Mostafa Ghadimi over 4 years
      I have tried all the answers, but I still have problem with login.
    • xpioneer
      xpioneer over 4 years
      There is one more possible reason . If you mess up the /etc/environment file then also it can happen. To fix . do ctrl+alt_+F3 and login to session. check if you can run any shell command. if not then that's the problem.
    • diegosasw
      diegosasw about 4 years
      In my case it was a NVIDIA problem and this helped: linuxconfig.org/… Thanks to ubuntu-drivers devices I could see that I needed to install recommended driver so sudo ubuntu-drivers autoinstall fixed it
    • kennyB
      kennyB almost 4 years
      I think I have a situation that isn't mentioned elsewhere on this page. I had upgraded to 20.04 and found that logging into GNOME failed (and Wayland worked). I had to run ampgpu-pro-uninstall to get rid of the old drivers and the standard ones built in seem to work fine. Can't do a proper answer - not enough rep.
    • cangrejo
      cangrejo over 3 years
      Wow. This question is from 2012, and I'm having this problem on a fresh install of the last version in 2020. It's seems that Canonical spends all of its resources designing fancy buttons. What a joke.
    • Mr. Blond
      Mr. Blond over 3 years
      For me this problem appeared after I enabled the Automatic Login option.. To fix this I opened the command prompt (Ctrl+Alt+F7), created a guest user via sudo adduser myguest and logged in with it to disable the Automatic Login option...
  • coteyr
    coteyr over 11 years
    I don't think thiss will work, he is having problems after gdm/lightdm
  • coteyr
    coteyr over 11 years
    This will not work. X is running he is crashing post login (i think).
  • foodiepanda
    foodiepanda over 11 years
    I know, that is because Unity crashes. Probably because 3D does not work. The LXDM solution is for using as little 3D resources as possible so that more resources are freed for Unity.
  • coteyr
    coteyr over 11 years
    I see, could work, I have no idea if lightdm uses "3D" or not.
  • foodiepanda
    foodiepanda over 11 years
    I think it does... or at least it's seriously heavyweight.
  • coteyr
    coteyr over 11 years
    If lightdm uses 3D then shouldn't it trigger the crash, not after it hands control to unity?
  • coteyr
    coteyr over 11 years
    Well just trying to learn myself. Once thing we can agree on is that unity is crashing.
  • foodiepanda
    foodiepanda over 11 years
    That's what I thought too, but lightdm is a display manager, so it takes care of displaying everything (I think). If it uses 3D, things will be displayed using 3D (at least in my experience).
  • foodiepanda
    foodiepanda over 11 years
    Anyways, if it doesn't affect, I added the lubuntu option so that he can at least access his desktop. Not optimal, but it's better than nothing :)
  • Calvin Wahlers
    Calvin Wahlers over 11 years
    until now, nothing really helps :( i selected gdm but now there's only the ubuntu 12.10 wallpaper, nothing else
  • Calvin Wahlers
    Calvin Wahlers over 11 years
    I can't log in as testing...
  • coteyr
    coteyr over 11 years
    You could have bad libs, try MiJyn's answer. If you can gain access via lubuntu then you have a library issue.
  • Calvin Wahlers
    Calvin Wahlers over 11 years
    but when I use my pc I also want to work with a desktop environment I like :) It's installing now, let's hope that Lubuntu can fix it :)
  • Calvin Wahlers
    Calvin Wahlers over 11 years
    ok, I think I'm not quite such a noob, I know how to enter a terminal there and how to log in :) And I already have installed gdm: doesn't work. lightdm: doesn't work. lxdm: doesn't work...
  • foodiepanda
    foodiepanda over 11 years
    @CalvinWahlers, don't worry, I will work with you to fix 3D stuff (that includes unity), but we first need something working to do so :)
  • Calvin Wahlers
    Calvin Wahlers over 11 years
    Probably I should add that the last time I used Ubuntu firefox told me to restart it... it crashed. LibreOffice also did. Then I rebootet and since that moment yesterday it doesn't work.
  • WindowsEscapist
    WindowsEscapist over 11 years
    OK. You definitely have a graphics problem then; LightDM can sometimes mirror the problems you're describing (it might help if you said how long the delay is). Sorry I couldn't help.
  • Calvin Wahlers
    Calvin Wahlers over 11 years
    ok, that's really nice :)
  • Calvin Wahlers
    Calvin Wahlers over 11 years
    Delay means the time between having entered an appearing again?
  • foodiepanda
    foodiepanda over 11 years
    @CalvinWahlers does lubuntu work? And no problem :D
  • WindowsEscapist
    WindowsEscapist over 11 years
    Right. It is like a couple seconds, or more like 30, etc. I can't help you with graphics issues but I'm sure there is someone here that can. Good luck!
  • Calvin Wahlers
    Calvin Wahlers over 11 years
    no ist doesn't... I've already used gdm, lightdm and lxdm, without any success
  • foodiepanda
    foodiepanda over 11 years
    Even when selecting Lubuntu instead of Ubuntu (the session, not the display manager)?
  • SiddharthaRT
    SiddharthaRT over 11 years
    down because there's a simpler solution.
  • ts01
    ts01 over 11 years
    I've same problem, chown username:username .Xauthority helped. But, anyone has an explanation?
  • Elzo Valugi
    Elzo Valugi about 11 years
    @ts01 I think my problem was "gdm-session-worker crashed with SIGSEGV in act_user_is_loaded()"
  • Elzo Valugi
    Elzo Valugi about 11 years
    I did delete the /tmp folder manually I probably was not a good idea for gdm.
  • Patrick
    Patrick almost 11 years
    My situation was very similar. I had recently added a run function for running commands multiple times in my .profile and that function, though it worked as advertised, seems to have been the cause of my problem. Commenting it out fixed it.
  • Brandon Yates
    Brandon Yates almost 11 years
    This worked for me. My PC lost power during an electrical storm and some how I ended up with a extraneous line at the end of my .profile. No clue how it got there. Anyway, I'd say the general solution should just be to check .xsession-errors and see what it says.
  • Terry Wang
    Terry Wang over 10 years
    This is a good one! I hit the same lightdm login loop problem, spent 30 mins troubelshooting with no luck (tried all possible workaround I can find). Turned out to be a syntax error in ~/.profile caused by rbenv.
  • jlengrand
    jlengrand over 10 years
    I actually even had to remove my .Xauthority for things to work. For some reasons, none of the above solved my problem.
  • SiddharthaRT
    SiddharthaRT over 10 years
    both deleting /tmp and .Xauthority will cause Ubuntu to recreate those folders/files with right permission on next bootup. This is an (unintended) way of doing what i suggested first.
  • Mike
    Mike over 10 years
    This was exactly my problem. Couldn't the devs think of something simple like popping up "Permission denied while attempting to edit /home/username/.Xauthority. Ensure username has read/write permissions."? This could have saved the 41000 people who have viewed this question so far some huge headaches.
  • Aust
    Aust over 10 years
    +1 - Thanks for mentioning .xsession-errors
  • Aust
    Aust over 10 years
    +1 - Although I had to do this for both .Xauthority and .ICEauthority
  • Abid H. Mujtaba
    Abid H. Mujtaba about 10 years
    Once I fixed this problem by reinstalling xserver-xorg. The second time Gnome had vanished somehow and I had to reinstall gnome-session-fallback.
  • zkent
    zkent about 10 years
    This worked for me. I had recently installed an incompatible program and once the references were removed from the .profile, I was able to log in again.
  • jbbarquero
    jbbarquero about 10 years
    I've had the same problem, but it was my fault, because I modified /etc/environment to add some environment variables and I made a mistake. By following @SiddharthaRT's instructions, I was able to solve the problem. You know: /usr/bin/sudo /usr/bin/vi /etc/environment
  • John
    John almost 10 years
    Today I got a clue about my problem. I have an external monitor connected to my laptop. When I got into the login loop I decided to somehow get it working with restarting lightdm. From a bug report in launchpad I got an idea that it could be due to some issue in recognising my external monitor. So, I disconnected the monitor, dropped to tty1 and back and the login worked the first time! Not the second time like when I restarted lightdm. This is better but there has to be a solution which does not require this.
  • smali
    smali almost 10 years
    ,Thanks I just type the second command It solved my problem but what this command will do will you plz elaborate
  • Dakkaron
    Dakkaron over 9 years
    Thanks for the answer. The chown on .Xauthority fixed that. What can cause that?
  • Nacht
    Nacht over 9 years
    I had to chown .Xauthority, .ICEauthority, and .gvfs. This was caused by me running sudo startx from an ssh session, because for some yet undetermined reason, X keeps shutting down
  • Cerin
    Cerin over 9 years
    @TerryWang, Same here. I have no idea why though. I don't remember adding that line, so I don't know why it suddenly broke my entire Xorg session. Another reason to hate Ruby...
  • Matt
    Matt over 9 years
    This happened after installing a VNC server. The fix worked great!
  • Brandon
    Brandon about 9 years
    Wohoo! Setting the permissions on /tmp saved my butt.
  • Sergiy Kolodyazhnyy
    Sergiy Kolodyazhnyy about 9 years
    +1. In my case .Xauthority was owned by root. In other users' folders, .Xauthority was owned by them. No idea what altered that - I switched from openbox to afterstep and when i logged out, i could get back in
  • Rich Scriven
    Rich Scriven almost 9 years
    I'm facing the same problem today in 14.04.02 but unfortunately I disabled the guest account. My user and root passwords are not being accepted in any terminal I've tried. Any suggestions? I already went ahead and installed 12.04 alongside thinking I might be able to access my files on the 14.04 side, but no luck
  • Alex
    Alex almost 9 years
    I have now run into this problem after trying to fix my R instance. Richard, did you manage to fix your problem?
  • mchid
    mchid over 8 years
    @Nacht DON'T run sudo with startx. Using sudo to run startx is exactly how the permissions of the Xauthority file can get screwed up like this. Run startx as your normal user and it should work. If it doesn't, check the ownership of the .Xauthority file to make sure it's not owned by root again.
  • Luís de Sousa
    Luís de Sousa about 8 years
    The login loop is unfortunately a recurring issue with Ubuntu 14.04; whenever I bump into it I end up at this answer just to check once again that it solves nothing. No idea why it is accepted, since it only addresses a narrow case of file permissions. In most cases the log in loop is caused by bugs with Unity that are not solvable by the user.
  • tresf
    tresf about 8 years
    > "anyone has an explanation"... well, by running sudo startx. > "DON'T run sudo with startx... Run startx as your normal user", well if that had worked to begin with we wouldn't be here, now would we?.
  • Mar Cnu
    Mar Cnu about 8 years
    I often have the login loop issue after installing updates. For those who want to use the Nvidia drivers from the website, you need to reinstall them. As you said: <kbd>Ctrl</kbd> <kbd>Alt</kbd> <kbd>F1</kbd> Login cat .xsession-errors if you have this message Xlib: extension "GLX" missing on display ":0 it means there is a GPU driver issue. Download the nvidia drivers sudo service lightdm stop sudo ./NVIDIA-Linux-x86_64-xxx.xx.run sudo reboot And it should be fine
  • junkystu
    junkystu about 8 years
    The first part fixed it for me. It also removed some nvidia drivers which were probably causing the issue in the first place and then also fixed my graphics to take on full 2560x1080 resolution. Nice one :)
  • Vladius
    Vladius almost 8 years
    At least there should be a warning about running startx via sudo.
  • Markon
    Markon almost 8 years
    I had the same issue. I had to remove all the previously installed drivers; then install "nvidia-361" (right now it's the latest version for ubuntu), run sudo update-initramfs -u, then reboot. unfortunately nvidia-current was installing "nvidia-304" that probably isn't compatible with my video card. But thanks for leading me to the right solution! :)
  • the_random_guy42
    the_random_guy42 almost 8 years
    Else, do ls -ld /tmp. Check for the first 10 letters in the left: they should read exactly so: drwxrwxrwt. What should I do after the text reads exactly so?
  • Dave Collins
    Dave Collins almost 8 years
    Simply doing these two things fixed this for me: sudo apt-get update followed by sudo apt-get -f -y dist-upgrade the -f option was required for me due to some conflicts.
  • Amit Sharma
    Amit Sharma almost 8 years
    Thanks a bunch, this helped to fix login Issue in 14.04.
  • αғsнιη
    αғsнιη almost 8 years
    After trying all, I just ended up that "let me check my user's home directory permission", and found the problem, then I was scrolling down and I see you already posted this as an answer : )
  • Michael
    Michael almost 8 years
    This fixed the login problem as in I could login again, but WARNING sudo apt-get purge nvidia-* somehow (???) also manages to try and reinstall mysql. This seems crazy, but I replicated the behavior. Thankfully it did not delete my files, but when it produced an error it did manage to change configurations. This makes no sense to me, but I replicated the behavior and it asked me to give it a new mysql root password again so this indeed occurs. The graphics issue is super annonying and also strikes me as bogus issue made up by Ubuntu, but on the solution GOOD GRIEF YOU HAVE BEEN WARNED.
  • Miguel Mota
    Miguel Mota over 7 years
    After hours of debugging the login loop, it ultimately was an error in my ~/.profile. Thank you +1
  • Priidu Neemre
    Priidu Neemre over 7 years
    As most of the people in this comment section, I too (thankfully?) ended up here after running sudo startx.
  • Can YILDIZ
    Can YILDIZ over 7 years
    Changing owner for .Xauthority worked also for me on Ubuntu 16.04 Desktop
  • G. Meyer
    G. Meyer over 7 years
    I installed some weird nvidia driver while trying to get the cuda libraries running on my system. doing sudo apt-get purge nvidia* and then getting nvidia-current fixed it (finally after 2 hours). Thanks a ton!
  • lost baby
    lost baby over 7 years
    I got this problem today when trying to reboot without a keyboard just to experiment with logging in using the onscreen keyboard. Even after rebooting with a keyboard attached I was still stuck in the loop. I had some days before installed the nvidia-current, so today I tried sudo apt-get install nvidia-367 and that seems to have fixed it. Maybe I should have removed or purged previous drivers but I didn't, seems to have done that by itself.
  • totymedli
    totymedli over 7 years
    Same for me, but I had to use the solution suggested in this answer.
  • Nick
    Nick over 7 years
    I had the same issue, and turning off Secure Boot seemed to be the only way to fix it.
  • Sergio Abreu
    Sergio Abreu over 7 years
    this autoremove does stupid things. This tool shold never be released (or it needs to be much more tested and improved) as it is so time consuming to fix this irritating problems! Nothing is more frustrating than keep looping in a login screen. luckly ubuntu has other options and I logged via Gnome Metacity session, the only one that worked...
  • Sergio Abreu
    Sergio Abreu over 7 years
    Couldn't ubuntu log in with low resolution driver and tell user that faced a problem with the driver instead of getting looping ? It is the expected of a really intelligent software... maybe here is a feature request.
  • Jaroslav Záruba
    Jaroslav Záruba over 7 years
    i never ran "sudo startx", hell i never typed "startx" either... and i ended up here too :( Ubuntu 16.04
  • user1984631
    user1984631 over 7 years
    What if I can't use Ctrl+Alt+F* because my host also is Ubuntu and it goes switching to another terminal?
  • nana
    nana over 7 years
    I didn't listen and installed 'nvidia-375' which didn't help. Following instructions and installing 'nvidia-367' worked ;) Thanks!
  • mrgloom
    mrgloom about 7 years
    ctrl+alt+f3 and sudo apt-get purge lightdm sudo apt-get install lightdm solved problem. Also what is the difference between ctrl+alt+f1 and ctrl+alt+f3?
  • DigitalFox
    DigitalFox almost 7 years
    Thanks. Worked for me by replacing the nvidia driver version to the supported one by my card. So it is better to check first for the right driver version for your system before writing down the version number here.
  • The Guy with The Hat
    The Guy with The Hat over 6 years
    @mrgloom No difference; ctrl+alt+f1 through f6 are six CLIs that work exactly the same way.
  • Tom Busby
    Tom Busby over 6 years
    For me this was the correct answer.
  • mao
    mao over 6 years
    I got the login loop for one user, and for that user I found that a script invoked from the .profile had a set -u, and the ~\.xession-errors showed XKB_IN_USE: unbound variable. Removing the set -u allowed the login to complete. I did not find which script used XKB_IN_USE , but it was not in the same file as mentioned by BUGID 1452539.
  • Sss
    Sss about 6 years
    yeah,mine too, my home folder was almost full... 800GB from 1TB... i tried all of other solutions,didnt work... so i transferred 300GB of my files too external hard disk... and it worked ... thanks Philippe:)
  • AJN
    AJN about 6 years
    For me it was issue with not enough disk space because of huge log files. Pressed Ctrl+Alt+F3 to log into the shell + emptied the log files ==> Now I can log normally
  • keniee van
    keniee van about 6 years
    .Xauthority file owner shall not be root.
  • Daniel Dinnyes
    Daniel Dinnyes almost 6 years
    I think it is fairly good question to ask: did the user edit the ~\.profile before reboot? I didn't have an .xsession-errors at all, but I did forgot a closing bracket in my ~/.profile. Maybe you should adapt the answer to emphasize that the most likely culprit is a syntax error in ~/.profile, and besides, to check for .xsession-errors to further the evidence.
  • jboockmann
    jboockmann almost 6 years
    A crashed teamviewer session (daemon running as root) caused this problem for me. Thanks a lot for your help :)
  • AlexOnLinux
    AlexOnLinux almost 6 years
    thanks, helped me well! just in case you guys aint want to delete some file you might need try sudo apt-get -y autoremove && sudo apt-get -y clean
  • Moondra
    Moondra over 5 years
    sudo chmod a+wt /tmp : This doesn't seem to change the letters. I currently stuck have dxwxr-xr-x. I'm going crazy with this loop!
  • Moondra
    Moondra over 5 years
    I'm getting permission denied when trying to run this: /var/log/Xorg.0.log
  • edison23
    edison23 over 5 years
    @Moondra: that is a log, why would you try to run it? A/w, sudo is needed for operations (read, write) on these files, I believe (can't test it now)
  • Angelo
    Angelo over 5 years
    Thankyou this worked great! I got this error after opening startx with sudo! Cheers!
  • Nick S
    Nick S over 5 years
    After installing Ubuntu 18.04 and adding my usual .bashrc, I ran into this problem. Removing the .bashrc fixed it. I assume there was an error that didn't surface in 16.04, or maybe Unity didn't execute the .bashrc on GUI login, but GNOME does.
  • Ryan
    Ryan over 5 years
    When i run ls -lA i do get -rw------- but what should it look like once i apply the fix?
  • Greg
    Greg over 5 years
    Also happened on my raspberry.
  • oldsea
    oldsea over 5 years
    Thank you so much for sharing this. I spent half the day upgrading graphics drivers and running through kernel logs and then this was the solution.
  • PerlDuck
    PerlDuck over 5 years
    Thank you for giving an account of what you experienced ... but I don't see how it answers the original question.
  • Fifi Cek
    Fifi Cek over 5 years
    My Question raised one week ago or so was put by other members to duplicate of this one. You see zero commonalities?
  • atrivedi
    atrivedi about 5 years
    I also moved unnecessary test from ~/.profile and then "source ~/.profile" -- solved my problem.
  • Ufos
    Ufos about 5 years
    I had to search for this answer waaay to long.
  • Saqib
    Saqib over 4 years
    This solution actually worked for me, the issue was I had made some changes in "/etc/environment/" file that caused login loop. But none of my commands were working even in safe mode, so your trick to temporarily enabling commands worked and I was able to access my system again. Thanks and +1 for the solution
  • Geek Guy
    Geek Guy over 4 years
    Thank you sooooooooooooooooooooooo much, exact mistake
  • otaku
    otaku about 4 years
    this fixed it for me. Thanks a ton!
  • Marses
    Marses about 4 years
    @AbidH.Mujtaba Reinstalling xserver-xorg worked for me too, with the caveat that initially it seemed that the installation was unsuccessful (came out with an error that xserver-xorg-core was Broken). However, running startx now works, and the previous issues are fixed. I don't know what to make of this.
  • Marses
    Marses about 4 years
    Actually, after the above I ended up with this related problem (Ubuntu crashing to login screen when trying to open settings): askubuntu.com/questions/1049288/… But the first answer successfully fixed that too. Seems to be an issue with the xorg driver.
  • ryvantage
    ryvantage about 4 years
    This did not work for me. ace@ace-hole ~ $ sudo apt install nvidia-367 | [sudo] password for user: | Reading package lists... Done | Building dependency tree | Reading state information... Done | Package nvidia-367 is not available, but is referred to by another package. | This may mean that the package is missing, has been obsoleted, or | is only available from another source | E: Package 'nvidia-367' has no installation candidate
  • user1754322
    user1754322 about 4 years
    This worked for me in Ubuntu 19.10. Thank you!
  • Christians
    Christians about 4 years
    It seems that Elder Geek's issue was caused by a user ID mismatch.This fixed it for me sudo chown -R NEWUSER:NEWUSER * sudo chown -R NEWUSER:NEWUSER .* # to include hidden files and directories For more details see askubuntu.com/questions/1230434/…
  • GeneCode
    GeneCode over 3 years
    It happened to me because I was feeling adventurous, and did a sudo chown -rf 1000:1000 /home/users
  • meawoppl
    meawoppl over 3 years
    This can happen also if you do a Ubuntu version upgrade, and there is an interactive prompt that dpkg misses during non-interactive install.
  • Mustafa Lokhandwala
    Mustafa Lokhandwala about 3 years
    Thanks @Philippe Gacgoud, In my case chromium-browser generated a lot of .pma files at /home/user/.config/chromium/BrowserMetrics, after removing these files I got everything running again.
  • Abinash Dash
    Abinash Dash about 3 years
    I ran into this issue(possibly) after installing tightvncserver and running sudo tightvncserver. I removed .Xauthority file after reading this answer and the login worked normally after that.
  • Jeegar Patel
    Jeegar Patel over 2 years
    This worked for me like charm :)
  • jmarina
    jmarina over 2 years
    this was my login loop cause as well your answer fixed it +1; I checked /tmp, ctrl+alt+f1-7 did not work for me for some reason, but I could get to root via the grub menu at boot, creating a new user also did not work - it had the loop in the new user too; tried to switch to gdm3, even worse, the screen went black at boot so went back to lightdm; disk was not full; could not check .Xauthority as the home was encrypted;tried openbox xfce all the same; how the home directory permissions were changed to r-x------ not sure, but the loop started after the netbook shut itself down due to low battery