Linux VPS

Repair an unbootable Linux VPS from rescue mode with chroot

Boot a broken VPS into a rescue system, find and mount its disk, chroot into it, then fix common problems: bad fstab, broken GRUB, lost SSH access, full disk or a failed kernel update.

AdvancedLinux VPS2 min read

When a VPS will not boot or you are locked out, rescue mode boots a separate minimal Linux system with your disk attached. From there you can mount the disk, chroot into your installed system and fix it as if it were running. This guide covers the generic steps for any KVM VPS.

Before you start

  • Rescue mode or a rescue ISO from your VPS panel. Panel-specific steps: Virtualizor rescue mode.
  • The rescue system's login details, shown by the panel.
  • The VNC console to see boot errors; see VNC console access.

Find your disk

lsblk -f

The rescue system's own disk is usually small or a RAM disk; your VPS disk might be /dev/vdb or /dev/sdb, with the root filesystem on a partition such as /dev/vdb1. For LVM run vgchange -ay first and look in /dev/mapper/.

Mount and chroot

mount /dev/vdb1 /mnt

If /boot or the EFI partition are separate, mount them under /mnt/boot and /mnt/boot/efi. Then bind system directories and enter:

for d in dev proc sys run; do mount --rbind /$d /mnt/$d; done
chroot /mnt /bin/bash

You are now working inside your VPS's OS.

Fix common problems

Bad /etc/fstab entry

A wrong UUID or removed disk drops boot into emergency mode. Edit /etc/fstab, compare with blkid, and add nofail to non-essential mounts.

Reset root password or SSH keys

passwd root

Or add your public key to /home/user/.ssh/authorized_keys, and revert SSH config mistakes in /etc/ssh/sshd_config.

Firewall locked you out

Disable it at boot: systemctl disable ufw or systemctl disable firewalld, then fix rules after logging in.

Broken GRUB or kernel update

Debian/Ubuntu:

apt install --reinstall linux-image-generic grub-pc && update-grub && grub-install /dev/vdb

RHEL family: reinstall the kernel with dnf reinstall kernel-core and run grub2-mkconfig -o /boot/grub2/grub.cfg. On UEFI systems, reinstall the EFI GRUB package instead of grub-install to a disk.

Disk full

Free space with du -xh / | sort -h | tail, clear old logs or apt clean. See check disk usage.

Exit and reboot

exit
umount -R /mnt

Disable rescue mode in the panel and reboot normally. Watch the VNC console for errors.

Troubleshooting

  • "mount: wrong fs type": you picked the wrong partition, or it is LVM or encrypted.
  • chroot: failed to run command: architecture mismatch or the wrong mount; check /mnt/bin/bash exists.
  • XFS will not mount: run xfs_repair /dev/vdb1 (unmounted). For ext4 use fsck -f.

Frequently asked questions

Will rescue mode delete my data?

No. It boots a separate system; your disk is only changed by what you do.

Can I copy data off in rescue mode?

Yes, mount the disk and use rsync or scp to another server.

When should I reinstall instead?

When the system is badly damaged or compromised. Copy data off first.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.