0

I am having linux mint 18. I accidentally removed /bin/bash. So just after removing it I changed the default shell of the user from terminal (from /bin/bash to /bin/sh and /bin/sh links to dash) in /etc/passwd. Now After reboot I am stuck in login loop. After typing credential get blank screen for 10 seconds again get same login screen. Also tty1 tty2... are not working. As I enter my credential they disappears and again get same thing on these terminals.

problem 2

When I enter in recovery mode I am getting the same login screen as normal user. I am not getting recovery mode options. It just brings me to login screen.

edit 1

I pressed e at the grub menu and I added rw init=/bin/dash at the end of line where linux /boot/vmlinuz.... is written.

Output of ls -l /etc/passwd is rw-r--r-- root root

If I do cat /etc/passwd users entry is

user:x:1000:1000:user,,,:/home/user:/bin/dash

ls -l /bin/dash shows it doesn't point to /bin/bash. As one answer said to check it.

edit 2

I downloaded bash package in my windows system, copied to external hard disk and then copied it from hard disk to linux system. Compiled and installed it. Copied executable to /bin/bash.

Now used chsh -s /bin/bash user

Now I can go into recovery mode it works fine.I can use tty1.. they also work fine.I can switch to user using su user in tty1 and it works fine. If I do echo $SHELL it says /bin/bash, but still can't go into graphical environment.Neither guest nor user can log into graphical system.User can use terminal easily it works there but can't use graphical environment.

  • How did you change /bin/bash to /bin/sh? I guess you used a live CD. I wish what we are trying to understand was clearer. If I read correctly, we are trying to understand how it comes that /bin/sh is not work. Can you describe the login loop a bit more? Do you get a message before the prompt comes back? Maybe the screen is cleared so you can't read anything ? – Mathieu CAROFF Jul 7 '18 at 17:12
  • At that time it was working fine I just changed through nano in terminal. I didn't use any live CD. No message just enter password get blank screen for 10 seconds then again same screen. – Prvt_Yadv Jul 7 '18 at 17:16
  • 3
    You should probably use a live CD to make sure everything is fine in your /etc/passwd, and the permissions are set correctly (-rw-r--r--, or 644). If you can ssh to your machine, you probably can run commands one by one (unsure) / scp bash. – Mathieu CAROFF Jul 7 '18 at 17:34
  • (1) If console login doesn’t work, ssh probably won’t either.  (2) Booting with a live CD is a pretty good idea, but if init=/bin/dash works, that’s good too.  Use whichever you find more appropriate or convenient.  (3) Buddika suggested that there might be a problem with /bin/dash.  It’s good to check multiple ways (e.g., with ls -l), but the fact that you got a shell with init=/bin/dash really demonstrated that dash works.  … (Cont’d) – G-Man Jul 9 '18 at 3:32
  • (Cont’d) …  (4) You might want to make a copy of /etc/passwd, (a) as a backup (in case you make things worse), and (b) so you can examine it at your leisure later.  (5) Fixing /etc/passwd with usermod or chsh is probably a good idea.  (6) Do an octal or hex dump of /etc/passwd and see whether you typed a space after /bin/dash. – G-Man Jul 9 '18 at 3:32
2

I wanted to add this as a comment but still not allowed to comment

  1. Make sure there are no formatting errors in /etc/passwd.
  2. Hope "dash" does not link back to /bin/bash. :D
  3. Instead of editing /etc/passwd directly try changing the shell of the user using usermod command.
  4. If the problem still exists, your best option is to reinstall bash.
  5. If it still won't work, try Mathieu CAROFF's option.
  • It's actually great that you've posted an answer. The site's features kick in and make it much easier to create a useful repository of questions and answers. – kubanczyk Jul 8 '18 at 8:52

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.