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 -fThe 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 /mntIf /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; donechroot /mnt /bin/bashYou 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 rootOr 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/vdbRHEL 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
exitumount -R /mntDisable 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/bashexists. - XFS will not mount: run
xfs_repair /dev/vdb1(unmounted). For ext4 usefsck -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.
