> For the complete documentation index, see [llms.txt](https://docs.glesys.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.glesys.com/products/storage/block-storage/how-tos/rescue-a-linux-vm-that-doesnt-boot.md).

# 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**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FlZ6OmuU7oTWIZEpEQeoA%2Fblock-storage-console1.png?alt=media&amp;token=120e15b4-36bc-4bda-b96f-7e57076c85f9" alt=""><figcaption></figcaption></figure>

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 <kbd>e</kbd> on your keyboard. The GRUB menu will look a bit different between Linux distributions, but will look something like below.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FKet1hlXIRgVO6f2b1yjc%2Fblock-storage-console3.png?alt=media&amp;token=810f8b93-c7eb-4638-9d04-e8d7c64c8f99" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FPo1xPqXwTaSlSXIsU6ZS%2Fblock-storage-console4.png?alt=media&amp;token=f5d553ea-dfde-4e35-b1bf-8240c420d9d6" alt=""><figcaption></figcaption></figure>

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.

<pre data-title="Command"><code><strong>mount / -rw -o remount
</strong></code></pre>

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.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FWn0uivCwd7lvN37sBUCs%2Fblock-storage-console5.png?alt=media&amp;token=a4ab60c7-1ef0-449c-86c9-b6b15882e542" alt=""><figcaption></figcaption></figure>

To make sure the edit sticks, execute the `sync` command.

<pre data-title="Command."><code><strong>sync
</strong></code></pre>

{% hint style="warning" %}
If the server is running **AlmaLinux** or **Fedora**, you need to execute the following command now, before rebooting the server:

{% code title="Command" %}

```
touch /.autorelabel
```

{% endcode %}
{% endhint %}

Finally, reboot the VM by clicking **Actions** and selecting **Reset** in the control panel.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FE80Vzk12so4jCCt5zdad%2Fblock-storage-console6.png?alt=media&amp;token=1d84f595-8a83-4049-ba60-27a386e10640" alt=""><figcaption></figcaption></figure>

The server should now boot normally into multi-user mode, and you can log in via SSH.
