Raspberry Pi Emergency mode and root account locked (mounting USB disk with fstab)

♥♥♥ ♥♥♥


When you mount an USB drive to your Raspberry Pi and set it up to automatically mount to the system using fstab you cannot restart the system without the HDD connected!

Here the solution what to do to prevent the following error message: 

You are in emergency mode. After logging in, type “journalctl -xb” to view
system logs, “systemctl reboot” to reboot, “systemctl default” or ^D to
try again to boot into default mode.

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

Press Enter to continue.

It looks like this:

Emergency Mode due to missing external usb drive while using fstab for auto mount after reboot.

How to fix this error

Just add a option to the statement:

  • ,nofail

That means: External devices (like USB HDDs) that are to be mounted when present but ignored when they are not online (due to missing plug or damaged HDD) require the nofail statement. This prevents the error being reported as shown above.

As of the default device timeout over 90 seconds, you can combine the statement with the option x-system.device-timeout=X. With this you fasten up your boot time a lot :)

So the whole statement has to be look as:

  • defaults,nofail,x-systemd.device-timeout=5

Set the red held seconds to whatever you want…

As you can see below I added this options on all my external USB drives. It works like a charm.

If your Raspberry Pi boot fails due to an emergency mode because you linked an external drive by fstab to your system, then look how to prevent from this.

How to set up a Raspberry Pi NAS using SAMBA

I wrote this solution because I learnd to set up my Raspberry Pi as a NAS at eltechs.com “Raspberry Pi NAS ultimate guide”.


5 Comments

  1. Vielen Dank für Ihren Blogeintrag.
    Das hat mir so viel Zeit gespart. Mein Raspberry Pi Build wurde in 5 Minuten repariert. So dankbar.
    (Entschuldigung, ich spreche nicht viel Deutsch)

    Reply
  2. I have the same error. How do I manage to log in to change the settings? Every time I press ENTER it takes a while and i get back to the Error.

    Reply
  3. how stupid is this error
    you cant reboot to correct it if all it does is go back and tell you the same thing
    such dumb answer is undeliverable.. the system is stuck…STUCK means it wont reset
    why doesnt raspi have a simple reset button to give it some basic factory mode or something?

    Reply
  4. you need to bootup a linux distro (ubunto for example) on a separate sd card or another laptop, then mount the partition that has the problem. navigate to /etc/fstab on the partition and edit it from there (to test if its the issue remove it completely and boot up your raspberry pi.)

    Reply

Leave a Comment.