emergency.target to repair configuration files (commonly /etc/fstab) or missing block devices.
Key goals:
- Reproduce the failure and observe where the boot stalls.
- Boot with more verbose output to identify the offending device or mount.
- Drop to an emergency shell to repair
/etc/fstaband restore normal boot.
1. Reproduce the failure and collect boot messages
Reboot the server and, when the GRUB menu appears, edit the selected kernel entry (presse) to remove “quiet” and “rhgb” (or other quiet options). This exposes kernel and systemd messages so you can see where the boot process stops.
Example GRUB edit (kernel lines shown):
fstab):
dev-mapper-...fake.device message and a halted boot typically point to a bad /etc/fstab entry referencing a non-existent UUID or block device.
2. Boot straight to an emergency shell
Reboot and edit the kernel command line again. Appendsystemd.unit=emergency.target to drop to a minimal single-user shell (emergency mode) where you can repair files.
Example GRUB kernel line with emergency target:
When you boot into emergency.target, the root filesystem is mounted read-only by default. To edit system files such as
/etc/fstab, remount the root filesystem read-write.3. Diagnose failing mounts and prepare to edit /etc/fstab
From the emergency shell:
- Try
mount -ato see what fails. This will attempt to mount everything in/etc/fstaband show the error messages for missing devices or bad UUIDs.
- Remount the root filesystem read-write so you can edit files:
- Use
blkidorlsblk -fto correlate device UUIDs with physical devices if you need to verify which entry is bad.
4. Edit /etc/fstab to remove or fix the bad entry
Open /etc/fstab with your preferred editor (e.g., vim or nano) and locate the entry referencing the nonexistent UUID or device. Remove or correct the line, ensuring the remaining entries have correct UUIDs and mount options.
Example corrected /etc/fstab after removing the bad entry:
systemctl daemon-reload will update any mount units generated by systemd from /etc/fstab.
5. Reboot and verify
Reboot the system:quiet options if needed) and confirm the system reaches its usual targets. If the boot completes normally, the issue is resolved.
Quick troubleshooting checklist
Additional notes and common pitfalls
- If you’re uncertain which UUID maps to which device, use
blkidandlsblk -ffrom a rescue environment or live ISO to verify before editing/etc/fstab. - After changing
/etc/fstab, test mounts withmount -ato ensure there are no remaining errors (make sure the root partition is writable first). - If the boot still stalls after fixing
/etc/fstab, inspect the journal for the failing boot:- Current emergency session:
journalctl -xb - Previous boot:
journalctl -b -1
- Current emergency session:
- Be cautious when removing
swapor LVM-related entries; verify LVM volumes exist and are activated (e.g.,lvm lvdisplay,vgchange -ay).
Links and references
- systemd emergency.target — https://www.freedesktop.org/software/systemd/man/emergency.target.html
- blkid manual — https://man7.org/linux/man-pages/man8/blkid.8.html
- lsblk manual — https://man7.org/linux/man-pages/man8/lsblk.8.html
- journalctl manual — https://man7.org/linux/man-pages/man1/journalctl.1.html
- GRUB manual — https://www.gnu.org/software/grub/manual/
/etc/fstab entry or a missing block device and recover a Linux system that stalls during boot.