LinuxHigh

GRUB Bootloader Recovery: Fixing Problems in Rescue Mode

This article helps you exit GRUB rescue mode and restore GRUB bootloader functionality in Linux. You'll learn how to temporarily boot the system and permanently fix the bootloader.

Updated at February 17, 2026
10-15 minutes
Medium
FixPedia Team
Применимо к:Ubuntu 20.04/22.04Debian 10/11CentOS 7/8RHEL 8/9Fedora 35/36

Introduction / Why This Is Needed

Do you see the grub rescue> prompt instead of the regular GRUB menu when booting Linux? This means the bootloader cannot find its files or configuration. The system won't start, but your data on the disk is safe. This guide will help you temporarily boot into rescue mode and fully restore GRUB so you can see the OS selection menu again. We'll cover the most common distributions: Ubuntu, Debian, CentOS, RHEL, Fedora.

Prerequisites and Preparation

Before you begin, ensure:

  1. You have console access — you are at the grub rescue> prompt.
  2. You know which partition contains Linux — if unsure, we will find it.
  3. You have prepared a bootable medium (LiveCD/USB) with any Debian/Ubuntu or CentOS/RHEL-based distribution. It will be needed for the final step — reinstalling GRUB.
  4. Administrator privileges when working with the LiveCD (usually available by default).

⚠️ Important: If you do not know which specific partition contains your system, do not run the set root command randomly. This could lead to errors.

Step-by-Step Instructions

Step 1: Identify Disk Partitions in Rescue Mode

At the grub rescue> prompt, run:

ls

You will see a list of devices, for example:

(hd0) (hd0,msdos1) (hd0,msdos2) (hd0,msdos3)

or for GPT:

(hd0) (hd0,gpt1) (hd0,gpt2) (hd0,gpt3)

Now, check each partition for the /boot folder or kernel files (vmlinuz*, linux). For partition (hd0,msdos1):

ls (hd0,msdos1)/

If the output contains boot or files like vmlinuz-5.4.0-42-generic, this partition most likely contains your system. Repeat for all partitions until you find the correct one.

💡 Tip: If ls shows Filesystem is unknown, the partition likely does not contain Linux or has an unsupported filesystem (e.g., NTFS). Skip it.

Step 2: Set the Root Partition

Assume you found partition (hd0,msdos1). Set it as the root:

set root=(hd0,msdos1)

GRUB will remember this partition for further operations.

Step 3: Load the Kernel and initrd

Now you need to specify the path to the kernel (vmlinuz or linux) and initrd (initrd.img or initramfs). First, see what's in /boot on your partition:

ls (hd0,msdos1)/boot/

Example output:

vmlinuz-5.4.0-42-generic
initrd.img-5.4.0-42-generic
grub

Load the kernel (substitute your actual filenames):

linux /boot/vmlinuz-5.4.0-42-generic root=/dev/sda1 ro
  • /boot/vmlinuz-... — path to the kernel relative to root (/).
  • root=/dev/sda1important: specify the device of your root partition (the one you found in step 1). Usually it's /dev/sda1, /dev/nvme0n1p1, or similar. If unsure, you can temporarily use root=/dev/sda1, but the exact path is better.
  • ro — mounts the root partition as read-only during boot (standard parameter).

Then load the initrd:

initrd /boot/initrd.img-5.4.0-42-generic

⚠️ Attention: If you have CentOS/RHEL 7+, filenames may differ, for example:

  • Kernel: vmlinuz-3.10.0-1127.el7.x86_64
  • Initrd: initramfs-3.10.0-1127.el7.x86_64.img Always check the contents of /boot!

Step 4: Boot the System

boot

If done correctly, the system will temporarily boot. This does not fix GRUB permanently, but it gives you OS access for further actions.

Step 5: Reinstall GRUB from LiveCD

After successfully booting (but with GRUB still broken in the current session), reboot using the LiveCD. Then:

  1. Open a terminal.
  2. Identify how your root partition is named on the LiveCD (usually /dev/sda1, /dev/nvme0n1p1, etc.). Use lsblk or sudo fdisk -l.
  3. Mount it to /mnt:
sudo mount /dev/sda1 /mnt

⚠️ If you have a separate /boot partition, mount it too: sudo mount /dev/sda2 /mnt/boot (replace sda2 with your /boot partition).

  1. For Debian/Ubuntu:
sudo grub-install --boot-directory=/mnt/boot /dev/sda
sudo update-grub
  1. For CentOS/RHEL/Fedora:
sudo grub2-install --boot-directory=/mnt/boot /dev/sda
sudo grub2-mkconfig -o /mnt/boot/grub2/grub.cfg
  1. Unmount and reboot:
sudo umount /mnt
sudo reboot

Remove the LiveCD during reboot. GRUB should now work as before.

Verifying the Result

After rebooting, you should see the regular GRUB menu with the OS selection. If the menu appears and the system boots — the problem is solved.

If the error persists, check:

  • Did you specify the correct root partition during reinstall (/dev/sda is the disk, not a partition!).
  • Did the disk partition layout change after the error appeared? Partition letters may have shifted (e.g., sda1 became sda2). Verify with lsblk on the LiveCD.

Possible Issues

ProblemSolution
error: unknown filesystem when running ls (hd0,msdos1)/The partition does not contain Linux or the filesystem is unsupported by GRUB (e.g., Btrfs without module). Try other partitions.
linux or initrd not foundCheck the exact filenames in your partition's /boot. Different names may be used (e.g., vmlinuz-linux instead of vmlinuz-<version>).
grub-install fails with No such deviceEnsure you specified the correct disk (/dev/sda, not /dev/sda1). Also verify that the /boot partition is mounted (if separate).
After recovery, GRUB does not detect WindowsRun sudo update-grub (Ubuntu/Debian) or sudo grub2-mkconfig -o /boot/grub2/grub.cfg (CentOS/RHEL) in the now-booted system. This will add Windows to the menu.
System boots but immediately crashes with kernel panicThe root= parameter in the linux command may be incorrect. Check which partition is mounted as / in your system (df -h on LiveCD).

If no partition contains the expected files (boot, vmlinuz*), the Linux partition may have been deleted or corrupted. In this case, data recovery or a system reinstall will be required.

F.A.Q.

What is GRUB rescue mode and why does it appear?
Can I fix GRUB rescue without LiveCD?
Will GRUB recovery lead to data loss?
How to prevent GRUB rescue from appearing in the future?

Hints

Identify disk partitions in rescue mode
Set the root partition
Load the kernel and initrd
Boot the system
Reinstall GRUB from LiveCD

Did this article help you solve the problem?

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