- A misconfigured fstab can block the Boot de Linux by leaving file system dependencies unmet.
- The repair usually involves entering emergency or single-user mode, editing fstab, using UUID and the nofail option.
- If GRUB becomes corrupted, it can be easily reinstalled from a LiveCD by mounting the system and using chroot.
- Separating partitions, maintaining backups, and updating carefully greatly reduces the risk of new boot failures.
When a GNU/Linux system fails to boot or takes an eternity to start, many people immediately think of reinstalling the distribution. However, in a very high percentage of cases, the problem has a name and a face: errors in /etc/fstab or in the GRUB bootloader . The good news is that, with a little patience and by following a series of steps, it's possible to recover the system without losing any data.
Throughout this guide, we'll see, in a practical way, how to detect and fix a boot problem caused by a misconfigured fstab file from GRUB , using real-world examples (physical machines, VMs in Google Cloud and Azure, and even dual boot with Windows). We'll also review other common boot errors in Linux and how to deal with them without getting overwhelmed.
What is fstab and why might it prevent your Linux system from booting?
The file /etc/fstab It is a configuration table where it is defined which file systems are mounted at startup, at what mount point, with what options, and in what orderIt is a static file that the system reads during startup; if something is wrong there, the kernel and systemd can get stuck waiting for devices that do not exist or do not respond.
A very common error is that, after formatting or disconnecting a disk, fstab continues to point to a non-existent partition or UUID . The result is a message like this:
Timed out waiting for device dev-incorrect.device
Dependency failed for /data
Dependency failed for Local File Systems
Welcome to emergency mode!
In virtual machines (Google Cloud, Azure, etc.) the symptom is almost identical: the kernel tries to mount a file system defined in fstab for a point such as /data or /distribution , it cannot find it, the waiting time runs out and the system enters emergency mode asking for the root password or leaving you stranded in GRUB.
Furthermore, a single misspelled option can prevent startup. For example, instead of using `errors=remount-ro` (which mounts the root directory read-only if errors occur), someone might write `errors=remount-rw` . This option is invalid and can cause unusual behavior, ranging from mounting failures to systems that boot intermittently or freeze during the boot process.
Real-world examples of boot failures caused by fstab and GRUB
To fully understand the problem, it's helpful to review several real-world cases that summarize almost everything that can go wrong with fstab and GRUB on a desktop or server Linux system.
In the first case, a user installs Linux Mint on a 1 TB HDD, then realizes they want the system on an SSD , reinstalls it on the SSD, and formats the old HDD . The system starts taking about two minutes to boot, hangs after GRUB and the Mint logo, displays emergency mode text, and then finally boots. After investigating, they discover a line in their fstab file:
UUID=745C-ACA6 /boot/efi vfat umask=0077 0 1
The problem is that the UUID no longer exists, and the /dev/sda2 partition disappeared when the disks were reconfigured, but the entry remains. The system tries to mount the missing EFI partition, waits, the dependency fails, and that's why it's delayed and in emergency mode.
In another scenario, someone connects an external drive, lets a graphical tool update fstab to automatically mount it, and then disconnects or reformats it. On the next reboot, the system freezes because fstab contains an entry pointing to a USB device that is no longer present , lacking the appropriate option to allow booting if it fails.
Furthermore, this same person encounters a root directory mounted with the option errors=remount-rw instead of errors=remount-ro . After manually changing it to "ro", they manage to boot, but every time they access the external drive and update fstab, the problem returns: the new entry is added, the system doesn't mount correctly, fstab becomes read-only, and they can't save the changes without remapping the file system to read-write.
In cloud environments like Google Cloud or Azure, the pattern is repeated: an extra data disk is added, it is defined in /etc/fstab Using a device or UUID, the disk is erased or disconnected, and on the next boot The VM crashes into emergency mode with a failed dependency message for /data, /distribution, or similar. Here, the difference is that the problem is usually fixed using console series, single-user mode or even automatic repair tools (such as Azure Linux Auto Repair, ALAR).
Typical symptoms of a broken fstab and how to identify them from GRUB
When fstab is the culprit, you will almost always see some of these symptoms during startup:
- Long stop after GRUB, with the screen showing kernel messages and systemd trying to mount file systems.
- Messages of the type “Timed out waiting for device…” and “Dependency failed for /data”, “Dependency failed for Local File Systems”.
- Entry into emergency mode, which asks for the root password or offers you commands , the
journalctl -xb,systemctl rebootosystemctl default. - In some distributions, the option to press Ctrl + D to continue and for the system to eventually boot, but with some file systems not mounted.
If you only see the distro logo or a boot animation, it is highly recommended to enable the verbose moodTo do this, you can temporarily edit a GRUB entry in the menu itself, or modify the file /etc/default/grub when you have access:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" → GRUB_CMDLINE_LINUX_DEFAULT=""
Then you execute update-grubOn the next startup, the system will display all boot linesmaking it easier to see exactly where it gets stuck and which device is causing the problem.
Additionally, for a more thorough analysis, you have several very useful log files: /var/log/boot.log (boot messages), /var/log/messages (general log), dmesg (kernel messages), and journalctl . If the system no longer boots, you can boot from a Live CD or a Live distribution, mount the system disk, and review these files from there, applying boot profiling techniques.
How to fix fstab from emergency mode or single user mode
In many server distributions and VMs, when fstab fails, the system enters emergency mode . From there, if you have the root password, you can log in and fix the file without needing a Live CD.
The general steps would be:
- Enter the console (cloud series or local screen) and authenticate as root when prompted.
- Edit
/etc/fstabwith your favorite editor: for example,vi /etc/fstabonano /etc/fstab. - Locate the problematic entry (the one that refers to the device or mounting point shown in the error message), and comment on it or correct itCommenting is as simple as putting a
#at the beginning of the line. - Save your changes and exit the editor. In vi, for example, ESC + :wq!.
- Run
mount -ato check for syntax or assembly errors. If it doesn't return anything unusual, the configuration is reasonable. - Restart with
rebootand check if the system starts normally.
If you don't have a root password (a common scenario with cloud images), you can force single-user mode from GRUB or the VM's boot manager. The trick is to edit the kernel line in GRUB and add an extra parameter:
- On systems like RHEL, CentOS, Oracle Linux or SUSE, add rd.break.
- In Ubuntu 18.04, 20.04, 22.04, add systemd.unit=rescue.target to enter rescue mode.
Once in that confined environment, one must trace the root in read/write mode (By default, it may be read-only). Then, you edit again. /etc/fstabYou review the entries, save, and restart. The pattern is always the same: correct the table, check with mount -ay restart.
Best practices when editing /etc/fstab: UUID, nofail, and errors=remount-ro
Before making changes haphazardly, it's a good idea to understand a few basic rules about fstab that will save you a lot of trouble in the future.
The first is that, whenever possible, you should mount your file systems by UUIDnot by traditional device names like /dev/sda1The reason is that the order of the disks can change (you add or remove drives, change ports, etc.) and suddenly what was sda1 becomes sdb1. The UUID, on the other hand, is a unique identifier that remains as long as you don't reformat the partition.
To see the UUIDs of your partitions, you can use blkid or lsblk -f . A typical fstab entry with UUIDs would look like this:
UUID=<UUID_aquí> /data xfs defaults,nofail 0 0
The second key recommendation is to use the option nofail for all file systems that They are not strictly necessary to start (for example, data disks, external drives, etc.). With nofailIf a disk is disconnected, damaged, or simply slow to appear, the system will not hang at startup: it simply will not mount that point, but will continue.
Finally, always check the `errors=` option in the root directory. The correct way to use ` errors=remount-ro` in ext4 is to use `errors=remount-ro` , which causes the file system to remount in read-only mode if errors are detected, thus protecting the data. Using something made up like `errors=remount-rw` is a bad idea: it's not a valid option and can cause the opposite of what you want, as well as prevent the system from responding properly to errors.
When GRUB also breaks: Repairing the boot manager step by step
Not all boot problems originate from fstab. Very often, GRUB itself is corrupted or incorrectly installed: for example, after enlarging, moving, or deleting partitions, or after installing Windows over an existing Linux installation (Windows often overwrites the MBR/EFI without asking).
A fairly typical scenario is seeing a message like "Grub Loading stage 1.5 – Error 5" on the screen and being unable to boot into either Linux or Windows, or messages like " No bootable device ". This can be because GRUB is trying to load its second stage from a sector or disk that no longer corresponds to reality (the partition table has been moved or changed, the order of the SATA disks has been altered, etc.).
The classic solution, which works on most Debian-based distributions (Ubuntu, Mint, Debian, Kali, etc.), consists of reinstall GRUB from a LiveCD or LiveUSB first assembling the damaged system and using chrootIn short, the recipe would be:
- Boot from a LiveCD/LiveUSB compatible with your architecture (amd64, i386, etc.).
- Identify which partition is the root of your Linux system and, if it exists, the /boot partition, with
sudo fdisk -lolsblk. - Mount the root on
/mnt, and the boot (if there is one) in/mnt/boot. - Mount also
/dev,/dev/pts,/procy/syswithin/mntusingmount --bind. - Run
sudo chroot /mntto "enter" the system as if you had started from it. - Reinstall GRUB pointing to the correct disk (not the partition, the disk):
/dev/sda(for example) withgrub-install --boot-directory=/boot/ --recheck /dev/sda. - Regenerate the configuration with
grub-mkconfig -o /boot/grub/grub.cfg. - Exit chroot with
exitand restart withsudo reboot.
If everything went well, on the next boot you should see the GRUB menu again with your operating systems and be able to start your GNU/Linux distribution again, and even Windows if you are in dual boot.
Other common Linux boot problems (beyond fstab)
While fstab and GRUB bear much of the blame, other factors can cause your Linux system to fail to boot. Keeping these in mind helps you avoid focusing solely on one file when the problem originates elsewhere.
Among the most frequent reasons are:
- Damaged or misconfigured boot partition: corrupt /boot or ESP partition, missing the correct flag or with incomplete boot files.
- Kernel update failed or incompatibleThe new core doesn't work well with your hardware, or the installation is left unfinished.
- System patch or update that breaks key services: systemd cannot start all the necessary daemons and the system hangs.
- Drivers troublesome- Mostly proprietary GPU drivers or hand-installed peculiar hardware.
- MBR/EFI overwritten by Windows in dual boot configurations.
- Windows Quick Start that maintains the partition NTFS semi-hibernated and prevents Linux from touching it.
- Conflicting UEFI/Secure Boot configurationThe BIOS/UEFI does not point to the correct disk or the distro does not support Secure Boot.
- Hardware issues: Faulty RAM, hard drive about to die, unstable power supply, etc.
Before going crazy with configurations, it's usually a good idea to check that the BIOS/UEFI correctly detects the disk where Linux is installed, that the boot order is consistent, and that there is no MBR protection enabled by the chipset that prevents writing the boot manager.
It's also recommended to run MemTest86+ from GRUB to check the RAM (running it several times) and use SMART tools (such as smartmontools from a LiveCD) to check the disk status. Values like Reallocated_Sector_Ct or Current_Pending_Sector_Ct greater than zero are a bad sign and may indicate that the disk is nearing the end of its life.
Rescue tools: recovery mode, Boot-Repair, fsck and fdisk
If you manage to reach GRUB and see the "advanced options" of your distribution, you have several very useful rescue modes at your disposal. Most distributions offer a Recovery Mode for each installed kernel that allows you to:
- Run fsck on the root partition and others, correcting file system errors.
- Launch clean to free up space that is being used unnecessarily.
- Use dpkg to repair broken packages or incomplete installations.
- Update GRUB from the recovery menu itself.
In other scenarios, especially after modifying partitions, the classic fdisk and fsck tools remain essential. From a LiveCD, you can:
- List partitions with
fdisk -lto locate where your Linux is installed (often /dev/sda1, /dev/sda2, etc.). - Check and repair a partition with
sudo fsck /dev/sda1(changing sda1 to the corresponding one).
However, it's crucial to remember that fsck and fdisk can destroy data if misused . It's always advisable to create a backup before touching anything critical, and if you don't have one, proceed with extreme caution.
In the field of automation, cloud services like Azure offer mechanisms such as Azure Linux Auto Repair (ALAR) , which can automatically fix fstab problems without you having to intervene manually: they mount the system disk in a repair VM, make a copy of the fstab, comment out conflicting entries (especially those with non-nofail data), and return the repaired disk to the original VM.
What to do when the only solution seems to be reinstalling Linux
If, after struggling with fstab, GRUB, recovery modes, and other tools, you still can't get your system to boot reliably, it might be time to consider reinstalling the distribution . It's not the ideal scenario, but, if done correctly, it shouldn't result in data loss.
Many modern Linux distributions (Ubuntu, for example) allow you to reinstall the system while preserving user data and even many applications. The installer detects the existing installation and offers the option to reinstall without affecting your home directory. Even so, it's always highly recommended to back up important documents beforehand, just in case something goes wrong.
On desktop computers or portable Where you control the partitioning, it makes a lot of sense to separate from the beginning. three partitions: one for /boot, another for the system (/) and another for the data (/home or a separate data partition). This way, if you ever need to reinstall, you only need to format the boot and system partitions, leaving the data partition untouched.
In virtual machines, something similar can be achieved by mounting the data on separate disks and correctly using UUID and nofail in fstab, so that the system boots even if one of those disks is temporarily absent.
Tips to prevent the problem from happening again
After having gone through the ordeal of a Linux system that won't boot, it's worth taking some precautions to avoid being left stranded again with the slightest maintenance operation.
One of the most important is to take special care when edit critical configuration files , the /etc/fstab or the GRUB and UEFI files. Before touching anything, make a copy of the original file, for example by renaming it to fstab.bakIf you mess things up, you can always restore the old version from a LiveCD or a rescue environment.
Another good practice is Avoid relying on external or USB drives in fstab Unless absolutely necessary. If you need to mount them automatically, always use UUID, the option nofail And if the file system isn't essential, consider whether mounting it "on demand" from the file manager or with a script manual.
At the system level, keeping Linux and its kernel updated helps correct errors, bugs, and compatibility issues that can lead to boot failures. However, it's advisable not to update indiscriminately in production environments and to always have a previous kernel installed in GRUB to boot if the new version isn't compatible with your hardware.
Ultimately, no technical mechanism can replace good backups . Whether you use your computer as a home desktop or work with VMs in the cloud, having a clear backup plan (to another partition, another disk, or the cloud) is the difference between a minor scare and a total disaster the day your disk decides to fail or your system becomes irreparably corrupted.
Mastering how fstab, GRUB, and Linux rescue tools work turns a boot error from a dramatic event into a simple setback that you can resolve in minutes, and allows you to have much more control over your system, both on your personal PC and on physical or virtual servers.
Table of Contents
- 1 What is fstab and why might it prevent your Linux system from booting?
- 2 Real-world examples of boot failures caused by fstab and GRUB
- 3 Typical symptoms of a broken fstab and how to identify them from GRUB
- 4 How to fix fstab from emergency mode or single user mode
- 5 Best practices when editing /etc/fstab: UUID, nofail, and errors=remount-ro
- 6 When GRUB also breaks: Repairing the boot manager step by step
- 7 Other common Linux boot problems (beyond fstab)
- 8 Rescue tools: recovery mode, Boot-Repair, fsck and fdisk
- 9 What to do when the only solution seems to be reinstalling Linux
- 10 Tips to prevent the problem from happening again
