Raspberry : Boots in Emergency Mode


Background

Your Raspberry Pi is booting in emergency mode complaining about a device that needs to be checked. Then after a while, you are getting into emergency mode.


Of course, your root password does not work because by default root login is disabled on Raspbian or because you simple do not have the right keyboard layout and so on and so on....

Welcome to emergency mode! After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "systemctl default" to try again to boot into default mode. Give root password for maintenance (or type Control-D to continue):

DON'T PANIC ! Keep calm and read this post

How to fix it

It took me a while to understand the exact meaning of this message. Actually dev-sda1.device is not related to the Pi itself but to my external hard drive. The one I plugged-in in this post. I have added the drive in my /etc/fstab to have it available at boot time. If any of the devices in fstab cannot be found, it will hang the boot process. At this stage, there is two options : either make sure the external device is found by the OS or remove the entry in fstab.

This is my failing fstab

# cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p6  /boot           vfat    defaults          0       2
/dev/mmcblk0p7  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
tmpfs        /tmp            tmpfs  defaults,size=128M                                       0 0
/dev/sda1    /home/pi/DLNA   vfat    defaults     0        2

The last line is the one which causing the Pi to start in Emergency mode. How to fix it ? The easiest way is to insert the SD card into any Linux computer (Live CD will do it) and comment the line.

One of the volume is called root0, this is your Raspbian root file system, you can access all your files from there. Edit /etc/fstab and comment the last line (adding a #). Put the SD card back in your Pi and you should be good to go. Do not forget to safely unmount the SD card.

It saved me today, I really hope this will save others. To avoid further issue like this one, you can mount your external device using a script rather than a fstab. See what suits you best.

Comments

  1. Replies
    1. You're welcome! And since it did not saved mine I decided to share the information ;)

      Delete
  2. thanks so much; external drive wasn't connected - wouldn't boot; need to investigate using script for that drive instead of fstab

    ReplyDelete

Post a Comment

Thank you for your message, it has been sent to the moderator for review...

What's hot ?

ShredOS : HDD degaussing with style

Nutanix : CVM stuck into Phoenix