Introduction to Grub Rescue

Grub is a boot loader for many Linux distributions which basically tells your system where it can find installed operating system(s) on one or more hard drives. Your PC needs this information in order to boot into your Linux distro successfully.

When powering on your PC, Grub begins to look for installed operating systems. If it has trouble finding one or if it can’t load part of its config, you’ll be brought to the Grub Rescue command line interface that allows you to repair the boot loader.

In this guide, we’ll show how Grub Rescue works, along with the commands you’ll need in order to repair a broken boot loader and get back into your Linux install.

If you experience a no such partition error, we have a separate guide for how to fix grub error: no such partition grub rescue

In this tutorial you will learn:

  • What are the Grub files?
  • How to repair Grub
  • What to do if Grub is completely broken
Grub rescue on a Linux system

Grub rescue on a Linux system

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro using grub
Software GRUB
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Grub Files

Let’s start with developing a basic understanding of grub. The grub files on your system can be found in /boot/grub. This directory contains the grub config file grub.cnf along with other files that are essential for grub to find and boot into your operating system(s).

Grub files on Linux

Grub files on Linux

If one of these files gets deleted or otherwise edited to prevent grub from doing its job, you’ll find yourself at the grub rescue menu the next time you restart your computer. Other times, fiddling with partitions in a dual boot environment can cause similar issues. Either way, you end up needing to repair grub, which is what we’ll cover next.

How to Repair Grub

When you get to a grub> prompt, you can use the following commands as an attempt to fix your boot loader and get booted back into your Linux distro.

  1. Start by doing a simple ls listing to see what partitions are available. Depending on your configuration, you may see multiple hard drives or partitions in this listing.
    grub> ls
    (hd0) (hd0,msdos1)
  2. You can see the files of any partition by using another ls command. This will help you indentify which partition you want to boot into.
    grub> ls (hd0,msdos1)/
    lost+found var/ dev/ run/ etc/ tmp/ sys/ proc/ usr/ bin boot/ home/ lib lib64 mnt/ opt/ root/ sbin srv/
  3. Once you have determined the correct partition, you can set it as root with the following commands. For our example, we’ll be using (hd0,msdos1) as our root partition, /boot/vmlinuz as our Linux kernel, /boot/initrd.img as our image file, and /dev/sda1 as our device name. Depending on your distribution and configuration, these values may be different for you. Use tab completion to help select the right Linux kernel and image file, and fdisk -l command to get the correct device name.
    grub> set root=(hd0,msdos1)
    grub> linux /boot/vmlinuz root=/dev/sda1
    grub> initrd /boot/initrd.img
  4. Once you have set the root partition, Linux kernel, and initrd image file, you should be able to successfully boot into your Linux distro.
    grub> boot
  5. Once loaded into your system, finish repairing Grub by remaking the config file and reinstalling Grub.
    # grub-mkconfig -o /boot/grub/grub.cfg
    # grub-install /dev/sda
    # reboot

What If Grub Is Completely Broken?

If you are brought to the grub rescue> prompt when booting your computer, you’ll need to use live media to help repair your system. Once you are booted into the live environment, open up a terminal and type the following commands.

  1. First, mount your partition. Use fdisk -l if you’re not sure of the correct name.
    # mount /dev/sda1 /mnt
  2. Chroot into the installed system in order to reconfigure grub.
    # chroot /mnt
  3. Generate a new grub config file (on Debian based systems, an alternative to the below command is update-grub).
    # grub-mkconfig -o /boot/grub/grub.cfg

    1. Lastly, install grub onto the device, exit chroot, and reboot your system as normal.
      # grub-install /dev/sda
      # exit
      # reboot

    This should get your Linux install back up and running, even if grub had been completely broken or deleted from your system.


    If grub doesn’t work properly, your computer doesn’t know how to load Linux. It can be really intimidating when the grub prompt loads up and none of the normal Linux commands seem to work. However, rescuing grub is pretty simple once you understand how it functions and what commands to use. The steps above should help you repair grub, whether it has just been misconfigured or requires a complete reinstallation.

Comments and Discussions
Linux Forum