"you are in emergency mode" during first boot after power failure - how to avoid it?

For a few years I'm running Ubuntu on my home server. New thing this year in my area are short but frequent power grid outages.
After each such power failure my system is not booting to desktop, but to emergency mode.
A solution is simply to reboot the system by hitting the reset button - a bit inconvenient since the system is placed in obscure corner at the attic. It is even harder when I'm away... ;-)

Is there any brute force method possible for disabling the emergency mode?

Also, there probably is some reason (like some problem with my hardware) for such behavior - any pointers where to look for it?

1 Answer

Solution presented under this link seems to work for me:

It is not avoiding to enter emergency mode but rather rebooting the server after specified timeout - still giving you a chance to enter emergency mode and do some diagnostics if there is a need.

There were two modifications of the answer linked above needed on my system:

  • under sh command read is not recognizing -t option - needed to use bash instead
  • systemctl reboot restarts the machine but filesystem is sill mounted in read-only mode - systemctl default however does the job

So complete steps:

  1. sudo systemctl edit emergency.service
  2. Enter:
    [Service]
    ExecStartPre=/bin/bash -c "read -t 6 || systemctl default"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like