> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Fix a Linux Server That Won't Boot (Emergency Mode, fsck)

> Linux server not booting or stuck in emergency mode? Read the error on the console, fix /etc/fstab, run fsck from rescue mode, or boot an older kernel.

When a Linux server won't boot, the console shows why. Most often a wrong line in `/etc/fstab` drops it into emergency mode, a damaged filesystem needs `fsck`, or a new kernel fails to start. Open the VNC console, read the last messages, then fix `/etc/fstab`, repair the filesystem from rescue mode, or pick the previous kernel in the GRUB menu.

```text theme={null}
You are in emergency mode. After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, or "exit"
to continue bootup.
```

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Advanced | 15 to 45 minutes | Ubuntu 22.04 / 24.04, Debian 12 / 13, AlmaLinux and Rocky Linux 9 / 10 | VNC console and rescue mode, root password |

## Before you start

* On a VPS, open the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md) to see the screen. For repairs on a system that can't start at all, use [rescue mode](https://help.freakhosting.com/portals/vps-panel/how-to-use-rescue-mode.md). On a dedicated server, [open a ticket](https://freakhosting.com/clientarea/submitticket.php) for KVM/IPMI access.
* Emergency mode asks for the **root** password. If you never set one, [reset the root password](https://help.freakhosting.com/portals/vps-panel/how-to-reset-your-vps-root-password.md) or work from rescue mode.
* If you have [backups](https://help.freakhosting.com/portals/vps-panel/how-to-schedule-and-restore-backups.md), note which one is the latest before you change anything.

> [!WARNING]
>
> Never run `fsck` or `xfs_repair` on a filesystem that is mounted read-write. It can destroy data. Run it at the initramfs prompt, or from rescue mode with the disk not mounted.

## Step 1: Read what the console says

| Message on the console | Go to |
| - | - |
| `You are in emergency mode`, often after `Timed out waiting for device` | Cause 1 |
| `UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.` or an `(initramfs)` prompt | Cause 2 |
| `Kernel panic - not syncing: VFS: Unable to mount root fs` | Cause 3 |
| `grub>` or `grub rescue>` prompt | Cause 4 |

In emergency mode, log in as root and read the reason:

```bash theme={null}
journalctl -xb -p err
```

## Cause 1: A wrong line in /etc/fstab

`/etc/fstab` lists the disks to mount at boot. A typo, a wrong UUID or a removed disk makes systemd wait, give up and stop in emergency mode.

**Check** (in emergency mode):

```bash theme={null}
findmnt --verify
```

```text theme={null}
/data
   [E] unreachable on boot required source: UUID=0000-bad
```

**Fix:**

**1. Make the root filesystem writable**

```bash theme={null}
mount -o remount,rw /
```

**2. Correct or disable the bad line**

```bash theme={null}
nano /etc/fstab
```

Put `#` in front of the line `findmnt` reported, or fix its UUID (list real ones with `blkid`). For extra disks that may be missing, add `nofail` so the boot continues without them:

```ini theme={null}
UUID=943979e7-208a-4c8f-ae48-4ed15cf17130  /data  ext4  defaults,nofail  0  2
```

**3. Check and reboot**

```bash theme={null}
findmnt --verify
systemctl daemon-reload
systemctl reboot
```

## Cause 2: The filesystem needs a check

After a crash or a forced power-off, a filesystem can have errors that the automatic check at boot won't fix on its own.

**Fix at the initramfs prompt** (Ubuntu and Debian often stop here with the device name in the message):

```bash theme={null}
fsck -y /dev/vda1
exit
```

Use the device from the message. `-y` answers "yes" to every repair.

**Fix from rescue mode** if there's no prompt, or for XFS (the default filesystem on AlmaLinux and Rocky):

**1. Start rescue mode and find the disk**

Start [rescue mode](https://help.freakhosting.com/portals/vps-panel/how-to-use-rescue-mode.md), connect, then list disks and filesystems:

```bash theme={null}
lsblk -f
```

**2. Repair the filesystem without mounting it**

> [tab] ext4 (Ubuntu / Debian)
>
> ```bash theme={null}
> e2fsck -f -y /dev/vda1
> ```

> [tab] XFS (AlmaLinux / Rocky)
>
> ```bash theme={null}
> xfs_repair /dev/vda1
> ```
>
> If it refuses because of a dirty log, mount and unmount the filesystem once to replay the log, then run `xfs_repair` again.

**3. End rescue mode**

End the rescue session in the panel. The server boots normally.

If LVM is used (`lsblk -f` shows `LVM2_member`), run `vgchange -ay` first and repair the logical volume, for example `/dev/mapper/almalinux-root`.

## Cause 3: A new kernel doesn't start

A kernel panic straight after an update often means its initramfs (the small startup image) is missing or incomplete.

**Fix:** boot the previous kernel, then rebuild the initramfs.

**1. Open the GRUB menu**

Reboot from the panel and watch the VNC console. On Ubuntu the menu is hidden: hold **Shift** (BIOS) or press **Esc** (UEFI) as the server starts. Choose **Advanced options for Ubuntu** and an older kernel. On AlmaLinux and Rocky, press an arrow key when the kernel list appears to stop the countdown, then pick the older entry.

**2. Rebuild the initramfs**

> [tab] Ubuntu / Debian
>
> ```bash theme={null}
> sudo update-initramfs -u -k all
> sudo update-grub
> ```

> [tab] AlmaLinux / Rocky
>
> ```bash theme={null}
> sudo dracut --regenerate-all -f
> ```

**3. Reboot into the newest kernel**

Reboot without choosing anything. If it fails again, keep using the older kernel and look for a free-space problem in `/boot` (`df -h /boot`).

## Cause 4: The bootloader is broken

A `grub rescue>` prompt means GRUB can't find its files, for example after a partition change. Start [rescue mode](https://help.freakhosting.com/portals/vps-panel/how-to-use-rescue-mode.md), mount the disk and copy your important data off first. Then [open a ticket](https://freakhosting.com/clientarea/submitticket.php) or [rebuild the server](https://help.freakhosting.com/portals/vps-panel/how-to-rebuild-and-reinstall-your-vps.md). Check that the [boot type](https://help.freakhosting.com/portals/vps-panel/how-to-configure-boot-type-bios-vs-uefi.md) matches how the system was installed.

## How to check it worked

The console shows a normal login prompt, and after login:

```bash theme={null}
systemctl --failed
```

```text theme={null}
0 loaded units listed.
```

## Frequently asked questions

### Emergency mode says "the root account is locked". What now?

Ubuntu doesn't set a root password by default, so emergency mode can't open a shell. Use rescue mode, mount the disk and edit `/etc/fstab` there (`/mnt/etc/fstab` once mounted on `/mnt`).

### Will fsck delete my files?

It repairs the filesystem's structure. Damaged files may end up in `lost+found` or be lost, which is why a backup comes first when you can.

### The server boots but SSH doesn't work. Is that the same problem?

No. See [SSH connection refused](https://help.freakhosting.com/portals/other/how-to-fix-ssh-connection-refused.md) and [SSH connection timed out](https://help.freakhosting.com/portals/other/how-to-fix-ssh-connection-timed-out.md).

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Read-only file system errors](https://help.freakhosting.com/portals/other/how-to-fix-read-only-file-system-errors.md)
>
> When the disk stops accepting writes.

> [card] [Mount a new disk](https://help.freakhosting.com/portals/other/how-to-mount-a-new-disk-on-linux.md)
>
> Safe fstab entries with nofail.

> [card] [Read logs with journalctl](https://help.freakhosting.com/portals/other/how-to-read-logs-with-journalctl.md)
>
> Find the boot error in the log.

> [card] [Rescue mode](https://help.freakhosting.com/portals/vps-panel/how-to-use-rescue-mode.md)
>
> Repair a VPS that won't start.

***

> [!NOTE]
>
> **Checked against the official systemd source for the emergency mode message, the [fstab](https://man7.org/linux/man-pages/man5/fstab.5.html), [findmnt](https://man7.org/linux/man-pages/man8/findmnt.8.html), [e2fsck](https://man7.org/linux/man-pages/man8/e2fsck.8.html) and [xfs\_repair](https://man7.org/linux/man-pages/man8/xfs_repair.8.html) manuals** on 4 November 2026; `findmnt --verify` with a bad fstab line, `e2fsck` and `xfs_repair` on unmounted test filesystems and the `update-initramfs` and `dracut` options were checked on Ubuntu 24.04 LTS. Booting, the GRUB menu and LVM steps were not tested.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.