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 '15 at 10:08
  • The output of type gnome-session too. – Braiam Oct 19 '15 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 '15 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 '15 at 13:28

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.

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.