Ubuntu Boot Failure
I had an external HDD plugged in with my Optiplex machine which runs Ubuntu 22.04.4 LTS where I host several self hosted stuff. The external HDD is used to backup the config files of docker containers, some important files and all the photos I’ve backed up using Immich using Restic.
Recently my machine started failing to boot. No matter what password I typed in, it failed to go past this stage. All i got was
Give root password for maintenance (or type Control-D to continue):
After some google-fu, I came to the conclusion that the boot failure was due to the wrong entry in fstab
. To automatically mount the external HDD, I had an fstab
entry that mounts the HDD to a mount point. Due to some reason, the device label changed from sdc
to sdb
which failed Ubuntu to find the drive and mount it at boot.
This could’ve been avoided easily by adding nofail
to the fstab
entry so that Ubuntu will continue to boot even in the absence of the drive. The steps I followed was:
- Root access
- Press
esc
at the boot to enterGRUB
menu - Press
e
to change boot parameters - Append
rw init=/bin/bash
at the end of the line starting withlinux...
- Press
ctrl + x
to exit - This will take you to shell with root access
- Press
- Modify
fstab
- Change the wrong device name
- Add
nofail
to the entry - Final fstab entry would look like
/dev/sdb1 /mnt/external ext4 defaults,nofail 0 2
- That’s it
Now my machine boots up normally