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. If you have problems, you can recover the bootloader using the LiveCD — boot to Rescue.

In the Live system, mount all partitions to a pre-created folder (e.g. /mnt) in the same way as they were mounted in the main system.

To restore the bootloader:

  1. Start the system from the LiveCD and open the terminal.

  2. Locate the root partition where the system is installed using the fdisk command (find the partition with the Linux filesystem type in the output):

    fdisk -l

    If the system is installed in a non-LVM partition, the root partition will be in /dev/sda*:

    • in a partition using LVM — /dev/mapper;
    • if partitions are on a software RAID array — /dev/md* (mounting is performed to the corresponding array);
  3. Suppose the main system has a root partition / located in /dev/sda2 and a /boot partition located in /dev/sda1. Mount the partitions in /mnt:

    mount /dev/sda2 /mnt/
    mount /dev/sda1 /mnt/boot

    If you are using a UEFI bootloader, mount the EFI partition as well:

    mount /dev/sda3 /mnt/boot/efi

    Specify /dev/sda3 as the c EFI partition.

    Use the cat /mnt/etc/fstab command to 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.

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

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

    chroot /mnt

    If an error occurs, use the command with /bin/bash:

    chroot /mnt /bin/bash
  6. 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 RAID0 is used for the boot partition:

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

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

  7. To generate a GRUB configuration file, type:

    update-grub

    or

    update-grub2
  8. Exit the chroot environment:

    exit