Repairing the GRUB Bootloader

GRUB (GRand Unified Bootloader) is the software that starts your Linux operating system when the server powers on. If GRUB is damaged or misconfigured, the server cannot boot. This guide explains how to reinstall GRUB using the Linux Rescue System.

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

Identify your root and boot partitions and mount them into the rescue environment.

First, identify your partition device names using lsblk:

Terminal
lsblk

Then mount the root partition to /mnt and the boot partition to /mnt/boot — adjust the device names to match your lsblk output:

Terminal
mount /dev/sda3 /mnt mount /dev/sda1 /mnt/boot

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 essential system directories so commands run in the context of your installed OS.

Bind-mount the essential system directories from the rescue system into your mounted filesystem:

Terminal
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done

Step 3: Enter chroot and Reinstall GRUB

Switch into your system and write the bootloader to the Master Boot Record of the drive.

Enter the chroot environment:

Terminal
chroot /mnt

Reinstall GRUB on the primary boot drive — replace /dev/sda with your actual device name. Do not include a partition number:

Terminal
grub-install --recheck /dev/sda

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 configuration file, exit chroot, and cancel rescue mode.

Regenerate the GRUB configuration file (while still inside the chroot):

Terminal
update-grub

Exit the chroot and the SSH session:

Terminal
exit

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.