What the GRUB Rescue Error Means
If, when you turn on your computer, you see the grub-rescue> command prompt instead of the usual boot menu, it means the GRUB bootloader cannot find its configuration files or modules. This isn't an error with a code in the traditional sense, but an emergency mode that allows you to manually specify paths and boot the system.
Typical output:
grub-rescue>
The system won't boot further, and you find yourself in a limited environment with a minimal set of commands.
Common Causes
The GRUB Rescue error occurs due to the following specific reasons:
- MBR/GPT corruption: The disk's boot sector (MBR) or boot partition (EFI System Partition) has been overwritten, for example, after installing another OS or a system crash.
- Deletion or relocation of GRUB files: Files in the
/boot/grubdirectory (or/boot/efi/EFI/ubuntufor UEFI) were deleted, corrupted, or moved to a different partition. - Incorrect configuration changes: Errors in the
/etc/default/grubfile or scripts in/etc/grub.d/after manual editing without subsequently runningupdate-grub. - Disk failure: Development of bad sectors on the disk where GRUB files are stored, or complete drive failure.
- Incorrect BIOS/UEFI settings: Changing the boot order, disabling Secure Boot without corresponding GRUB configuration.
Method 1: Recovery via GRUB Rescue Mode
If you are at the grub-rescue> prompt, you can try to manually boot the system without using a LiveCD.
- Locate the partition containing GRUB files. Run:
ls
You will see a list of disks and partitions, e.g.,(hd0) (hd0,gpt1) (hd0,gpt2). Then check each one:ls (hd0,gpt1)/
Look for thebootdirectory or files likevmlinuz(kernel) andinitrd. Once found, note that partition (e.g.,(hd0,gpt1)). - Set the
rootandprefixvariables:set root=(hd0,gpt1) set prefix=(hd0,gpt1)/boot/grub
For UEFI systems, the path might be(hd0,gpt1)/boot/efi/EFI/ubuntu. - Load the normal GRUB module:
insmod normal
If the module is not found, theprefixpath may be incorrect. - Switch to normal GRUB mode:
normal
If everything is correct, the GRUB menu will appear. Select a kernel and boot. - After successful boot, fix the configuration. In the OS terminal, run:
sudo update-grub
This will regenerate the configuration and check for the presence of files.
⚠️ Important: This method provides a temporary boot. If the problem is corrupted files, the error may recur after a reboot. Be sure to run
update-gruband, if necessary, reinstall GRUB (see Method 3).
Method 2: Using a Bootable Medium (LiveCD/USB)
If rescue mode doesn't help or you cannot find the correct partitions, use a bootable medium with any Linux system (Ubuntu, Fedora, Debian).
- Boot from the Live medium. Choose the "Try Ubuntu" or similar option to get a working desktop.
- Identify partitions. Open a terminal and run:
sudo fdisk -l
Find the root partition (e.g.,/dev/sda2) and the/bootpartition (if separate). For UEFI, also locate the ESP (FAT32, typeEFI System). - Mount the partitions. For a standard setup:
sudo mount /dev/sda2 /mnt sudo mount /dev/sda1 /mnt/boot # if /boot is separate
For UEFI:sudo mount /dev/sda1 /mnt/boot/efi
Also mount system virtual filesystems:for i in /dev /dev/pts /proc /sys /run; do sudo mount --bind $i /mnt$i; done - Enter the chroot environment:
sudo chroot /mnt - Reinstall GRUB:
- For BIOS/MBR:
grub-install /dev/sda update-grub - For UEFI:
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu update-grub
- For BIOS/MBR:
- Exit and reboot:
exit sudo reboot
Remove the Live medium when rebooting.
Method 3: Manual Recovery of GRUB Files (If They Are Damaged)
If files in /boot/grub are missing or corrupted, you can restore them from the package.
- From within the chroot environment (as in Method 2), reinstall the GRUB package:
- For Ubuntu/Debian:
apt-get install --reinstall grub-pc grub-common - For Fedora:
dnf reinstall grub2-tools
- For Ubuntu/Debian:
- Update the configuration:
update-grub # Ubuntu/Debian grub2-mkconfig -o /boot/grub2/grub.cfg # Fedora - Check file integrity:
ls -la /boot/grub
You should see files likegrub.cfgandi386-pcorx86_64-efimodules.
Method 4: Using the Boot-Repair Utility (For Ubuntu and Derivatives)
Boot-Repair is an automated tool that often fixes GRUB problems.
- In a Live Ubuntu session, add the repository and install:
sudo add-apt-repository ppa:yannubuntu/boot-repair sudo apt update sudo apt install boot-repair - Launch it:
boot-repair - Select "Recommended repair". The utility will automatically detect the issue and fix GRUB, MBR/ESP.
- Follow on-screen instructions. At the end, a URL with a log will appear—save it in case the problem recurs.
Prevention
To avoid ending up in GRUB Rescue again:
- Back up the bootloader:
sudo dd if=/dev/sda of=~/mbr-backup.img bs=512 count=1 # for BIOS sudo cp -r /boot/grub ~/grub-backup/ # GRUB files
For UEFI, copy the ESP directory:sudo cp -r /boot/efi/EFI ~/efi-backup/ - Careful partition management: Do not change partition order or delete unknown partitions, especially those of type
EFI Systemor with thebootflag. - Regularly update GRUB: After installing a new kernel or making changes to
/etc/default/grub, always runsudo update-grub. - Monitor disk health: Once a month, check the S.M.A.R.T. status:
sudo smartctl -a /dev/sda
And filesystems:sudo fsck -f /dev/sda2 - Avoid installing Windows after Linux: If you need to install Windows, do it before Linux or be prepared to manually restore GRUB afterward.
- Use LVM or RAID with caution: Complex storage schemes increase the risk of boot problems. Ensure your initramfs contains the necessary modules.