Boot from provider rescue or live image, mount the root filesystem, and chroot to reinstall or fix GRUB. Keep a note of partition layout. Test after kernel updates; have a rescue plan documented.
When GRUB breaks
- Causes: Failed kernel update, disk change (resize, new disk), mistaken edit to
grub.cfgor/etc/default/grub, or filesystem corruption. System may show "GRUB rescue", "unknown filesystem", or black screen. - Goal: Boot into the real root filesystem and reinstall or reconfigure GRUB so the boot loader finds the kernel and initramfs and boots the OS.
Rescue and chroot
- Boot rescue: Use the provider's rescue image (via panel or IPMI/KVM) or a live USB/DVD. Boot into a minimal OS (often same distro or generic live). Ensure you have root or sudo.
- Mount root: Identify the root partition (e.g.
/dev/sda1or/dev/vda1). Mount it:mount /dev/vda1 /mnt. If you use separate/boot, mount that too:mount /dev/vda2 /mnt/boot(adjust devices). Mount virtual filesystems if needed:mount --bind /dev /mnt/dev,mount --bind /proc /mnt/proc,mount --bind /sys /mnt/sys. - Chroot:
chroot /mnt. You are now "inside" the broken system. Run commands as if you were booted into it.
Reinstall GRUB
- Install to disk:
grub-install /dev/vda(use the disk device, not the partition). This writes GRUB to the MBR or ESP. For UEFI you may need to mount the EFI System Partition and rungrub-install --efi-directory=/boot/efi. - Regenerate config:
update-grub(Debian/Ubuntu) orgrub2-mkconfig -o /boot/grub2/grub.cfg(RHEL/CentOS). This scans for kernels and updatesgrub.cfg. - Verify: Check
/bootforvmlinuzandinitrd; check/boot/grub/grub.cfg(orgrub2/grub.cfg) for correct root= and kernel entries. Exit chroot, unmount, reboot. Remove rescue media so the server boots from disk.
Prevention and notes
- Partition layout: Document or screenshot partition layout (e.g.
lsblk,fdisk -l). Helps when you are in rescue and must mount the right partitions. - After kernel updates: Some updates change initramfs or kernel order. If the server does not boot after an update, use rescue to check
/bootand re-runupdate-grubor fixgrub.cfg. - Rescue plan: Document steps (which rescue image, mount points, grub-install command) so anyone can follow in an emergency. Test rescue access (e.g. from provider panel) periodically.
Summary
Boot from provider rescue or live image; mount root (and /boot if separate); chroot; reinstall GRUB with grub-install and update-grub/grub2-mkconfig. Keep partition layout noted; test after kernel updates; document rescue plan.




