Fix GRUB Rescue: Repair the GRUB Bootloader on Ubuntu

By 

•

Updated on

•

10 min read

Illustrated GRUB rescue prompt and Ubuntu boot menu beside a disk drive and rescue USB

You power on the machine, and instead of the Ubuntu boot menu you get a black screen with a short error and a blinking prompt:

output
error: no such partition.
Entering rescue mode...
grub rescue>

GRUB is the bootloader that loads the Linux kernel. When it starts, it reads its modules and configuration from the /boot/grub directory. If it cannot find that directory, it falls back to rescue mode, a minimal shell with only a handful of commands. The system itself is usually fine; GRUB just lost track of where it lives.

This guide explains how to boot Ubuntu from the grub rescue> prompt and how to reinstall GRUB so the problem does not come back, either from the running system or from a live USB. The steps were tested with GRUB 2.14 on Ubuntu 26.04.

Why GRUB Drops to Rescue Mode

GRUB stores the location of its files at install time. Anything that moves or removes those files breaks the link between the boot code and /boot/grub. The most common causes are:

  • A partition was deleted, moved, or recreated, so /boot/grub is no longer where GRUB expects it.
  • Windows was installed or updated on a dual-boot machine and changed the partition layout.
  • A disk was added or removed, which changed the disk order.
  • A GRUB update was interrupted, for example by a power loss during apt upgrade.

The error on the first line gives you a hint. no such partition means GRUB is looking at a partition that does not exist anymore. unknown filesystem means GRUB cannot recognize or read the filesystem on that partition. The error alone does not tell you whether Ubuntu is installed there.

A third message points to a missing directory:

output
error: file `/boot/grub/i386-pc/normal.mod' not found.
Entering rescue mode...
grub rescue>

Here, GRUB found the partition, but the /boot/grub directory is missing or was moved. On UEFI systems with an unsigned GRUB, the path contains x86_64-efi instead of i386-pc.

Booting Ubuntu from the grub rescue Prompt

The rescue shell cannot boot Ubuntu directly, but it can load the full GRUB menu once you tell it where the /boot/grub directory is. This is a temporary fix: it gets you into the system so you can repair GRUB properly.

Start by listing the disks and partitions GRUB can see:

Terminal
ls
output
(hd0) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)

GRUB names disks hd0, hd1, and so on, and partitions by their table type and number. On older systems with an MBR partition table, you will see msdos1 instead of gpt1.

To find the partition that holds Ubuntu, run ls on each one with a trailing slash. When you hit the root partition, you will see the familiar Linux directory layout:

Terminal
ls (hd0,gpt2)/
output
./ ../ lost+found/ bin boot/ dev/ etc/ home/ lib media/ mnt/ opt/ proc/ root/ run/ sbin snap/ srv/ sys/ tmp/ usr/ var/

Directories end with a slash. The bin, lib, and sbin entries have no slash. On Ubuntu, they are symbolic links.

If a partition returns error: unknown filesystem, check the remaining partitions for /boot/grub. The rescue shell may lack the module needed to read that filesystem, or the partition may be encrypted or damaged. GRUB can read FAT and NTFS when the matching modules are available, so this error does not identify an EFI or Windows partition.

Once you have found the right partition, point GRUB at it. In this example, Ubuntu is on (hd0,gpt2):

Terminal
set root=(hd0,gpt2)
set prefix=(hd0,gpt2)/boot/grub

The root variable tells GRUB which partition to read from, and prefix tells it where to find its modules and configuration.

Info
If /boot is a separate partition, ls on it shows grub/ and the kernel images directly, without an etc/ or home/ directory. In that case, set prefix=(hd0,gpt2)/grub without the /boot part.

Load the normal module and switch to normal mode:

Terminal
insmod normal
normal

The regular GRUB boot menu should appear. Select Ubuntu and let it boot. If insmod normal fails with a file not found error, the prefix is wrong; double-check the path with ls (hd0,gpt2)/boot/grub/.

Booting from the grub> Prompt

Sometimes you land at a grub> prompt instead of grub rescue>. The screen looks like this:

output
GNU GRUB  version 2.14

Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists possible
device or file completions. To enable less(1)-like paging, "set
pager=1".

grub>

That is normal mode without a configuration file: GRUB found its modules but not grub.cfg. On UEFI systems, this is the prompt you will usually see. Ubuntu boots a signed GRUB image with normal mode built in. The image reads a small grub.cfg from the EFI partition, and that file looks up the /boot partition by its UUID. If the lookup fails, GRUB stops at grub>.

The full command set is available at this prompt. If grub.cfg still exists on the disk, set root and prefix as shown in the previous section, then run normal to load the boot menu:

Terminal
set root=(hd0,gpt2)
set prefix=(hd0,gpt2)/boot/grub
normal

If the configuration file is missing, boot the kernel directly. Find the root partition with ls as shown earlier, then load the kernel and initial RAM disk. Ubuntu keeps /boot/vmlinuz and /boot/initrd.img as links to the newest kernel:

Terminal
set root=(hd0,gpt2)
linux /boot/vmlinuz root=/dev/sda2
initrd /boot/initrd.img
boot

The root= value on the linux line is the Linux device name of the root partition, not the GRUB name. If /boot is a separate partition, set root to that partition and leave /boot out of both paths, for example linux /vmlinuz root=/dev/sda2. Once the system boots, run sudo update-grub to rebuild the missing configuration file.

Reinstalling GRUB from the Running System

With Ubuntu running again, reinstall GRUB so the next boot works without manual steps. The command differs between BIOS and UEFI systems, so check which one you have first:

Terminal
[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

Next, identify the disk Ubuntu is installed on. The lsblk command shows disks, partitions, and their mount points:

Terminal
lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS
output
NAME        SIZE FSTYPE MOUNTPOINTS
sda         100G
├─sda1        1G vfat   /boot/efi
└─sda2       99G ext4   /

Here, Ubuntu is on the sda disk. On machines with NVMe drives, the disk is named something like nvme0n1.

BIOS Systems

On a BIOS system, GRUB installs its boot code to the start of the disk. Pass the disk itself, not a partition:

Terminal
sudo grub-install /dev/sda
output
Installing for i386-pc platform.
Installation finished. No error reported.

UEFI Systems

On a UEFI system, GRUB lives in the EFI system partition mounted at /boot/efi. Make sure it is mounted, then reinstall:

Terminal
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu

On Ubuntu, this installs the signed shim and GRUB images, so the machine keeps booting with Secure Boot enabled.

Regenerating the GRUB Configuration

After reinstalling the boot code, regenerate /boot/grub/grub.cfg so it includes the current kernels and any other operating systems on the machine:

Terminal
sudo update-grub

The output will look something like this:

output
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-7.0.0-31-generic
Found initrd image: /boot/initrd.img-7.0.0-31-generic
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

The Found linux image and Found initrd image lines show the kernel files added to the boot menu. The os-prober warning means GRUB did not search other partitions for operating systems. On a machine with only Ubuntu installed, you can ignore it.

Reboot to confirm that the system starts without stopping at a GRUB prompt:

Terminal
sudo reboot

Repairing GRUB from a Live USB

If the rescue prompt cannot find a partition with /boot/grub, or you would rather not type commands into the rescue shell, repair GRUB from a live session. Boot the machine from an Ubuntu installation USB and choose “Try Ubuntu”. If you do not have one yet, see how to create a bootable Linux USB drive .

Boot the live USB in the same mode as the installed system. On a UEFI machine, pick the UEFI entry for the USB in the firmware boot menu, otherwise grub-install will install the wrong type of bootloader.

Open a terminal and find the Ubuntu root partition and, on UEFI systems, the EFI partition:

Terminal
sudo lsblk -o NAME,SIZE,FSTYPE,LABEL

The root partition is usually the large ext4 partition, and the EFI partition is a small vfat partition of 300 MB to 1 GB. In the commands below, the root partition is /dev/sda2 and the EFI partition is /dev/sda1. Replace them with your own.

Info
If the root filesystem is encrypted with LUKS or sits on LVM, you need to unlock and activate it before mounting. Run sudo cryptsetup open /dev/sda3 cryptroot for LUKS, and sudo vgchange -ay for LVM, then mount the logical volume from /dev/mapper/.

Mount the root partition on /mnt:

Terminal
sudo mount /dev/sda2 /mnt

If /boot has its own partition, mount it next. For example, if the separate /boot partition is /dev/sda3, run the following command, replacing the device with your own. Skip this step when /boot is part of the root filesystem:

Terminal
sudo mount /dev/sda3 /mnt/boot

On a UEFI system, mount the EFI partition after the root filesystem and any separate /boot partition:

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

Next, bind the live system’s virtual filesystems into the mounted system. GRUB needs them to detect disks and, on UEFI, to write boot entries:

Terminal
for dir in dev proc sys run; do sudo mount --rbind /$dir /mnt/$dir && sudo mount --make-rslave /mnt/$dir; done

The --make-rslave option keeps the final unmount from reaching the live system’s own mounts. Without it, umount -R fails with target is busy.

Now switch into the installed system with chroot:

Terminal
sudo chroot /mnt

The prompt changes to root@ubuntu:/#. From here, every command runs against the installed system as if you had booted it. Reinstall GRUB with the command that matches your firmware.

For a BIOS system, run:

Terminal
grub-install /dev/sda

For a UEFI system, run:

Terminal
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu

Then regenerate the configuration:

Terminal
update-grub

Leave the chroot, unmount everything, and reboot without the USB drive:

Terminal
exit
sudo umount -R /mnt
sudo reboot

Using Boot-Repair

Boot-Repair is a graphical tool that automates the live USB steps above. It detects the partitions, reinstalls GRUB, and can produce a report you can share on a forum if something still fails. It is useful when you are not sure which partition is which.

From the live session, add the Boot-Repair PPA and install it:

Terminal
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt update
sudo apt install boot-repair

Start it with boot-repair and click “Recommended repair”. The tool prints a pastebin URL at the end; keep it in case you need help later.

Troubleshooting

error: unknown filesystem on every partition
Run ls again and check partitions on hd1 and any other disks. If none are readable, GRUB may lack the required filesystem or LVM modules, the filesystem may be encrypted, or it may be damaged. Use the live USB method to identify and mount the installed system. If the live session also cannot read it, investigate the filesystem or disk before reinstalling GRUB.

grub-install: error: cannot find EFI directory
The EFI system partition is not mounted at /boot/efi. Mount it (inside the chroot, it must be mounted on /mnt/boot/efi before you run chroot) and run the command again.

grub-install: error: will not proceed with blocklists
You passed a partition such as /dev/sda2 on a BIOS system. Pass the whole disk, /dev/sda, instead.

Windows does not appear in the GRUB menu
With Ubuntu’s default GRUB_DISABLE_OS_PROBER=auto setting, os-prober runs when /boot/grub/grub.cfg does not exist or when it already contains entries generated by os-prober. If the file exists without those entries, update-grub prints os-prober will not be executed. To enable detection explicitly, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub, make sure the os-prober package is installed, and run sudo update-grub again.

The machine boots straight into Windows after the repair
The firmware boot order puts Windows Boot Manager first. Open the firmware setup and move the ubuntu entry to the top, or run sudo efibootmgr from Ubuntu to inspect and change the order.

Conclusion

The grub rescue> prompt means GRUB cannot find its files, not that your data is gone. Boot once by setting root and prefix by hand, then reinstall GRUB with grub-install and update-grub; if the rescue shell cannot get you there, a live USB with chroot does the same repair from outside the system.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 1000+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page