0

Raspberry is running fine, but I cannot login via ssh or directly on the device. Problem: I executed following command: sudo apt remove --purge zsh

Yes I know I am a moron.

I know I have to access /etc/passwd to change after my username the entry from /bin/zsh zu /bin/bash. But I cannot access this file. When I add init /bin/bash to cmdline.txt I have sort of root access. I can read but not write.

And: Booting the rasperry holding shift does not bring me to the boot menu

Anyone can help me?

asked Mar 1, 2024 at 17:19
5
  • re-install? ... Commented Mar 1, 2024 at 17:54
  • Anyone can help me? is not a question about the problem Commented Mar 1, 2024 at 18:56
  • What OS? What did you ACTUALLY do? There is no need to purge ANYTHING; you can have multiple shells and use for different purposes. There are methods to login to a root shell and repair but you easiest option would be to reinstall. Commented Mar 1, 2024 at 21:31
  • I don't know where you found the strange things you tried - do not blindly follow stuff you find; most of it is wrong. Commented Mar 1, 2024 at 21:33
  • I can read but not write - I guess / is mounted readonly - you could mount / -o remount,rw to make it writable Commented Mar 2, 2024 at 0:41

1 Answer 1

0

Rebooting to a root shell can repair most configuration problems on the Pi.

  1. Append init=/bin/sh at the end of cmdline.txt and reboot.
  2. After booting you will be at the prompt in a root shell.
  3. Your root file system is mounted as readonly now, so remount it as read/write
    mount -n -o remount,rw /
  4. Edit to fix your problem.
  5. Remove init=/bin/sh and reboot.

NOTE you should use init=/bin/sh NOT init=/bin/bash as this is guaranteed to exist.
On Debian /bin/sh is actually a link to /bin/dash

answered Mar 2, 2024 at 2:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.