-2

I've got a pi 3b that boots from the ssd card, but has an external usb drive to store media files. The external drive seems to have died (makes terrible sounds and doesn't spin up) but the bigger problem is that I can't access the system anymore. While booting it times out after waiting for the bad device, then reports "You are in emergency mode." After a few more messages it says

Cannot open access to console, the root account is locked. See sulogin(8) man page fore more details. 

Press Enter to continue.

But pressing enter or switching to other virtual consoles doesn't give me a command or login prompt. I tried booting in safemode by adding S to /boot/cmdline.txt but there's no change.

pgcudahy
  • 117
  • 4

2 Answers2

0

I have never heard of this method and the command line is not correct for current Raspbian. You should list your actual cmdline.txt

Your best option is to restore from your backup.

If you do not have a backup you can attempt to repair problems on the Pi by rebooting to a root shell. This won't work if you have used NOOBS

  1. Append init=/bin/sh at the end of cmdline.txt and reboot. (This will need to be done on another computer.)
  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 /

You can then edit files.

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • No dice. Adding init=/bin/sh makes the boot hang early after random: crng init done but with no error messages. – pgcudahy May 20 '20 at 07:09
0

So, this worked for me. From this article all i did was:

  1. add the init=/bin/sh to the cmdline.txt file in the /boot partition of the SD card for the pi.
  2. once you are in the cmd prompt enter sync twice

kali@kali:~ sync

kali@kali:~ sync

  1. run exit

kali@kali:~ exit

When you run the exit command you will get a load of kernel warnings. Ignore these and wait for them to finish then off the pi. Remove the line from step 1. Reboot the pi and all should be fine.

Let me know if this works for you

Reference: https://talhasariyuerek.com/en/linux-raspberry-pi-3b3b4-emergency-mode-root-account-locked-solution/