Linux Boot Failure — GRUB Rescue Mode Fix
In this tutorial, you'll learn about Linux Boot Failure. We cover key concepts, practical examples, and best practices.
GRUB rescue mode appears when the bootloader cannot find its configuration or the Linux kernel. The screen shows grub rescue> with errors like "unknown filesystem", "file not found", or "no such partition". This follows partition changes, disk reordering, or corrupted GRUB installation.
The Problem
On boot:
error: unknown filesystem.
Entering rescue mode...
grub rescue>
Or:
error: no such partition.
grub rescue>
Wrong Approach
# WRONG — random commands without understanding the disk layout
grub rescue> linux /vmlinuz
grub rescue> boot
Right Approach
# Step 1: Find the correct partition
grub rescue> ls
Expected output:
(hd0) (hd0,msdos1) (hd1) (hd1,msdos2)
# Step 2: Find the GRUB modules
grub rescue> ls (hd0,msdos1)/boot/grub
# Step 3: Set root and prefix
grub rescue> set root=(hd0,msdos1)
grub rescue> set prefix=(hd0,msdos1)/boot/grub
# Step 4: Load normal module and boot
grub rescue> insmod normal
grub rescue> normal
Step-by-Step Fix
Step 1: List available partitions
grub rescue> ls
Step 2: Probe each partition for boot files
grub rescue> ls (hd0,msdos1)/
Look for the /boot directory containing the kernel and initrd.
Step 3: Set the correct root and prefix
grub rescue> set root=(hd0,msdos1)
grub rescue> set prefix=(hd0,msdos1)/boot/grub
Step 4: Load the normal module
grub rescue> insmod normal
grub rescue> normal
The GRUB menu should appear. Boot normally.
Step 5: Reinstall GRUB after booting
sudo update-grub
sudo grub-install /dev/sda
Step 6: Fix using a live USB
# Boot from Ubuntu live USB, mount the root partition
sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install /dev/sda
update-grub
Prevention Tips
- Avoid repartitioning the boot drive without reinstalling GRUB
- Keep a live USB handy for emergency repairs
- Back up
/etc/default/gruband customize it before major changes - Use
grub-installafter every kernel update in custom setups - Test boot configuration with
grub-script-checkafter changes
Common Mistakes with boot grub rescue
- Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
- Using
returnto exit a function early instead of wrapping a pure value in the monad - Mixing let bindings with <- bindings in do notation, producing type errors
These mistakes appear frequently in real-world LINUX code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro