Repairing the GRUB Bootloader
GRUB (GRand Unified Bootloader) starts your Linux operating system — if it is damaged or misconfigured, the server cannot boot. This guide shows how to reinstall GRUB from the Linux rescue system via chroot, including on software RAID.
Prerequisite: This guide assumes your server is already running in rescue mode and you are connected via SSH. → Starting rescue mode
Step 1: Mount the System Partitions
First, identify your partition device names using lsblk:
Then mount the root partition to /mnt and the boot partition to /mnt/boot — adjust the device names to match your lsblk output:
This example assumes a non-RAID setup. Device names such as sda1, sda3 may differ on your server.
Step 2: Prepare the chroot Environment
Bind-mount the essential system directories from the rescue system into your mounted filesystem:
Step 3: Enter chroot and Reinstall GRUB
Enter the chroot environment:
Reinstall GRUB on the primary boot drive — replace /dev/sda with your actual device name. Do not include a partition number:
If you are using a software RAID (RAID1), you must install GRUB on both drives — e.g. grub-install /dev/sda followed by grub-install /dev/sdb.
Step 4: Update GRUB Config and Reboot
Regenerate the GRUB configuration file (while still inside the chroot). On AlmaLinux and Rocky Linux, use grub2-install /dev/sda in step 3 and grub2-mkconfig -o /boot/grub2/grub.cfg here instead:
Exit the chroot and the SSH session:
Finally, go to your PowerPanel and cancel rescue mode so the server reboots normally. → Cancelling rescue mode
Further Documentation
For more information on GRUB configuration options, refer to the official GNU GRUB documentation.