Since last week I'm also faced with the endless-loop problem using ubuntu 14.04.3 (installed in dual-boot on HP 840 EliteBook). Upon login the screen turns black and returns to the login interface.I have investigated a couple of things, but I am really stuck. Thus, I would appreciate, if someone could help me out. I have read most of the existing threads, but it seems that most problems were related to certain typos, e.g.

The output of my .xsession-errors is:

/usr/sbin/lightdm-session: line 33: cat: command not found
/usr/sbin/lightdm-session: line 34: truncate: command not found
/usr/sbin/lightdm-session: line 106: ls: command not found
/usr/sbin/lightdm-session: line 117: exec: gnome-session not found

/etc/profile and ~/.bashrc seem to be working fine. When adding 'echo $PATH' to the end of each file, I get following output:


But after logging into tty-console, the output of the $PATH environment variable is actually empty.

Moreover, I have tried:

  • renaming/removing .Xauthority
  • removing/re-installing/reconfiguring lightdm
  • switching to gdm
  • reinstalling xorg
  • xorg
  • adding a new user,

but the endless-loop effect remained. In addition, I've checked:

  • permissions of tmp (drwxrwxrwt)
  • /etc/environment (contains same path as $PATH above)
  • /var/log/lightdm/lightdm.log (file is empty)
  • .pam_environment (this file does not exist so nothing can be wrong here)

Since I am rather new to ubuntu, I would be grateful for some hints. Thanks in advance for your efforts!

  • It looks like you've messed up your $PATH. Please edit your question and add the output of grep -H PATH ~/.profile ~/.bash_profile ~/.bash_login. If /etc/.profile and ~/.bahsrc are OK, the problem will probably be in one of those files.
    – terdon
    Oct 19, 2015 at 10:08
  • The output of type gnome-session too.
    – Braiam
    Oct 19, 2015 at 10:40
  • @terdon no, I meant gnome-session. The bin directory could be deleted or moved or without permissions for all we know. command-not-found have many points of failure.
    – Braiam
    Oct 19, 2015 at 11:35
  • 1
    Welcome to Ask Ubuntu. Rather than putting the answer to your problem into the question, please add it as an answer, which you can then accept. There's nothing wrong with answering your own question. If terdon had given you a complete answer in the comment, you might offer terdon the chance to make an answer; but since he just pointed you in the right direction and then you saw the solution on your own, it's fine to just incorporate his suggestion into your answer (rather than in the question as you've done).
    – chaskes
    Oct 19, 2015 at 13:28

3 Answers 3


Thanks to the help of terdon, the output of grep -H PATH ~/.profile revealed the login-loop problem:


instead it should've been:


@terdon, @Braiam: Thanks a lot for your help!


Same problem occurred to me so what I did was opened TTL through ctrl+Alt+F1

Then in the terminal enter hostname and password then cat .xsession-errors you will find errors.

In my case, I made some changes on PATH variable file /etc/environment so removing my changes helped me.

Changing .profile or /etc/environment may result in the problem.


The answer to modifying the /etc/environment file was helpful. While configuring the minishift, I had changed the /etc/environment by adding PATH variable with a value such as:


The original PATH variable was retained as it is at the beginning of this file. Hence it seems the only reason I encountered GUI login loop on Ubuntu 18.04 was because of me changing the /etc/environment file. Removing the last added line of PATH, helped me login back again.

Also, from the login screen when I go to the terminal using Ctrl+Alt+F3, I was unable to find any commands such as ls, for everything I have to use /bin/ls full path to the commands. It was very difficult. Hence, one way I found was rebooting and going to 'More options for ubuntu'. In that, there is an option to open the terminal as root, which gives full permission to modify the system. this helped me to change the /etc/environment file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.