Skip to main content
Restore the Linux bootloader in Rescue
Last update:

Restore the Linux bootloader in Rescue

The main boot loader for Linux operating systems is GRUB. In case of problems, you can restore the boot loader using LiveCD — boot into Rescue mode.

In the Live system, you must mount all partitions in a pre-created folder, e.g. /mntThe same way they were mounted in the main system.

To restore the bootloader:

  1. Start the system from the LiveCD.

  2. Open the CLI.

  3. Print information about the partitions on the available disks:

    fdisk -l
  4. Locate the root partition where the system is installed. In the disk information you obtained in step 2, find the partition with type Linux filesystem. The root partition is located in /dev/sda*if the partitions are on a software RAID array — /dev/md* (the mount is performed to the appropriate array).

  5. Suppose the primary system has a root partition /located in /dev/sda2and a section /bootlocated in /dev/sda1. Mount the partitions in /mnt:

    mount /dev/sda2 /mnt/
    mount /dev/sda1 /mnt/boot
  6. If you are using a UEFI bootloader, mount the EFI partition:

    mount /dev/sda3 /mnt/boot/efi

    Specify /dev/sda3 — EFI partition.

    With the command cat /mnt/etc/fstab you can see the mount point in the host OS, as well as the UUID of the disk and map it to the UUID of the disk in the Live image.

  7. Mount the directories /sys, /proc, /dev:

    mount --bind /sys /mnt/sys
    mount --bind /proc /mnt/proc
    mount --bind /dev /mnt/dev
  8. Navigate to the main system environment:

    chroot /mnt

    If an error occurs, use the command:

    chroot /mnt /bin/bash
  9. If GRUB is not installed on the disks, install it. If no installation is required, skip to step 7. GRUB must be installed on all disks from which you plan to boot. For example, if you are using RAID0 for your boot partition:

    grub-install /dev/sda
    grub-install /dev/sdb

    Depending on the number of devices, there may be more disks in the RAID.

  10. To generate a GRUB configuration file, type:

    update-grub

    or

    update-grub2
  11. Get out of the environment chroot:

    exit