Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login loop in Ubuntu #334

Closed
bevacqua opened this issue Dec 18, 2013 · 27 comments
Closed

login loop in Ubuntu #334

bevacqua opened this issue Dec 18, 2013 · 27 comments

Comments

@bevacqua
Copy link
Contributor

nvm is causing me a login loop in Ubuntu. I'm using a zsh shell.

nvm

If I rm -rf ~/.nvm the problem goes away, but when I install nvm again, the problem comes back.

@koenpunt
Copy link
Contributor

It looks like /usr/sbin/lightdm-session has problems with nvm.sh, not zsh.

@bevacqua
Copy link
Contributor Author

yeah, the issue indeed is with nvm, I'm not very proficient with shell scripting, otherwise I'd fix this and submit a pull request, any thoughts?

@ljharb
Copy link
Member

ljharb commented Dec 26, 2013

What's lightdm-session? Can you try your OS without using that, and see if the problem still occurs?

@dosten
Copy link

dosten commented Dec 26, 2013

@bevacqua you can comment nvm call in ~/.profile and ~/.bash_profile instead of remove all nvm.

@bevacqua
Copy link
Contributor Author

@ljharb lightdm is the display manager in the default distro of Ubuntu

@dosten I know, but the rm -rf statement is faster, I can just install it back afterwards

@creationix
Copy link
Collaborator

I'm well aware of lightdm and how it's the default dm for unity in ubuntu, but I'm not familiar with how people set zsh as their default user shell. What is involved in doing this? How would I go from a stock ubuntu install to reproducing this issue?

@bevacqua
Copy link
Contributor Author

See zsh.sh in my dotfiles. I just use chsh

chsh -s `which zsh`

@afucher
Copy link

afucher commented Dec 29, 2013

This line in ~/.profile is causing Login Loop for me:
[ -s $HOME/.nvm/nvm.sh ] && . $HOME/.nvm/nvm.sh # This loads NVM

I comment this, and can login again...

I found this here:
http://askubuntu.com/questions/395942/node-js-nvm-causes-xubuntu-login-loop-with-profile-line?newreg=51bd58007f2145b6b9f3cefe5cedc962

@dosten
Copy link

dosten commented Dec 29, 2013

@afucher what is the content of your .xsession-errors file?

@afucher
Copy link

afucher commented Dec 29, 2013

the same from the issue:
/usr/sbin/lightdm-session: 24: /home/fucher/.nvm/nvm.sh: Bad substitution
/usr/sbin/lightdm-session: 504: /home/fucher/.nvm/nvm.sh: Syntax error: "(" unexpected (expecting ";;")

@dosten
Copy link

dosten commented Dec 29, 2013

@afucher try changing the shebang in .nvm/nvm.sh to #!/bin/bash. works for me if i use another shell instead sh (ex: bash, zsh)

@ljharb
Copy link
Member

ljharb commented Dec 29, 2013

Since nvm.sh has the #!/bin/sh shebang, it should really work by itself. While it's great that it can work by switching it to bash, that means that we're using bash syntax in a non-bash script, and that's the real issue that needs fixing.

@dosten
Copy link

dosten commented Dec 29, 2013

In my system sh is a symlink of dash. can be dash the problem?

@bevacqua
Copy link
Contributor Author

No. I don't have that symlink and I get the same syntax errors
On Dec 29, 2013 4:27 PM, "Diego Saint Esteben" notifications@github.com
wrote:

In my system sh is a symlink of dash. can be dash the problem?


Reply to this email directly or view it on GitHubhttps://github.com//issues/334#issuecomment-31323314
.

@abhishekbhardwaj
Copy link

I'm getting the same error as well. Here's what I've in my .xsession-errors file.

.nvm/nvm.sh: 24: .nvm/nvm.sh: Bad substitution
.nvm/nvm.sh: 504: .nvm/nvm.sh: Syntax error: "(" unexpected (expecting ";;")

As soon as I enter my password on the login screen in Ubuntu, the screen goes black for a second and then it brings the login screen back. Tried this with the newest version of NVM on GitHub.

Had this in my .profile:

[ -s $HOME/.nvm/nvm.sh ] && . $HOME/.nvm/nvm.sh

Removing that line immediately made Unity work.

@gwokae
Copy link

gwokae commented Dec 30, 2013

My workaround is move this line [ -s $HOME/.nvm/nvm.sh ] && . $HOME/.nvm/nvm.sh # This loads NVM from ~/.profile to ~/.bashrc

@abhishekbhardwaj
Copy link

@gwokae Did it stop the login loop?

@afucher
Copy link

afucher commented Dec 30, 2013

I think the problem is that sh cannot make dynamic substitution... If nvm force to put this in bash and not in /.profile, it will works fine.

@magp
Copy link

magp commented Dec 30, 2013

@abhishekbhardwaj : gwokae solution solves the loop (at least on my system)

@gwokae Thanks for this, saved my day!

@gwokae
Copy link

gwokae commented Dec 30, 2013

@abhishekbhardwaj Yes, it works for me.
@magp You're welcome

@afucher
Copy link

afucher commented Dec 30, 2013

I'm new in Ubuntu (Linux)..so what is the difference between @gwokae solution, or put source ~/.nvm/nvm.sh to ~/.bashrc as the README say?

@gwokae
Copy link

gwokae commented Dec 30, 2013

@afucher These two files are just start scripts when user login. ~/.profile will firstly execute when user login. After ~/.profile executed, shell's start script will executed ( in bash it will be ~/.bashrc ). This stackoverflow explains very well.

gwokae added a commit to gwokae/nvm that referenced this issue Dec 30, 2013
@abhishekbhardwaj
Copy link

@gwokae Thank you very much. It works on my system too! 👍

@BradMcEvilly
Copy link

For Mac OSX use
. ~/.nvm/nvm.sh
in ~/.profile
and be sure to remove
[ -s $HOME/.nvm/nvm.sh ] && . $HOME/.nvm/nvm.sh
at the bottom of nvm.sh

@ljharb
Copy link
Member

ljharb commented Dec 31, 2013

~/.profile isn't a thing on Mac OS X that I'm aware of.

@avoliva
Copy link

avoliva commented Jan 2, 2014

I'm using BASH and getting the same exact error in my .xsession-errors. Once I stopped loading nvm it worked.

@BradMcEvilly
Copy link

@ljharb ~/.profile doesn't exist on Mac OS X by default. You need to create it in your home directory.
For more info, see:
http://trickortip.com/312/andres-felipe-diaz-2/where-is-the-profile-file-in-mac-os-x-lion-mac-terminal-trick.html/
or
http://superuser.com/questions/1031/profile-in-mac-os-x

@ljharb ljharb closed this as completed in a7108e9 Sep 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests