In this article, we’ll troubleshoot fstab repair filesystem errors. Misconfigured /etc/fstab can cause boot time errors and we unable to boot the system. We cannot use the rescue.target to fix an /etc/fstab error.
In order to resolve the issue, we need to use the emergency.target.
Troubleshoot fstab Repair Filesystem Errors
Important: After editing the /etc/fstab file in emergency mode, you must run the following for safety measures:
# systemctl daemon-reload
Here is a walkthrough example of booting into emergency mode to remove a false entry in /etc/fstab.
- Interrupt the grub2 menu by pressing “e” to edit when prompted with the grub menu.
- Find the line that specifies the kernel version (vmlinuz) and append the following to it: systemd.unit=emergency.target
- Press “Ctrl+x” to boot.
- You will be prompted with the root password to continue.
- Remount / so that we can make changes to the fstab file: # mount -oremount,rw /
- We can use the mount command to see which entry is causing the error: # mount -a
- Remove the offending entry from the fstab file.
- Use mount -a again to make sure the error has been resolved.
- Use systemctl daemon-reload to reload all unit files, and recreate the entire dependency tree.
Once you exit the emergency shell, the system will finish booting from the emergency target. Now, you have gained your server access.
In this article, we have troubleshoot fstab repair filesystem errors.