LinuxHigh

GRUB Recovery: Reinstall the Bootloader in 10 Minutes

This article helps you restore GRUB functionality when your system fails to boot. Learn to reinstall GRUB using a bootable USB for major Linux distributions.

Updated at February 15, 2026
10-15 min
Medium
FixPedia Team
Применимо к:Ubuntu 22.04 LTSDebian 11CentOS 7Fedora 36

Introduction / Why This Is Needed

GRUB (Grand Unified Bootloader) is the first program that runs when a computer with Linux is powered on. Its task is to load the operating system, displaying a selection menu if there are multiple options. Due to failures (kernel updates, disk errors, incorrect configuration changes), GRUB can become corrupted, leading to errors like grub rescue> or a complete inability to boot. This guide will help you restore the bootloader's functionality using a Live CD/USB bootable media. After completing these steps, you will see the GRUB menu again and be able to boot your system.

Prerequisites / Preparation

Before you begin, ensure you have:

  1. A Live USB bootable media with any Linux distribution (Ubuntu, Fedora, or any other GRUB-supported distro is recommended). You can create it using Rufus, BalenaEtcher, or dd.
  2. Access to BIOS/UEFI to boot from the USB drive (usually the F2, F12, or Del key during startup).
  3. Basic terminal skills: ability to enter commands and change directories.
  4. Knowledge of the root password or the ability to run commands with sudo in the Live environment (often the root password is disabled; use sudo).
  5. Information about disk partitions: if you know where your root partition (/) and possibly a separate /boot or EFI System Partition (ESP) are located, it will speed up the process.

💡 Tip: If you are unsure about your partition layout, don't worry—we will show you how to identify it in Step 2.

Step-by-Step Instructions

Step 1: Prepare the Live Media and Boot from It

If you don't have a Live USB yet, create one:

  1. Download a distribution image (e.g., Ubuntu Desktop).
  2. Write it to a USB drive (minimum 4 GB) using BalenaEtcher or the dd command (on Linux/macOS):
    sudo dd if=/path/to/your/image.iso of=/dev/sdX bs=4M status=progress && sync
    

    Replace /dev/sdX with your USB drive's device (e.g., /dev/sdb). Caution: selecting the wrong disk will result in data loss!
  3. Reboot the computer, enter BIOS/UEFI (the key at startup, often F2, F12, Del), and configure booting from the USB device.
  4. Select the Try Ubuntu (or similar) option—this will launch the live environment without installing.

After booting, open a terminal (Ctrl+Alt+T).

Step 2: Identify Disk Partitions

In the Live environment, all disks are accessible but may have different names (e.g., your system disk /dev/sda might become /dev/sdb). Identify the root partition:

lsblk

You will see a list of devices and their mount points. Example output:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 238,5G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi   # EFI partition (UEFI)
├─sda2   8:2    0    64G  0 part /
├─sda3   8:3    0    16G  0 part [SWAP]
└─sda4   8:4    0 157,9G  0 part /home

Or use sudo fdisk -l for more detailed information.

What to look for:

  • Root partition (/)—usually the largest, type Linux filesystem. In the example, this is /dev/sda2.
  • EFI System Partition (ESP)—small (100–500 MB), type EFI System. In the example, /dev/sda1. If you have BIOS (an older PC), the ESP may be absent.
  • Separate /boot (rare)—type Linux filesystem, mount point /boot.

Note the disk name (e.g., /dev/sda) and partition names. For subsequent commands, replace /dev/sda2 and /dev/sda1 with your own.

Step 3: Mount the Root File System

Now we will mount the root partition into the /mnt directory (the standard location for temporary mounts):

sudo mount /dev/sda2 /mnt

If you have a separate /boot partition (not part of the root), mount it:

sudo mount /dev/sdaX /mnt/boot   # replace sdaX with your /boot partition

If you have UEFI (an ESP exists), mount it to /mnt/boot/efi (or /mnt/efi if the structure differs):

sudo mount /dev/sda1 /mnt/boot/efi

⚠️ Important: For UEFI, the ESP must be mounted at /boot/efi inside the chroot environment; otherwise, grub-install will not find the EFI files.

If you have BIOS, skip this step—an ESP is not required.

Step 4: Reinstall GRUB

Now we will "enter" the mounted system using chroot—this gives access to its utilities and files as if it were the real system.

sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt

You will be inside your system's root (the command prompt may change). Now perform the reinstall depending on your firmware type.

For BIOS (older PCs):

grub-install --target=i386-pc /dev/sda

Where /dev/sda is the entire disk, not a partition. GRUB will be written to the MBR (first sector).

For UEFI (modern PCs, most from 2012 onward):

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
  • --efi-directory specifies the ESP mount point (should be /boot/efi).
  • --bootloader-id is the bootloader's name in the UEFI menu (you can keep GRUB or set ubuntu, debian, etc.).

If the command completes without errors, GRUB is installed.

Step 5: Update GRUB Configuration

After installation, you need to generate a new grub.cfg configuration file, which contains the list of kernels and partitions.

For Ubuntu/Debian and derivatives:

update-grub

For CentOS/RHEL/Fedora:

grub-mkconfig -o /boot/grub/grub.cfg

You should see output listing detected kernels and operating systems (e.g., "Found Windows Boot Manager on /dev/sda1").

Step 6: Reboot and Verify

Exit the chroot and unmount the partitions:

exit
sudo umount -R /mnt

Now reboot the computer:

sudo reboot

Remember to remove the Live USB drive when the manufacturer's logo appears, otherwise you will boot into it again.

If everything was done correctly, you will see the GRUB menu and be able to boot Linux (or Windows, if it was installed).

Verification

  1. The system boots without grub rescue> or error: no such partition errors.
  2. The GRUB menu appears on startup (it might be hidden; press Shift or Esc to display it).
  3. All installed operating systems are available in the menu.
  4. After booting into Linux, run sudo grub-install --recheck --target=i386-pc /dev/sda (for BIOS) or sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi (for UEFI)—the command should complete successfully without warnings.

Potential Issues

Error: error: no such partition.

  • Cause: GRUB cannot find the root partition specified in its configuration. Often, after a failure, the disk received a new name (e.g., /dev/sda2/dev/sdb2).
  • Solution: Ensure the correct partition names are specified in grub.cfg (file /boot/grub/grub.cfg inside chroot), e.g., (hd0,gpt2) for UEFI or (hd0,msdos2) for BIOS. It's best to regenerate the config via update-grub from within chroot.

Error: grub rescue> or unknown filesystem.

  • Cause: GRUB or its modules are corrupted; the partition is not found.
  • Solution: Manually specify the correct partition in grub rescue>:
    set prefix=(hd0,gpt2)/boot/grub
    set root=(hd0,gpt2)
    insmod normal
    normal
    
    Then boot and reinstall GRUB following the guide. Replace gpt2 with your actual partition (use ls in rescue to check).

System still fails to boot after GRUB reinstall.

  • Cause: The wrong disk was selected for grub-install (e.g., installed on /dev/sdb but booting from /dev/sda).
  • Solution: Ensure the grub-install command targets the disk from which the system boots (usually the first SATA disk /dev/sda). Check the boot order in BIOS/UEFI.

UEFI grub-install error: failed to get canonical path of /boot/efi.

  • Cause: The EFI partition is not mounted at /boot/efi inside chroot or is not formatted as FAT32.
  • Solution: Verify the ESP is mounted at /mnt/boot/efi before chroot. If the partition is not FAT32, format it (mkfs.fat -F32 /dev/sda1) only if you are certain it contains no important data (usually ESP only holds bootloaders).

update-grub does not find Windows.

  • Cause: Windows is installed in UEFI mode, but its bootloader is on a different disk, or the partition is hidden.
  • Solution: Ensure all disks are connected. Run sudo os-prober (in Ubuntu/Debian)—if it finds Windows but update-grub ignores it, check that the line GRUB_DISABLE_OS_PROBER=false in /etc/default/grub is not commented out. Rerun update-grub.

Not enough space on ESP (UEFI) for GRUB installation.

  • Cause: The EFI System Partition (usually 100–500 MB) is full of old bootloaders.
  • Solution: Clean the ESP: mount it (e.g., sudo mount /dev/sda1 /mnt/efi) and delete old folders (like ubuntu, debian, Microsoft, etc.), keeping only the current ones. Be careful—deleting the Microsoft folder may make Windows unbootable.

GRUB menu does not appear after reinstall (auto-boot).

  • Cause: GRUB configuration has a timeout of 0 or the menu is hidden.
  • Solution: Edit /etc/default/grub inside chroot:
    sudo nano /etc/default/grub
    
    Set:
    GRUB_TIMEOUT=10
    GRUB_TIMEOUT_STYLE=menu
    
    Save and run update-grub.

Additional Recommendations

  • Back up your ESP (for UEFI) or MBR (for BIOS) before making changes:
    • BIOS: sudo dd if=/dev/sda of=~/mbr-backup.img bs=512 count=1
    • UEFI: copy the contents of /boot/efi to a safe location.
  • Use efibootmgr (install the efibootmgr package in the Live environment) to manage UEFI boot entries: sudo efibootmgr -v shows all bootloaders, sudo efibootmgr -o 0001,0002 sets the boot order.
  • For complex cases (RAID, LVM, encryption), additional configuration may be needed (e.g., grub-install with lvm or cryptodisk modules). Refer to your distribution's documentation.

After restoring GRUB, it is recommended to update your system (sudo apt update && sudo apt upgrade on Ubuntu/Debian) and check disk health (sudo smartctl -a /dev/sda).


This article covers the main GRUB recovery scenarios. If the problem persists, specify your motherboard model, firmware type (BIOS/UEFI), and the output of lsblk and sudo fdisk -l in the comments—this will help provide more precise advice.

F.A.Q.

What is GRUB and why is it necessary?
Is a Live USB necessary to reinstall GRUB?
Can GRUB be reinstalled without losing data on the disk?
What's the difference between reinstalling for BIOS and UEFI?

Hints

Preparing the Live USB and Booting from It
Identifying Disk Partitions
Mounting the Root File System
Reinstalling GRUB
Updating GRUB Configuration
Rebooting and Verification
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community