Repairing a Linux server’s GRUB bootloader

Recently updated a Linux server and reboot it afterwards but it failed to boot up due to a broken GRUB. GRUB is an acronym for GRand Unified Bootloader and is responsible for loading and managing the boot process in Linux.

This was not clear initially. My instinct was it is a network issue or maybe a problem with the hypervisor or host machine since it is a virtual machine. Obviously both ping and ssh failed. However I could traceroute until I reach the VPS provider’s network and the traffic will stop.

I contacted the provider and after a long wait , it said the issue is with my GRUB.

I put the server on a rescue mode (helpful if your provider has the feature). Then I launched VNC. I boot it into a live Debian disk and mounted the filesystem with the following commands.

mount /dev/sda1 /mnt
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys
mount -o bind /dev /mnt/dev
chroot /mnt /bin/bash

After mounting the filesystem, I installed and updated grub with:

grub-install /dev/sda
update-grub

From here I just exited the live disk and reboot the server it.

Leave a Reply