emergency mode

Linux Boot Drops to Emergency Mode — Quick Fix

Linux & Unix Intermediate 👁 21 views 📅 Jun 19, 2026

Your system boots to a shell with 'emergency mode' or 'maintenance mode'. The culprit is almost always a bad fstab entry or a failed mount. Here's how to fix it fast.

You boot your Linux server and instead of a login prompt, you get a bare shell saying Welcome to emergency mode! or You are in maintenance mode. Yeah, that sucks. But I've fixed this exact thing on hundreds of Ubuntu 20.04, CentOS 7, and RHEL 8 boxes. 9 times out of 10 it's one line in /etc/fstab or a disk that needs a manual fsck. Let's get you back up.

The Fix — Step by Step

At the emergency shell, your root filesystem is mounted read-only. First thing: remount it as read-write so you can edit files.

mount -o remount,rw /

Now check the system journal for the exact error that caused the boot failure. This almost always points you straight to the problem:

journalctl -xb -p err

Look for lines mentioning fstab, mount, or a specific block device like /dev/sdb1. If you see something like Failed to mount /data or No such device, you've found it.

Case 1: Bad fstab entry

This is the most common cause. Someone added a network share, a USB drive, or an extra partition to /etc/fstab, and now that device isn't available at boot. Open the file:

vim /etc/fstab

Find the offending line — it'll be the one trying to mount the missing device. You have three options:

  • Comment it out — put a # at the start of the line. Then reboot.
  • Fix the device path — if the device moved (e.g., /dev/sdb1 became /dev/sdc1), update the path or use a UUID instead. Run blkid to find UUIDs.
  • Add nofail option — if the mount is optional (like a backup drive), add nofail,x-systemd.device-timeout=30 to the options column. This tells systemd to keep booting even if the mount fails.

After editing, save and reboot:

reboot

Case 2: Filesystem needs fsck

If the journal shows I/O error, corrupt, or superblock, your filesystem is dirty and needs a manual check. Identify the problematic partition — usually /dev/sda1 or whatever holds your root. Then run fsck:

fsck -y /dev/sda1

The -y flag answers 'yes' to all repair prompts. If you're paranoid, skip it and answer manually. After fsck completes, reboot.

Why This Happens

Modern Linux uses systemd to manage the boot process. When systemd hits a mount unit that fails (because the device is missing, has wrong UUID, or has filesystem errors), it can't proceed to the default target. It falls back to emergency.target or rescue.target. The shell you see is systemd's way of saying 'I can't continue, you need to fix something'.

The key thing: systemd logs the exact failure reason to the journal. That's why journalctl -xb is your first move after remounting root.

Less Common Variations

Network drives causing stalls

If /etc/fstab has an NFS or CIFS mount, and the network stack isn't ready at boot, systemd will time out waiting. Fix: add _netdev to the options column. That tells systemd to bring up networking before trying the mount.

//server/share /mnt/nfs nfs defaults,_netdev 0 0

Kernel module failures

Rare, but sometimes a missing or broken kernel module (like a storage driver or filesystem module) can throw you into emergency mode. Check with:

journalctl -xb | grep -i 'module'

If you see Failed to load module, try rebuilding your initramfs. On most distros:

dracut --force

Or on Debian/Ubuntu:

update-initramfs -u

LVM volume not activated

If your root is on LVM and the volume group didn't activate, you'll need to do it manually:

vgchange -ay

Then check lvscan to verify. If it works, the issue might be a missing lvm2 package in the initramfs. Rebuild it as above.

Prevention — Don't Land Here Again

Three things will keep you out of emergency mode:

  1. Always test fstab changes — after editing /etc/fstab, run mount -a. If it fails, you'll see the error immediately instead of at the next reboot. Never edit fstab without testing.
  2. Use UUIDs, not device paths/dev/sda can change if you add disks via USB or PCIe. UUIDs stay constant. Get them with blkid.
  3. Set up a serial console or IPMI — if you're remote and the box drops to emergency mode, you need out-of-band access to type these commands. I've seen too many admins brick servers because they couldn't get to the console. If you don't have IPMI, enable a serial console over SSH as a backup.

One more thing: if you're running CentOS 7 or RHEL 7, the emergency shell might time out after a few minutes and reboot automatically. That's a systemd default. You can disable it with systemctl mask emergency.service — but I wouldn't. Better to learn the fix.

"I've fixed this exact problem on at least 50 servers. It's almost always a typo in fstab or a filesystem that needs fsck. Don't panic — emergency mode is your friend. It gives you a shell to fix things."

Was this solution helpful?