Linux  ·  critical  ·  Core system faults

Boot drops to emergency mode after an fstab change

systemd could not mount an entry in /etc/fstab and, because the default is to treat a failed mount as fatal, dropped the whole boot into emergency mode.

What you see

The machine boots to a root prompt asking for the maintenance password, or loops. Common immediately after adding a disk, a network share or a swap file.

What is actually wrong

A typo in the device or UUID, a device that is not present at boot, or a network filesystem listed without the options that tell systemd to wait for the network.

Codes and articles

Failed to mountemergency modedependency failed for /You are in emergency mode

Fixes (2)

Repair the entry from emergency mode
Emergency shell20 minutesmedium riskreversible

A local device entry is wrong.

  1. Log in at the maintenance prompt with the root password, then find which mount failed.

    Shell
    systemctl --failedjournalctl -xb | grep -i 'failed to mount' 
  2. Remount the root filesystem read-write so you can edit.

    Shell
    mount -o remount,rw /
  3. Check the real UUIDs against what fstab claims.

    Shell
    blkidcat /etc/fstab

    A UUID copied by hand with one character wrong is the single most common cause, and it is invisible unless you compare them side by side.

  4. Correct the entry, or add nofail so a missing device can never stop the boot again.

    Shell
    vi /etc/fstab

    nofail is worth adding to every non-essential mount as a matter of course. It turns 'the server will not boot' into 'a directory is empty'.

  5. Test the file before rebooting — this is the step that stops a second trip to the console.

    Shell
    systemctl daemon-reloadmount -a && echo 'fstab is good'
  6. Reboot.

    Shell
    systemctl reboot
Confirm it workedThe machine boots normally and everything is mounted.
Shell
findmnt --verifysystemctl is-system-running
If you need to undo itComment out the new line entirely and reboot — the system will come up without that mount.
Make a network mount safe at boot
Emergency shell, then normal shell20 minuteslow riskreversible

An NFS or CIFS entry is stalling or failing the boot.

  1. Get to a writable root as above.

    Shell
    mount -o remount,rw /
  2. Add the options that tell systemd this mount needs the network and must not be fatal.

    Shell
    vi /etc/fstab
  3. The options to use are _netdev,nofail plus a timeout — for example: `//fs01/share /mnt/share cifs credentials=/etc/smb-creds,_netdev,nofail,x-systemd.device-timeout=10 0 0`

    _netdev orders the mount after the network is up. Without it systemd tries to mount before there is a route and the failure is fatal.

  4. Consider x-systemd.automount so the share is mounted on first access rather than at boot.

    This decouples the boot from the file server entirely — the machine comes up whether or not the share is reachable.

  5. Reload and test without rebooting.

    Shell
    systemctl daemon-reloadmount -a
Confirm it workedThe system boots and the share mounts, or is absent without blocking anything.
Shell
findmnt /mnt/share; systemctl is-system-running
If you need to undo itComment the line out and reboot.

Where this stops. This write-up was written and checked by hand. It says what each step changes, how to confirm it worked and how to reverse it, and anything destructive is flagged before you reach it. If it does not match what your machine is doing, search the Support Centre for the exact code or message — and when something needs a person, get in touch.