Few sights are more unnerving when powering up an Ubuntu desktop or server than watching the normal boot animation vanish, replaced by a wall of red systemd error text declaring “Failed to mount /etc/fstab” or “You are in emergency mode”. Below this warning, the system drops into a spartan root emergency shell prompting: “Press Enter for maintenance (or press Control-D to continue)”.
Pressing Control-D invariably results in an immediate loop back to the same emergency shell. This boot failure occurs because systemd-fstab-generator parses /etc/fstab at early boot to mount essential storage volumes. If a hard drive listed in the file is disconnected, an external backup drive is powered off, a partition Universally Unique Identifier (UUID) changed after repartitioning, or a filesystem is corrupted, systemd marks the mount dependency as critical and refuses to enter standard multi-user targets. This recovery guide explains how to repair your fstab configuration and restore normal Ubuntu booting.
Method 1: Inspect the Boot Journal to Identify the Broken Mount
Before editing system files blindly, inspect the systemd journal logs to discover precisely which storage partition or filesystem mount failed.
- Press Enter at the emergency prompt and type your
rootadministrative password. - Query the systemd journal for critical mount errors by running:
journalctl -xb | grep -i mount - Look for lines highlighted in red displaying:
or messages mentioning “Timed out waiting for device /dev/disk/by-uuid/…”.Failed to mount /mnt/data: Unit mnt-data.mount entered failed state. - Note the failing mount point path and disk UUID identified in the logs.
Method 2: Remount the Root Filesystem in Read-Write Mode
In emergency mode, Ubuntu frequently mounts the root partition (/) as read-only to prevent accidental data corruption. You must remount it as read-write before you can save changes to configuration files.
- In the emergency shell, attempt to test write access:
mount -o remount,rw / - Verify that the filesystem is now mounted read-write:
mount | grep "on / " - The output should include
(rw,relatime)instead of(ro,relatime). You can now safely edit configuration files.
Method 3: Comment Out Non-Essential Mounts in /etc/fstab
If the failing mount corresponds to a secondary data drive, external USB disk, or network share that is temporarily unavailable, commenting out its entry in /etc/fstab allows Ubuntu to complete boot into the normal desktop or server environment.
- Create a backup of the existing configuration:
cp /etc/fstab /etc/fstab.bak - Open the fstab file in the nano editor:
nano /etc/fstab - Locate the line corresponding to the failing mount point identified in Method 1.
- Add a hash symbol (
#) at the very beginning of the line to comment it out. For example:# UUID=a1b2c3d4-e5f6-7890-abcd-1234567890ab /mnt/backup ext4 defaults 0 2 - Press Ctrl + O followed by Enter to save the file, then Ctrl + X to exit nano.
- Test rebooting the system:
systemctl reboot
Method 4: Verify and Correct Partition UUID Mismatches
If you recently cloned a drive, created new partitions in GParted, or formatted a drive, the filesystem UUID changed, causing fstab references to point to non-existent disk signatures.
- List all currently connected storage block devices and their true UUIDs:
blkid - Compare the actual UUID of your partition (e.g.,
/dev/nvme0n1p2or/dev/sda1) against the UUID string written in/etc/fstab. - If the strings differ, edit
/etc/fstabusingnano /etc/fstaband update the entry with the correct UUID output fromblkid. - To prevent non-critical storage drives from halting boot in the future, append the
nofailmount option to secondary drives:
The nofail flag instructs systemd to continue booting normally even if this specific drive is missing or disconnected.UUID=your-uuid-here /mnt/storage ext4 defaults,nofail 0 2
Method 5: Check and Repair Corrupted Filesystems with fsck
If the UUID is correct but the filesystem metadata suffered corruption following an unexpected power loss, systemd halts boot to prevent compounding data damage.
- Identify the target partition path using
lsblk. - Ensure the partition is unmounted:
umount /dev/sda1 - Run the filesystem check and repair tool:
fsck -y /dev/sda1 - The
-yparameter automatically repairs detected superblock inconsistencies and orphaned inodes. - Once
fsckreports the filesystem is clean, reboot the machine:reboot
Ubuntu fstab & Emergency Mode Reference Matrix
Use the matrix below to identify typical boot-stopping mount errors and their remedies:
| Boot Error Symptom | Underlying Root Cause | Standard Remedial Command |
|---|---|---|
| “Timed out waiting for device” | Incorrect UUID or disconnected physical drive | Check blkid; add “nofail” option to /etc/fstab |
| “Cannot save file: Read-only filesystem” | Root partition mounted read-only in emergency shell | mount -o remount,rw / |
| Emergency mode loops on Control-D | Critical systemd mount unit failure unresolved | Examine journalctl -xb; comment out bad fstab line |
| “Bad superblock on /dev/sdX” | Filesystem corruption following unclean shutdown | fsck -y /dev/sdX |
| Samba/NFS network share stalls boot | Network stack not initialized before filesystem mount | Add “_netdev,nofail” to fstab mount options |
Preventing Network Share Boot Hangs with _netdev
If your /etc/fstab mounts networked Samba (CIFS) or NFS shares, standard boot sequences attempt to mount them before the network interface has acquired an IP address via DHCP. This triggers a guaranteed boot timeout. Always append _netdev,nofail to every network mount in /etc/fstab. The _netdev parameter explicitly delays mounting until systemd brings up local network connectivity, preventing emergency mode lockouts.