Repair Linux boot failures in GRUB 2 rescue mode

As GRUB 2's ability to fix boot problems has greatly improved over the original GRUB bootloader. This article provides you with information on available options for repairing GRUB 2 boot issues and specific instructions on how to use the GRUB 2 terminal. The instructions are written for GRUB 2.

How it looks?

There are basically three error messages or screens when GRUB fails to boot.

grub>: This is the screen mode you see when GRUB has found everything except the configurationn file. This file probably will be grub.conf.

grub rescue>: This is the mode when GRUB 2 is unable to find the GRUB folder or its contents are missing/corrupted. The GRUB 2 folder contains the menu, modules and stored environmental data.

GRUB: Just "GRUB" nothing else indicates GRUB 2 failed to find even the most basic information needed to boot the system.

These are the basic errors that may occur during booting. Although there are a few more errors that can be seen on the screen like frozen splash screen, Busybox or Initramfs: GRUB 2 began....
But each of the GRUB 2 failure modes can be corrected either from GRUB 2 terminal or the Live boot CD or DVD of the distro, there are also 3rd party rescue tools available out there.

Basic commands available.

These are the commands that can be used when you enter the GRUB 2 terminl mode by pressing "c".

boot (Initiate the boot, also F10 or CTRL-x)
cat (view the contents of config or txt files; cat (hd0,1)/boot/grub/grub.cfg)
configfile (Load a GRUB 2 configuration file such as grub.cfg; configfile (hd0,5)/boot/grub/grub.cfg.)
initrd (Loads the initrd.img, necessary for booting; initrd (hd0,5)/initrd.img.)
insmod (Loads a module; insmod (hd0,5)/boot/grub/normal.mod, or insmod normal.)
linux (Loads the kernel; insmod /vmlinuz root=(hd0,5) ro.)
loop (Mount a file as a device; loopback loop (hd0,2)/iso/my.iso.)
ls (lists the contents of a partition/folder; ls, ls /boot/grub, ls (hd0,5)/, ls (hd0,5)/boot.)
lsmod (List loaded modules.)
normal (Activate the normal module, if loaded.)
search (Search for a device. Type help search for the available options.)
set (Review current settings, or set XXX to set a variable such as colors, prefix, root.)
vbeinfo (Display GRUB 2 available resolutions.)

The Rescue Shell.

If you get a rescue shell, this usually means that GRUB failed to load the "normal" module for some reason. It may be possible to work around this temporarily: for instance, if the reason for the failure is that "prefix" is wrong (perhaps it refers to the wrong device, or perhaps the path to "/boot/grub" was not correctly made relative to the device), then you can correct this and enter normal mode manually: Inspect the current prefix (and other preset variables):

set

You will probably have an output more or less like this:



Your output may differ but you get the information required. Find out which devices are available:

ls



Set to the correct value, which might be something like this:

set prefix=(hd0,1)/grub

(this has to be done according to your own drive name)

set root=(hd0,1)

(this has to be performed according to your own drive name.)

insmod normal
normal

The above commands will get you out of the rescue mode to the normal terminal mode. In the terminal mode you have more commands with increased functionality.
After the above commands you can go ahead and start the rest of the settings.

insmod linux 
* linux /vmlinuz root=/dev/sdXY ro

(if this doesn't work try this)

linux /boot/vmlinuz-3.2.0-14-generic root=/dev/sda1 ro

(optional)

initrd /initrd.img

(Selects the initrd image.)

boot

After Booting the system.

Update the GRUB config file.

sudo update-grub

Reinstallation of Grub on the device:

sudo grub-install /dev/sdX

This should be it for the rescue part and your system should be good and running. If not you can save all your trouble by using Boot Repair. This is the tool used to repair your complete boot menu. It can be downloaded directly and used as a Live Boot CD or DVD. Here is the download link.

Share this page:

Suggested articles

37 Comment(s)

Add comment

Comments

By: Ashi

After I type insmod normal it says error:file not found. What did I do wrong?

By: Justin Bailey

use "ls <drive>/"

You can snoop around and see where your boot directory resides.

By: Mohamed Sadiq

can U write the command  ? 

By: William Haynes

 I had to do this for insmod normal to work

set prefix=(hd0,1)/boot/grub

By: Ben Bullard

After I type insmod normal I get:

error: invalid arch-independent ELF magic.

What does this mean and can it be fixed.

By: Stan Wright

You lost me after the 'set' command.  What is the "information required"?  After the 'ls' command you say to set to the correct value.  What is the correct value?  Also, what is 'my own drive name'?

I appreciate you posting this procedure but could you post it for a much dumber audience.  Thanks.

By: akash

Getting this:

[email protected]:/$ sudo update-grub/usr/sbin/grub-probe: error: failed to get canonical path of `/cow'[email protected]:/$ sudo grub-install /dev/sda3Installing for i386-pc platform.grub-install: error: failed to get canonical path of `/cow'.

By: azhar

Type insmod show no module specified

By: Andre Bangma

Great webpage. I didn't know anything about Linix, but with your commands till: insmod normal normal

I could start up my Qimo kids linux again and with the update grub config file en reinstallation of grub, my windows Xp and Linux is working again. Thank you very much

after windows install it went to grub emergency, nothing worked, with the LS or Set commands, i thought my partitions were screwed.

Then i ran the following as a last resort from the howtogeek page and it worked

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

then open boot-repair and repair disk

By: Gerald F Kenne

Hi, help... . I was in Windows Vista, trying to merge partitions because after getting updates for Ubuntu, the machine would take me to the usual login screen, but only showed black and white stripes on screen. But wouldn't bring my Ubuntu desktop back up.

By: Gerald F Kenne

I rebooted, and grub rescue mode,

grub rescue    

is displayed, however I'm not able to use any of the commands that I'm aware of from Ubuntu forums, and I am sorely very inexperienced as my machine has run for nearly four years without any problems at all.

By: Christian

Thanks man, I was totally stuck this was my first install of Linux.

By: Tatiana

None of the partitions have the filesystem. What do I do?

By: agosys

thanks ..... finally almost was going to reformat that saved me as always good contributions last look and look until I found you because all pointed to / boot / grub that was the downside has a 10 ... x10 .......... ...............

By: Jana

it's not working in boss linux

By: steven

using open suse tumbweed  windows boot was removed by an up grade wth out any information to that regard so after some time and with my udual decorum i deleted the entire system after grub2 refused to reconise a cd install of win 7 , befor i inves any time in hunting down thoses responcable for the removal of win compateably in grib 2 and resoundly giving them a thrashing  how do  to get gurb2 out of the way an add joy was to find it also seems to have changed the ever faithful ,save me , system inderpendant the bios  from reconising the win 7 boot cd  open suse/grub   your  a socapath

By: tohid hossain

The graphical way. Insert your Ubuntu CD, reboot your computer and set it to boot from CD in the BIOS and boot into a live session. You can also use a LiveUSB if you have created one in the past.

By: Daniel

Hi Gurujyot_singh!

Thanks a lot for this post! I have a server running Debian 8 with qmail/tinydns (qmailrocks) and roundcube. After a simple upgrade, I decided to restart the machine and what surprise! It stops at this grub2 screen. It freezes any belly, isn't it? I was on lucky because I found this post and the services are used only on work time and this step was done at night. So, I could fix it on time!

 Again, thanks a lot for this post because it is very simple and clear to read and understand! You wrote like a boss! Forgive me about my english..

By: Anon

grub rescue>set prefix=(hd0,msdos1)/boot/grub

 

This returns a "could not read or write outside of disk 'hd0'

 

what is this? thanks!

By: Shakasvilley

Just had this problem, tried all these recommended set commands; set prefix=bla bla bla, even tried booting from a usb device, nothing worked. So I thought the hard drive was knackered opened up the desktop case,pushed the hardrive power supply and data cables in a bit. Closed the case and powered the desktop backup and to my surprise, the desktop booted up successfully.

By: Alexandre Oberlin

Hello,

I can see no date on this page and suppose it is not obsolete.

I am currently trying to use my previous dual boot disk (Debian 8 / Windows 8.1 64 bits)  through USB in  a new computer with Windows 10 only. Is it possible? Windows 10 only shows me the Debian 8 entry (not the Windows 8.1) and if I choose it I just get the grub rescue prompt with no idea as to what to do.

Any hint?

By: Dergeh

problem is that "linux /boot/vmlinuz-......-generic root=/dev/sd.. ro"

still gets me "attempt to read or weite outside od disk 'hd2'

By: Max

Just want to give you a thousand high fives

By: V S N

I have an old Atom PC. I tried some of the suggestions but I only got "error: file /grub/i386-pc/linux.mod not found". As an afterthought, I just removed hdd connections and put them back. It booted normally. Earlier, I was thinking that the prblem might be due to docker installation.

By: Robert

Have you tried booting from USB and not from the normal hard drive? You probably need to install grub to the USB drive.

By: Mohamed Sadiq

After entering the Command insmod normal no such partition

By: Shalom

I had the same problem and everything i tried wasn't working so I installed linux as manufacturer and did what's wrote above. Now it's working perfectly but pay attention it is going to wipe all other OS that are installed

By: dona13

Hello, I am not a pro, in fact I do not know a lot about linux and I am kinda lost in the tutorial. My output for set command does not look like the one in tut and do not know what to use in set root and set prefix

Can somebody help someone like me, who does not know much ?Thank you

By: dona13

hi again, here is the output

grub>set gives the following output:

prefix=(lvmid/Qubc15-ukdT-ECmL-Jq3F-6bvx-1pZV-9nAfxg/OWWPMi-l1DL-CuWL-iWmS-3vNO-2Aty-4eByHo)/boot/grub

root=lvmid/Qubc15-ukdT-ECmL-Jq3F-6bvx-1pZV-9nAfxg/OWWPMi-l1DL-CuWL-iWmS-3vNO-2Aty-4eByHo

grub>ls gives the following output:

(hd0) (hd0,msdos1) (lvm/mint--vg-swap_1) (lvm/mint--vg-root)

By: dona13

hi again, here is the output

grub>set gives the following output:

prefix=(lvmid/Qubc15-ukdT-ECmL-Jq3F-6bvx-1pZV-9nAfxg/OWWPMi-l1DL-CuWL-iWmS-3vNO-2Aty-4eByHo)/boot/grub

root=lvmid/Qubc15-ukdT-ECmL-Jq3F-6bvx-1pZV-9nAfxg/OWWPMi-l1DL-CuWL-iWmS-3vNO-2Aty-4eByHo

grub>ls gives the following output:

(hd0) (hd0,msdos1) (lvm/mint--vg-swap_1) (lvm/mint--vg-root)

By: dona13

I have also tried this : I downloaded and created a live USB with the same Linux that was installed (Mint 19.3 XFCE 64 bit) and booted with it. Then I launche an utility that I have found in Mint called Boot Repair and I followed the instructions. Everything seemed OK, but at the very end I got a message telling me that something is wrong. I tried to do the Boot repair again but now it gives an error since the very beginning. The only thing I am not sure about is that when I did it the firs time, one of the steps was for me to choose where to reinstall the grub and I have chosen from the list the very first item which was something called sda and looked like my hard disk. The second item was sda0, or something like this and I wander if I maybe did not choose the good one. Thank you

By: Filippos

I have a problem with grub2 : ERROR:grub_file_filters not found What can I do with this prompt? grub.cfg is in (hd0,msdos1)/grub2 grub rescue> set root=hd0,msdos1 prefix=(hd0,msdos1)/grub2 grub rescue> ??? Thanks in advanced Filippos

By: archery

This tutorial works great overall.  However, one step that's got me stumped is this.  In your final command above (sudo grub-install /dev/sdX), how does one find which drive is your root drive.  I'm dual booting with Windows 10 installed first (if this matters).  I'm also using an NVMe drive.  I assume my command will look like:

$: sudo grub-install /dev/nvme0n1pX

But I have no clue how to determine which X is the correct partition path.  While in the grub command line (which is where I land when I boot up the machine), I find that the grub is located in (hd0,gpt5)/boot/grub/.  Does this mean X is 5 in the above grub-install command?

Any help is much appreciated.

 

Sincerely,~~archery~~

 

By: Sayed

I used Rescatux live usb to fix bootloader issue. Works like a charm.

By: Manfred

Ihave some Problems. First sorry for MS Bad English.Khane lesende English in sool Mord than 40 years ago.

My problems: Every time after typing the orders Ahonen, i get several answers by PC. Sometimes ehe Snyder days directory is encrypted, sometimes no such directoy Ort sometimes unknown filesysretm.in Dach Gase the word error before. Please can you hell me RTL Solveig the Problem?

By: Larry Gardner

Just installed Linux MINT x64 Cinnamon 20.1 and after reboot I get an error: attemp to read or write outside of disk `hd0'.

PC is a HP xw4400 BIOS 2.07 (no UEFI) so Grub should not use UEFI as a boot loader.

partitons: (hd0) (hd0,msdos5) (hd0,msdos1) with msdos5 the file system where /boot/ contains efi/ grub/ and System.map-5.4.0-58-generic config-5.4.0-58-generic vmlinuz-5.4.0-58-generic initrd.img-5.4.0-58-generic vmlinuz initrd.img.old initrd.img

I've also tried Linux MINT 21.1 Cinnamon, the installation USB boots and the PC is stable it's only after install/rebooting the error happens and I end up in grub> 

A fix or directions on how to get the install to not use EFI please.