I have a dual booted windows 7 / ubuntu 14.04 computer. Everything in ubuntu worked fine until I booted into windows and then switched back to ubuntu. Now when I try to login it keeps sending me back to the login screen. I logged in using the command line fine, but it appears to be a messed up path variable. On the command line I cannot use sudo or any other functions unless I do an export path.

I created a new user, which worked until I had to switch into windows again, then it did the same thing.

  • Windows can't mess linux like the default path. It's jsut that you are dropped in limited shell like initramfs because ubuntu does not boot correctly. – solsTiCe May 20 '15 at 18:10
  • Type in grep PATH ~/.bashrc in a terminal window and see if the /usr/bin is in the line. – Terrance May 20 '15 at 18:10

If you're saying that it is looping at the login prompt, that is the password shows no errors but returns you to the login prompt. I might be able to help. It happened to me. I don't know why.

Ubuntu gets stuck in a login loop

might help.

The code dpkg-reconfigure lightdm entered in the terminal is what did it for me. Apparently, some problem in .Xauthority file. I hope the link helps.


If you open your .profile file, located in your home directory, i.e. /home/yourusernameor ~, using sudo gedit ~/.profile, it actually says, which files are used by your login shell.

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
          . "$HOME/.bashrc"

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then


(Typing echo $PATH in your terminal would have also given you the value of the PATHvariable.)

I neither have a .bash_profile nor a .bash_login file, therefore the command interpreter of my login shell - which is bash - executes my .profile as stated in the file. (Find out what your shell is by using echo $SHELL. Should the output be different from /bin/bash, you may be interested in in this: https://unix.stackexchange.com/questions/88201/whats-the-best-distro-shell-agnostic-way-to-set-environment-variables)

Even though it says in the .profile file above include .bashrc if running bash, my .bashrcfile is empty, for example.

Therefore I included the paths to the directories of my commands like /usr/bin directly in the .profile file.

If /usr/bin is not included in the value of your PATH variable, defined in your .profile file, just add it after the other paths using a colon. The order of paths does not matter.

Part of the reason why this happened to you after booting into your other OS is because changes like permanently deleting or adding a path take only effect after reboot. So, as @solsTiCe already mentioned, Windows cannot mess with your system. "Something" else must have changed the PATH variable.

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.