Categories
Uncategorized

[Solved] Emergency Mode Due to Bad fstab

You can automatically mount a drive on your Raspberry Pi by editing your fstab file. Learn how to automatically mount a drive on your Raspberry Pi here.

But if you’re like me, editing fstab rarely works right the first time. This typically results in your system crashing on startup with a message saying that your Raspberry Pi has gone into “Emergency Mode”. You fix this by removing (or editing) the new line from your fstab file. But how do you do that if your system won’t start up?

Here’s how to get your Raspberry Pi out of Emergency Mode, and booting again:

  • Take your SD card out of your Pi and mount it on another computer.
  • Open the boot partition, and the file cmdline.txt
  • Add init=/bin/sh to the end of the line and save the file
  • Unmount, place back into your Pi, and power up your Pi. Your Pi will boot into a minimum shell environment as root.
  • At this point, you need to mount the actual filesystem, but without loading fstab. To do that, enter mount -o remount,rw / –target / and hit enter
  • Now, edit your fstab file by entering vi /etc/fstab and hitting enter
  • After you’ve made your edits, exit the file, then at the command line, type exit. The system will panic, but it’s fine.
  • Remove the SD card from your Pi and put it back into the other computer.
  • Open the boot partition, and the file cmdline.txt
  • Remove init=/bin/sh from the end of the line and save the file
  • Unmount the SD card, place it back into your Pi, and power up your Pi. You should be good to go now.

Alternatively, throw your Pi away and just grab a new Raspberry Pi 3 from Amazon