LINUXMAKER, OpenSource, Tutorials

Repair the bootloader Grub with the help of a live system

Who does not know that? After an upgrade or work on the boot manager itself, the system no longer boots into the actual operating system the next time it is restarted. The grub simply revives the hang or shows the rescue mode of the grub shell.
It would be good if you could reinstall the Grub now. However, this is not possible from the Grub Rescue mode.

A live system on a CD or USB stick is now required. Various live systems are available here. A live system on a CD or a USB stick is now required for this. Various live systems are available here, such as SparkyLinux or SuperGrubDisk. After the download, the boot media can be created as follows.
The following command, for example, is used to create a complete image of a CD / DVD:

dd if=/dev/sdY of=/path/Image.img bs=1M && sync

The command looks like this for the USB stick:

dd if=/dev/dvd of=/path/Image.img bs=1M && sync

Repair of the boot manager in the live system

If we booted into the live system with the live image we just created, we have to mount the system partition into our live system. If the boot directory is on an extra partition, this must also be mounted.

# mkdir /syspart
# mount /dev/sdc3  /syspart
# mount -o bind /dev /syspart/dev
# mount -o bind /proc /syspart/proc
# mount -o bind /sys /syspart/sys

Chroot the system so that the changes are made on the hard drive to be treated and not in the live system. The latter is only used to be able to use the hard disk and to provide the tools.

# chroot /syspart
# mount /dev/sdc1 /boot

Now the actual repair of the Grub Manager can be carried out.

# update-grub2
# grub-install /dev/sdc
# exit
# reboot

After the reboot, the boot process in the actual operating system should start successfully again.