Bypassing Bad fstab Failure When Booting Linux

Bypassing Bad fstab Failure When Booting Linux

fstab bad

fstab bad

Usually you can enter root password and try to edit fstab, but it wouldn’t let you edit. because its read-only mode. so here is the method to work-around that.

If /etc/fstab file is created with errors or the hardware configuration changes such as adding hard disks, Linux will boot into failure state. We can bypass the fstab failure by adding booting parameters to Linux. We can do this in two methods:

Method 1: Boot to single user mode

When booting into single user mode, Linux will not mount anything. Then we can remount the / to some directory in read/write mode and then edit the/etc/fstab.

1. Boot Linux into single user mode

Press ESC in the grub menu and press ‘e’ to edit the grub entry. Add single to the kernel parameter like this:

Boot CentOS

Boot CentOS

Add Single Mode to Boot

Add Single Mode to Boot

Then press ‘b’ to boot Linux.

2. Remount / in read/write mode

# mount -n -o remount,rw /

3. Edit /etc/fstab

If the above method doesn’t work, the second method can be used:

Method 2: Add init=/bin/bash to kernel parameter

Add

rw init=/bin/bash

for example

mount -n -o remount,rw init=/bin/bash /

to kernel parameter. Linux will boot and we will get a bash prompt. The / is mounted in read/write mode. We can then edit /etc/fstab file and reboot.