Rescue a Linux VM that doesn't boot
In case you've detached and deleted a volume that is automatically mounted via /etc/fstab without the nofail option, Linux will refuse to boot.
Forgetting to delete or comment out a volume mount in /etc/fstab that doesn't have the nofail option will prevent the VM from booting. To fix it, you need to reboot the server in single-user mode and either delete or comment out the mount.
It's also possible to fix /etc/fstab in what's called rescue mode. But to access that mode, the root user will have to have a password set beforehand, which isn't the default.
Here we'll cover how to boot the VM into single-user mode and delete the offending line from /etc/fstab without having a root password.
Open the console for the VM that doesn't boot by clicking Actions and selecting Console.

If you have tried to restart the VM already, most likely it's stuck in rescue mode or emergency mode. In that case, click the Send Ctrl-Alt-Del button in the upper-left corner of the console.
The VM will now restart. Once the GRUB menu appears, quickly hit e on your keyboard. The GRUB menu will look a bit different between Linux distributions, but will look something like below.

Once you've hit e, you enter an editor. At the end of the line that starts with linux /vmlinuz, add init=/bin/bash. Then, press Ctrl+x to boot the VM.

After a while, a prompt will appear looking like this: root@localhost:/# or something similar.
By default, the root partition is mounted read-only. Start by remounting it in read-write mode.
Then, edit the /etc/fstab file with vi or nano (or your preferred editor). Comment out or delete the line with the old volume that's no longer available. In the image below, the offending line has been commented out with a bracket (#). Save the file and exit the editor.

To make sure the edit sticks, execute the sync command.
Finally, reboot the VM by clicking Actions and selecting Reset in the control panel.

The server should now boot normally into multi-user mode, and you can log in via SSH.
Last updated
Was this helpful?