Linux Labs

Inside the system: resources, kernel, processes / Stage 11 of 13

The system did not boot: emergency mode

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 7 · on a machine · 6 min

The boot journal

Here: how to find in the journal the fstab line the boot stopped on.

The emergency message names the first command itself, journalctl -xb (in the Wiki): -b means the records of this boot, -x adds systemd's explanations to them. There are thousands of records, so you start with the errors and the list of what failed to start. The shell is root, no sudo needed:

bash
journalctl -b -p err
systemctl --failed

systemd turns every fstab line into a mount unit named after the mount point: /srv/cache → srv-cache.mount. The chain in the journal — here is an excerpt from journalctl -b — is read from cause to effect:

text
tmpfs: Unknown parameter 'szie'
Failed to mount srv-cache.mount - /srv/cache.
Dependency failed for local-fs.target - Local File Systems.
Reached target emergency.target - Emergency Mode.

The kernel rejected the szie option, the mount unit failed, local-fs.target was not reached, and systemd went into emergency mode. findmnt --verify did not notice the typo in the option: only the mount itself catches it. That is why after an fstab edit, before a reboot, you run sudo mount -a: it would have answered wrong fs type, bad option for this line straight away.

Another server is in emergency mode after a reboot too, and its journalctl -b shows different lines:

text
Timed out waiting for device … - /dev/disk/by-uuid/5d2e…
Dependency failed for srv-backup.mount - /srv/backup.
Dependency failed for local-fs.target - Local File Systems.
Check yourself 1 question

What stopped the other server's boot, judging by the lines of its journal?

  • A typo in an option would show up as a message from mount or the kernel, like Unknown parameter. Here mounting never started: systemd did not get the device.

  • There is no service in these lines: srv-backup.mount is the mount unit made from the fstab line for /srv/backup.

  • local-fs.target is intact: Dependency failed means it did not get its mount unit. The first line names the cause: the device with that UUID never appeared.

systemd waited a minute and a half for the device with the UUID from the /srv/backup line and never got it, so its mount unit did not start, and local-fs.target with it. The line is what gets fixed — the UUID from blkid, or nofail if the system can live without the disk.

Key points

  • journalctl -b -p err and systemctl --failed show which mount unit failed and why.
  • The chain in the journal: the cause from mount or the kernel → Failed to mount → Dependency failed for local-fs.target.
  • findmnt --verify missed the error in the option: sudo mount -a before a reboot checks the whole line.
Ubuntu 24.04
Loading…