Skip to content

GRUB recovery

Warning

When facing issues with GRUB not initiating your operating system, it usually traces back to interference from another OS's bootloader, especially in dual-boot configurations, or from accidentally deleted GRUB configuration files. These conflicts can lead to GRUB failing to load the system, resulting in errors like "no such partition" or "unknown filesystem," and presenting you with the GRUB Rescue prompt or just the GRUB prompt. Understanding GRUB Rescue Commands

In the event of a boot issue, the GRUB Rescue prompt becomes a crucial tool for troubleshooting and fixing boot problems. Here's a concise guide to some essential GRUB Rescue commands you might need:

  • boot: Initiates the boot process. This command doesn't take any arguments.
  • cat: Outputs the content of a specified file.
  • configfile: Loads a configuration file, allowing GRUB to read its settings.
  • initrd: Loads the initial ramdisk image.
  • insmod: Inserts a module into the GRUB boot process.
  • loopback: Attaches an image file as a loop device.
  • ls: Lists contents of a directory or shows available partitions.
  • lsmod: Lists all loaded GRUB modules.
  • normal: Switches to normal mode from rescue mode.
  • search: Searches for a specific device, file, label, or filesystem UUID.
  • set: Assigns or shows environment variables.

Resolving GRUB Boot Failures

To troubleshoot and fix GRUB boot failures, you can use the GRUB Rescue prompt or employ a Boot Repair tool. Here's how you can attempt to fix these issues through the GRUB Rescue prompt:

  1. Identify Environment Variables: Use set to list current environment settings. This helps in identifying which partition GRUB expects to boot from.

  2. List Partitions: Utilize ls to display partitions available on the disk, aiding in locating your system's boot partition.

  3. Find Boot Directory: With ls [partition-name], navigate to find which partition contains the /boot directory.

  4. Define Boot Partition: Once identified, use set root=(hd0,msdos1) to specify the boot partition.

  5. Load Normal Module: Employ insmod normal to load the normal boot module.

  6. Enter Normal Boot Mode: By executing normal, you transition into a mode where more complex commands can be issued.

  7. Load the Kernel: Use the linux command to specify the kernel to boot, along with any necessary parameters.

  8. Boot the System: Finally, the boot command initiates the system boot with the provided settings.

Through these steps, you're not just troubleshooting but also gaining a deeper understanding of how GRUB manages the boot process, providing you with the knowledge to resolve similar issues in the future. This method is straightforward and doesn't require external tools, making it an efficient solution to common GRUB boot problems.