[Solved] Fix login issue after removing zsh from Debian/Ubuntu

A day before yesterday, I messed up my workstation by removing zsh from the system stupidly. If you too have made the same mistake, welcome my friend; I’ll be your savior.

Once I restarted the system, I’m not able to login back in. Every time I entered the right password and the system again asked for a password instead of showing my lovely desktop, what the heck happened? why I’m not able to see my Desktop?

Apparently, I tried to log in as tty by pressing Ctrl + Alt + F2, and the problem was the same. Now I’m stuck. What do I do now? How can I recover it? I’m not left with any options, and Suddenly my mind hit me to change the runlevel and try to resolve it.

Anyway, after that, I was able to restore it. If you are system behave like mine after removing zsh, please read the guide wisely.

Steps to fix No login after removing zsh

The steps are quite easy First step change the system runlevel to 1 (runlevel like a stage by default workstation run on level 5 ) from the boot menu, and the second step is to replace zsh from /etc/passwd.

Step 1. Change runlevel from Boot menu

The initial step is to restart the system. When the grub menu appears, press ‘c’ and wait for the next screen to show up.

Change runlevel from boot menu
Type ‘e’ to edit Pcommand.

And move your cursor next to ro quiet and type 1 like the below image once you append, press Ctrl – x or F10 to boot the system in rescue mode.

Type 1 next to ro quiet
Append 1 next to quiet

If you follow the above instructions properly, your computer screen looks like the below image with the welcome message “You are in rescue mode.”

Undoubtedly enter the root password to revert the default shell.

Read:- How to reset or crack the password in CentOS/RHEL?

Enter root password

Step 2. Replace zsh from /etc/passwd to bash

Well done, you have completed the first step. Now open /etc/passwd using your favorite text editor. In Debian, you will not be allowed to use vim editor. So choose nano editor to modify a file.

# nano /etc/passwd

Find the two lines starting with the root and second your username like the one below snippet:





And replace zsh with bash.

Step 3. Reboot system into default mode

Our work is done over here, Now back to the default run-level to check the changes. To reboot your system, type the below command:

# systemctl default
# exit


That’s all to fix the login issue after removing zsh from Debian/Ubuntu or any other Linux Distribution. Next time whenever you change the shell, use the chsh command to avoid any disruptions.

Read:- Screencast the key you press on display

If you want to share something about a login error that I missed or know something that would help others, please share that in a comment section.

If you want to say Hi to me or want to suggest something feel free to contact me.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments