Guide to Rescuing Ubuntu VPS Boot Using SystemRescue and Restoring GRUB
Procedure for rescuing an unbootable Ubuntu VPS due to missing GRUB or /boot directory using SystemRescue 13.01, applicable to GPT disks running Legacy BIOS.
Ubuntu VPS may fail to boot after partition, kernel, or GRUB corruption. In the event that the system loses the entire folder/boot, only re-runningupdate-grubis usually not enough because the machine no longer has a kernel and initramfs to load the operating system.
This article guides the rescue procedure usingSystemRescue 13.01, based on a successful recovery case with Ubuntu 24.04 LTS, VirtIO disk/dev/vda, GPT partition table, and Legacy BIOS firmware.
Important warning:partition creation commands andgrub-installcan make the VPS unbootable if the wrong drive or sector is selected. Verify the actual disk layout before running. In this example, GRUB is installed on the entire drive/dev/vda, not/dev/vda1or/dev/vda2.
1. Scope of Application
The procedure below is written for the following sample structure. If your VPS has a different structure, replace it with the correct device name and corresponding GRUB installation method.
| Components | Sample case | When other systems |
|---|---|---|
| System drive | /dev/vda | Can be/dev/sdaor/dev/nvme0n1 |
| Root filesystem | /dev/vda1, ext4, label root | Select the correct target partition/etc/os-release |
| Firmware | Legacy BIOS | If UEFI, do not use targeti386-pc |
| Partition table | GPT | MBR drive requires no partitionbios_grub |
| Operating system | Ubuntu 24.04 LTS | RHEL, AlmaLinux, and Rocky Linux use different GRUB command names |
2. Boot VPS from ISO SystemRescue
- Attach file
systemrescue-13.01-amd64.isointo the VPS from the provider's control panel. - Move CD/DVD/ISO to the top of the boot order.
- SelectBoot SystemRescue using default options.
- Wait for the prompt
[root@sysrescue ~]#. SystemRescue will automatically log in as root.
You can try the sectionBoot a Linux operating system installed on the disk (findroot)first. If you still cannot access Ubuntu, return to default boot mode and proceed with the steps below.
3. Identify Drive, Root Partition, and Firmware
Before changing any data, use the following read-only commands to confirm drive names, filesystems, UUIDs, and firmware mode:
lsblk -f
lsblk -o NAME,SIZE,TYPE,FSTYPE,LABEL,UUID,MOUNTPOINTS
fdisk -l /dev/vda
test -d /sys/firmware/efi && echo UEFI || echo BIOSIn the sample case, the results to be identified include:
/dev/vda25 GiB capacity is the VirtIO drive of the VPS./dev/vda1use ext4, labelrootand contains Ubuntu.Disklabel type: gptconfirm that the drive uses GPT.- Result
BIOSconfirm that the ISO is booting in Legacy BIOS mode.
Next, mount the root partition and verify the correct operating system:
mount /dev/vda1 /mnt
cat /mnt/etc/os-release
cat /mnt/etc/fstab
ls -lah /mnt/bootIn the sample case,/etc/os-releasereturns Ubuntu 24.04.4 LTS, while/mnt/bootalertNo such file or directory. This indicates that the boot directory is missing.
If/etc/fstabhas a dedicated mount line for/boot, you must locate and mount the correct partition. Do not manually create/booton root following step 4.
4. Create BIOS Boot Partition on GPT Drive
Legacy BIOS combined with GPT requires a small partition of typeEF02for GRUB to savecore.img. In the sample case, the root partition starts at sector4096, therefore, the free space from sector can be used2048to4095, equivalent to 1 MiB.
4.1. Back Up GPT Partition Table
sgdisk --backup=/mnt/root/vda-gpt-before-grub.bin /dev/vdaUpon success, the command returnsThe operation has completed successfully.. Keep this backup file until you have confirmed that the VPS is running stably.
4.2. Create BIOS Boot Partition
sgdisk -n 2:2048:4095 -t 2:ef02 -c 2:bios_grub /dev/vda
partprobe /dev/vda
lsblk -o NAME,SIZE,FSTYPE,PARTTYPE,PARTLABELCorrect result appears/dev/vda2with a size of about 1 MiB and labelbios_grub. Do not format and do not mount this partition.
Sector range2048:4095only valid whenfdisk -lshows that the first partition starts at sector4096. If the first partition starts at2048, do not run the entire command above because the free space does not exist.
5. Recreate /boot, Bind Mount and Chroot
Only recreate the directory/bootafter ensuring this is not a separate partition in/etc/fstab. Then bind mount the necessary filesystems and switch to the faulty operating system usingchroot.
mkdir -p /mnt/boot
mount --rbind /dev /mnt/dev
mount --make-rslave /mnt/dev
mount -t proc proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --make-rslave /mnt/sys
mount --rbind /run /mnt/run
mount --make-rslave /mnt/run
chroot /mnt /bin/bashInside chroot, check networking, update the package list, and identify the installed kernel:
apt-get update
dpkg -l 'linux-image*'Prefixiimeans the package has been installed. Sample case haslinux-image-6.8.0-111-generic, but the files in/bootis missing, so this exact kernel package needs to be reinstalled.
DBus notification of typeServiceUnknown: The name is not activatablecan usually be ignored in chroot ifapt-get updatestill downloads the package list and ends withReading package lists... Done.
6. Restore Kernel and Initramfs
Replace the kernel version in the command below if the resultdpkg -lon your VPS differs from the sample:
DEBIAN_FRONTEND=noninteractive apt-get install --reinstall -y linux-image-6.8.0-111-generic grub-pc grub-pc-bin
update-initramfs -u -k 6.8.0-111-genericIn the rescue environment, some warnings may appear, but they do not necessarily cause the process to fail:
MD subsystem is not loadedor warningmdadm.confwhen VPS does not use RAID.- DBus warning because systemd is not fully running inside chroot.
- Kernel configuration file missing warning, as long as it is ultimately generated
vmlinuzandinitrd.img.
7. Reinstall GRUB and Create Boot Menu
grub-install --target=i386-pc --recheck /dev/vda
update-grub
ls -lh /bootSigns of success:command outputInstallation finished. No error reported., found Linux image and initrd image in/boot, then end withdone.
Directory/bootmust have at least:
vmlinuz-6.8.0-111-genericinitrd.img-6.8.0-111-generic- Directory
/boot/grub
8. Exit Chroot, Unmount ISO, and Reboot
exit
sync
umount -R /mnt
poweroff- Eject or unmount the SystemRescue ISO in the VPS control panel.
- Keep firmware atLegacy BIOS, do not switch to UEFI.
- Set the hard drive as the first boot device and power on the VPS.
- After Ubuntu boots up, run the verification commands below.
uname -r
lsblk
systemctl --failedCommon Errors During VPS Boot Rescue
Problem opening /dev/v for reading
Device name was truncated due to a narrow console window. Please re-enter and ensure the drive name ends completely with/dev/vda. The command line wrapping automatically on the screen does not affect anything, as long as you do not press Enter in the middle of a drive name.
grub-install: embedding is not possible
GPT drive running BIOS without partitionsbios_grub, or the kernel has not recognized the newly created partition. Check again withlsblk, runpartprobe /dev/vdathen try again.
update-grub cannot find Linux image
You have not restored the correct kernel package. Identify the version usingdpkg -l 'linux-image*', reinstall the exact package with the statusii, then rerunupdate-initramfsandupdate-grub.
apt-get update reports a DNS error
Check network connectivity in the rescue environment and configure valid DNS for chroot. Do not reboot if the kernel has not yet appeared in/boot.
VPS keeps booting into SystemRescue after reboot
The ISO is still attached or prioritized before the hard drive in the boot order. Please eject the ISO and choose to boot from disk.
Shortened Command Sheet Matching the Sample Case
Only run the entire command block below after confirming root is/dev/vda1, the root partition starts at sector4096, firmware is BIOS, disklabel is GPT, and/bootnot a separate partition.
mount /dev/vda1 /mnt
sgdisk --backup=/mnt/root/vda-gpt-before-grub.bin /dev/vda
sgdisk -n 2:2048:4095 -t 2:ef02 -c 2:bios_grub /dev/vda
partprobe /dev/vda
mkdir -p /mnt/boot
mount --rbind /dev /mnt/dev
mount --make-rslave /mnt/dev
mount -t proc proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --make-rslave /mnt/sys
mount --rbind /run /mnt/run
mount --make-rslave /mnt/run
chroot /mnt /bin/bashapt-get update
DEBIAN_FRONTEND=noninteractive apt-get install --reinstall -y linux-image-6.8.0-111-generic grub-pc grub-pc-bin
update-initramfs -u -k 6.8.0-111-generic
grub-install --target=i386-pc --recheck /dev/vda
update-grub
ls -lh /boot
exit
sync
umount -R /mnt
poweroffFrequently asked questions
Can this guide be used for UEFI VPS?
No. This article applies to GPT running Legacy BIOS and usinggrub-install target i386-pc. UEFI VPS needs to identify and correctly mount the EFI System Partition, then install GRUB in UEFI mode.
Can GRUB be installed to /dev/vda1?
No. In the sample structure, GRUB must be installed to the entire drive/dev/vda.
Do I need to format the bios_grub partition?
No. The EF02 partition is reserved exclusively for GRUB to storecore.img, do not format and do not mount.
When can the SystemRescue ISO be unmounted?
Only unmount the ISO aftergrub-installandupdate-grubsuccessfully, while/bootalready availablevmlinuz, initrd.imgand the foldergrub.
VPTS – Comprehensive Digital Infrastructure Solutions Provider
VPTS is a digital infrastructure solution provider in Vietnam, serving deployment, operation, and data storage needs for individuals, developers, and enterprises. The service ecosystem includesVietnam VPS, International VPS, VPS Anti DDoS, Hosting cPanel, dedicated server, Rack rental, Proxy IPv4/IPv6, S3 MinIOandCloud Storage.
Besides providing infrastructure resources, VPTS also focuses on assisting customers with deployment, configuration, and practical troubleshooting. Content on the VPTS Blog is drawn from common scenarios in operating VPS, servers, and online systems, helping readers understand root causes and apply clear solutions.
VPTS – Stable infrastructure, flexible solutions, and continuous partnership throughout operations.
VPTS Team Contact Information
Website: https://vpts.shop
Facebook: https://www.facebook.com/trang.vpsttt/
Zalo OA: https://zalo.me/vpstttgroup
Hotline: 0328 812 674
Conclusion
When Ubuntu VPS loses GRUB or loses data in/boot, SystemRescue allows you to check disks, chroot into the system, recover the kernel, and reinstall the bootloader without needing a fresh OS install. The most critical factor is correctly identifying the firmware, partition table, root partition, and free sector space before modifying the GPT.
If the VPS structure does not match the sample case or the data on the machine is high-value, you should take a snapshot and contact technical support before proceeding.
◉ 180