Recovering the GRUB bootloader restores control over system startup when a machine stops presenting the expected boot menu or begins booting directly into another operating system. The bootloader coordinates the transfer of control from BIOS or UEFI firmware to installed kernels, so damage to its code or configuration can leave Linux installations hidden behind another loader such as Windows Boot Manager. Reinstalling GRUB to the system disk restores the selector that exposes all available operating systems without reinstalling them.

On most Linux systems, GRUB stores its core modules and configuration under /boot and /boot/grub while a small first-stage loader resides either in the disk's master boot record or in an EFI system partition. Booting from a compatible Linux Live CD or USB drive makes it possible to mount the installed root filesystem and access these directories even when the normal boot process fails. Using chroot from the live environment causes tools such as grub-install and update-grub to operate on the mounted system instead of the temporary live root.

The procedure assumes a single-disk setup that uses GRUB as the primary bootloader, with examples based on a typical Ubuntu live session. Systems using multiple disks, complex RAID layouts, encrypted volumes, or custom UEFI configurations may require adjusted device names and additional mount steps for locations such as /boot/efi. Careful disk identification is critical because writing GRUB to the wrong drive can overwrite another bootloader or leave a system unbootable until corrected.

Steps to restore GRUB bootloader:

  1. Boot the computer from a Linux Live CD or USB drive that matches the installed system's architecture.
  2. Select the live desktop session instead of starting an installer.

    For Ubuntu installation media, click the Try Ubuntu button to start a live session.

  3. Open a terminal in the live environment.

    If no graphical session is available, press <ctrl> + <alt> + <f2> to reach a TTY and log in as ubuntu with an empty password when using Ubuntu live media.

  4. List block devices to locate the disk and partition containing the installed Linux system.
    $ lsblk
    NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    loop0    7:0    0  1.9G  1 loop /rofs
    loop1    7:1    0 89.3M  1 loop /snap/core/6673
    loop2    7:2    0 53.7M  1 loop /snap/core18/941
    sda      8:0    0   20G  0 disk
    └─sda1   8:1    0   20G  0 part
    sr0     11:0    1    2G  0 rom  /cdrom

    Focus on the main system disk such as /dev/sda and identify the root partition by its size and filesystem type, typically an ext4 partition.

  5. Create a temporary directory for mounting the root filesystem from the installed system.
    $ mkdir tmp

    Any directory name is acceptable; using tmp keeps the remaining commands short.

  6. Mount the root partition of the installed Linux system into the temporary directory.
    $ sudo mount /dev/sda1 tmp/

    Mount the correct root partition; reinstalling GRUB against the wrong filesystem can attach the bootloader to an unexpected installation.

  7. Bind essential virtual filesystems from the live environment into the mounted root.
    $ sudo mount --bind /dev tmp/dev
    $ sudo mount --bind /proc tmp/proc
    $ sudo mount --bind /sys tmp/sys

    Binding /dev, /proc, and /sys ensures tools inside the chroot see devices, kernel information, and firmware interfaces correctly.

  8. Change root into the mounted system to operate as if booted from the installed Linux environment.
    $ sudo chroot tmp/
    root@ubuntu:/#
  9. Reinstall the GRUB bootloader to the primary disk used by the system firmware.
    root@ubuntu:/# grub-install /dev/sda
    Installing for i386-pc platform.
    Unknown device "/dev/sda1": No such device
    Unknown device "/dev/sda1": No such device
    Unknown device "/dev/sda1": No such device
    Unknown device "/dev/sda1": No such device
    Unknown device "/dev/sda1": No such device
    Unknown device "/dev/sda1": No such device
    Installation finished. No error reported.

    Ensure the correct disk such as /dev/sda is targeted; installing GRUB to the wrong drive can overwrite another bootloader and temporarily prevent other operating systems from starting.

  10. Regenerate the GRUB configuration file to detect installed kernels and other operating systems.
    root@ubuntu:/# update-grub
    Sourcing file `/etc/default/grub'
    Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg'
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-5.15.0-60-generic
    Found initrd image: /boot/initrd.img-5.15.0-60-generic
    Found Windows Boot Manager on /dev/sdb1@/efi/Microsoft/Boot/bootmgfw.efi
    Adding boot menu entry for UEFI Firmware Settings
    done

    On distributions without update-grub, use grub-mkconfig -o /boot/grub/grub.cfg to generate the configuration.

  11. Exit from the chroot environment back to the live session.
    root@ubuntu:/# exit
    exit
  12. Power off the machine from the live environment.
    $ sudo poweroff
  13. Remove the Live CD or USB drive from the system.
  14. Boot the computer from the primary disk that now holds the recovered GRUB bootloader.
  15. Verify that the GRUB menu appears and that at least one installed operating system starts successfully.
Discuss the article:

Comment anonymously. Login not required.