Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I have install zsh and I didnt like it. so I did apt-get remove zsh

From that point I cannot relogin, i click my user.. and then it just go back to the login screen. I can only login with the Guest session.

I think the problem is caused because the defualt shell on my user is zsh and it doesnt exists anymore..

How can I reinstall it from the guest session of change my users default shell for guest user?

Even trying to loging with ctrl+alt+f2/6 i type my user and password. login is success but i the thrown back to the login.

Any ideas?

share|improve this question
    
On a second thought the shell problem likely had no bearing. No user shell is spawned after the DM has been loaded before the DE is loaded (and that probably wouldn't have been a problem either). And I'm not sure about the ~/.bashrc - ~/.profile loop either: I've tested both purging the user's shell and creating the ~/.bashrc - ~/.profile loop in a VM and I've always been able to login through LightDM, though I've not been able to login through the console with the ~/.bashrc - ~/.profile loop (but still, LightDM instead worked). In any case you should unaccept my answer. – kos Mar 18 at 6:58
up vote 10 down vote accepted

The guest user is not granted the permission to run sudo or pkexec, which (unless you're root, which you're not) are required in order to change another user's shell.

So the only solution occurring to me is booting into a root shell and changing the user's shell as root:

chsh -s /bin/bash user

Where user is your user's username.

share|improve this answer
    
One wonders how you fix this when root's shell is also zsh... LiveCD? – Kevin Mar 18 at 4:20
    
@Kevin This answer is likely wrong. The shell has no bearing with the user not being logged in into the DE, as no user shell is spawned after the DM has been loaded befor the DE is loaded. I don't know if there are better options in case one manages to lock themself out that way, but I suppose that using a Live DVD and changing /etc/passwd manually should work. – kos Mar 18 at 7:07
1  
@Kevin Possibly with a boot option like init=/bin/bash. – immibis Mar 18 at 9:43

So additionally to what @kos said..

For some reason I added source ~/.profile to my .bashrc file (don't know why.. read it somewhere) And my .profile file loaded the .bashrc which cause circular loading!.

Removing the source.. + @kos solution did the trick!

share|improve this answer
    
Linux desktops have kind of broken the .profile-for-env-vars and one-per-login stuff / .bashrc-for-aliases paradigm. Since you sometimes need env vars set for stuff to work, I can see why one might think it's a good idea to source ~/.profile from .bashrc. (Logging in to a desktop session might not source your profile to set env vars for all children of the session.) – Peter Cordes Mar 18 at 3:13

Login as root or boot into root shell and edit the shell entry in /etc/passwd to "/bin/sh". Then you can login again as yourself and change things from there.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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