Ubuntu : Recovering from /etc/fstab mistake

I wasted a bit of time on this today, so I decided to post the situation and a fix if it comes up for others.

I am running Ubuntu on a VM in HyperV. I edited the mount entry for a Windows share in /etc/fstab but made a mistake on the password.

Afterward, Ubuntu would not boot all the way though, it would get stuck on the boot screen with the message “Press S to skip mounting or M for manual recovery”. Well there is some issue here because at least in the hyperv machine connection, the M and S keys had no effect [note: key order intentionally reversed in last sentence to avoid unintended SEO 😉 ].

looking for solutions, I came up with some that recommended using fdisk etc. but I think those solutions are dated. The solution for me was:

1) In HyperV settings, Load Ubuntu Desktop ISO into DVD drive, in firmware set to boot first.
2) When the ISO image loads, it will offer an option to try Ubuntu without installing, select this.
3) Once the desktop is loaded, run terminal by pressing Ctrl-Alt-T

4) then run:

sudo gparted

if gparted isn’t installed, run the command

sudo apt-get install gparted

5) Inspect the drives listed in the GUI, just from what I knew about the drive sizes, I was able to determine the OS drive was ‘/dev/sda3’ and the file system type was listed as ‘ext4’

I then mounted this

sudo mount -t ext4 /dev/sda3 /mnt

Afterward I edited the /etc/fstab file, fixed the issue and then rebooted

sudo gedit /mnt/etc/fstab

Also, I added the “nobootwait” and “nofail” options to the fstab entry, and will add to future similar entries, so as not to have this issue again


References


nofail and nobootwait mount options in fstab prevent boot problems : http://techmonks.net/nofail-and-nobootwait-mount-options-in-fstab-prevent-boot-problems/

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

OR

LOGIN OR REGISTER

Registered users with one approved comment can comment without moderation