I changed my default shell to zsh from bash in Ubuntu. I used the steps explained in http://github.com/sorin-ionescu/prezto and ran chsh -s zsh. After this, I couldn't able to log in to any shell as it pops out as soon as I try to login. I tried from gnome terminal, xterm and trying to log in from tty1 (Alt+Ctrl+F1). It closes as soon as I try to open.

  • Possibly a bug in your .zshrc (or .zshenv) that is causing it to exit?
    – Graeme
    Jun 13, 2014 at 14:16
  • 1
    How did you change your shell? with chsh, by modifying /etc/passwd? Is the path you entered there mentioned in /etc/shells? Anything in /var/log/auth.log, What happens if you su your-username from root? Jun 13, 2014 at 14:20
  • chsh -s zsh. Used the steps explained in github.com/sorin-ionescu/prezto. @stephane I can't even get to a prompt to execute any command.
    – vpshastry
    Jun 13, 2014 at 15:04
  • @Varun, the easiest way to get a shell is probably just to log in as another user (you could even create one via the desktop environment).
    – Graeme
    Jun 13, 2014 at 16:32

3 Answers 3


To get back into the system you can boot into single user mode by appending the number 1 at the end of the linux kernel line within GRUB. The method for doing this is roughly outlined in this U&L Q&A titled: Can I launch a process as root without launching root's login shell?.

Once you've done this you'll be dropped to a prompt as root from where you'll be able to reverse the changes you made to your shell. This will get your system back so that it's working correctly.

From here you'll likely want to run chsh for your username instead of whatever method you employed previously.


Login as root. Verify that zsh is installed. If not apt-get install zsh

  • 1
    On Ubuntu, the root login is disabled by default.
    – Graeme
    Jun 13, 2014 at 14:19
  • 1
    @Graeme, I believe that in Ubuntu, you can login as root using the "recovery boot option". Jun 13, 2014 at 14:21
  • @Graeme there are ways around that sudo su -
    – Creek
    Jun 13, 2014 at 15:21
  • 2
    @Creek, for which you need to be able to start a shell...
    – Graeme
    Jun 13, 2014 at 15:42
  • 1
    The Ubuntu grub 'recovery mode' does provide a root shell however, at least in recent versions, the root filesystem is initially mounted read-only and requires remounting before system changes can be made e.g. mount -o remount,rw /. It may also be necessary to choose the 'Enable networking' option if packages required for the fix are not cached and need to be downloaded from online repositories. Jun 13, 2014 at 17:06

There are two reasons why you might not be able to open a terminal or log in in text mode: either your shell (as recorded in the user database) doesn't exist, or your shell's configuration file conks out on a fatal error.

If chsh succeeded then your shell does exist (chsh checks that the shell is in an allowed list, and Ubuntu's package management updates the list based on installed packages). So unless you removed the zsh package after doing chsh -s zsh (in which case you should just reinstall it), we can rule this case out.

Thus one of the configuration files that you got from Prezto must be buggy, incorrectly installed, or missing some critical dependency. Move these configuration files out of the way. Launch a file manager such as Nautilus and rename the following files in your home directory (if they exist): .zlogin, .zlogout, .zprofile, .zshenv and .zshrc. If they're symbolic links, just remove the symbolic links and you'll recreate them later.

Once you've done that, you'll be able to open a terminal and start using zsh with its default configuration. The first time you run zsh, its new user setup interface will run (you must have seen it already if you followed the instructions in https://github.com/sorin-ionescu/prezto).

Change your shell back temporarily to bash (chsh -s bash) until you sort out the problem with Prezto. Open a terminal (now running bash), and run zsh. Move the .z* files back into place, or re-create the symbolic links following step 3. Now run zsh in this open terminal and see what the errors are. If the errors aren't informative, run zsh -x to get a debug trace.

Once you've solved the problem and zsh starts, run chsh -s zsh again.

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.