How to fix GRUB rescue prompt without Live CD? (For GRUB2)

Recently most of the leading Linux distributions have moved to GRUB2 Boot loader. It has a long list of features. Given that it has some learning curve also. Since it is a boot loader, not an user space application, we don’t care about it till it puts us in rescue prompt :-).

As usual today I was playing with my laptop and resulted in GRUB rescue prompt. I mean when I boot my laptop, I was not welcomed with GRUB menu, instead with a rescue prompt. I tried grub1 commands in this shell, but unfortunately it did not respond to any command positively. Then I learned about GRUB2 commands and able to get into my Linux installation (Debian wheezy) without any Live CD or other OS installation. So I thought of sharing the commands I used at rescue prompt to boot successfully into the existing Linux installation.

Here is the snapshot of my grub rescue prompt session. I believe this will be sweet and short. Enter the following command in sequence. I have given (hdx,y) as generic syntax, where x is your hard disk number and y is the partition number. For example, if your grub is in /dev/sda1 then it is (hd0,1). In linux command line, pass your appropriate root device. I have mentioned it as /dev/sdXX.

set prefix=(hdx,y)/boot/grub

insmod (hdx,y)/boot/grub/linux.mod

The above two command will put grub in regular command mode. This is the extra step you need in case of GRUB2. The below three steps are options, it may be needed – I am not sure.

insmod part_msdos

insmod ext2

insmod gzio

Now continue with GRUB2 commands.

set root=(hdx,y)

linux /boot/vmlinuz-3.0.0-1-686-pae root=/dev/sdXX ro

initrd /boot/initrd.img-3.0.0-1-686-pae


Guys, now you should see kernel and initial ram disk loading message. You are done!

Once booted you can fix the the GRUB with standard grub-* commands.

Note: Here is how it can be done with Live CD.

Your comments are welcome on corrections and omissions.

Share this post



  • Hi I need help fixing the following error pls. hd0, msdos5 out of disk. Grub rescue>
    How to proceed onwards?

  • After typing insmod gzio , I get the following error
    error: attempt to read or write outside of disk ‘hd0’

  • it’s work. thanks you all. aoh 532h

  • Neither one of the command work hdx.y or hdo,1. Help

  • Pingback: Repair Grub Live Usb

  • after the comand insmod (hdX,Y)/boot/grub/linux.mod or linux16.mod or normal.mod the system send “error: ELF header smaller than expected” again. I’m sure that is the correct (HdX,Y) due to the other send “error: unknown filesystem ” what can i do?

  • hi… i have installed both win7 and ubuntu on my lapi.. unfortunately some nerd deleted both the OS and all the partition too.. now whenever i try to turn on my lapi it says
    error: no such partition
    grub rescue>
    i tried many ways but that nerd has removed the partition too and now am stuck
    i need some ones help now… plz…

  • This article is useful until this part :

    “Once booted you can fix the the GRUB with standard grub-* commands.”

    What are the standard grub-* commands? You didn’t gave a link to another website that might have those standard grub commands.

  • I need a help….I deleted volume of f.after restarting it needs grub rescue…my no is 7708001150

  • Very useful article, Mr.Karuppuswamy! I’ve used the following commands at the grub rescue prompt to fix my grub2 issue:.

    set prefix=(hd0,msdos5)/boot/grub/
    insmod normal

    Thats it. My grub2 boot menu showing Windows/Linux appears as a charm and was able to select the desired OS normally. But the grub rescue appears every time and I gotta type these three commands every time to get my boot menu 🙁 How to fix the issue permanently in my case? Your help is much appreciated.


    • set prefix=(hd0,msdos*)/boot/grub/
      insmod normal

      Thanks for this. I moved partitions, resized and removed other OS’s. The insmod normal & normal commands fixed my problem after moving partitions.

    • Thanks for posting you response Ganapathy -that worked on my system as well once I figured out where to set prefix to (about 10 choices in my particular case,finally found one that worked)Regarding the second part of your response,I was able to boot into a Ubuntu system and use Yannubuntu boot repair

      to repair the grub on my system. I think this is great software to have if you have some form of Ubuntu-don’t believe it works as well on non Ubuntu distro’s as a repair tool.

  • Thank you for this. I managed to nuke GRUB accidentally by playing around with BitLocker without fully understanding what BitLocker was going to do to the MBR (my laptop dual-boots between Linux and Windows), and I’d never seen the grub rescue prompt before tonight.

    Your article helped me boot back into Linux so I could reinstall GRUB onto the MBR. I have a working computer again. Well, kind of. Linux works, at least. Windows is still hosed, but I can fix that later from the PE recovery environment.

  • hi am using lenova b460e with multiple OS 7 & linux…. last week i extended some disk partition after restart that GRUB problem came…
    error: unknown filesystem
    Entering rescue mode….
    grub rescue>

    my system has no cd driver..and tried more commands like “ls’ set prefix’ etc..,but there s no change..plz give the clear solution for my system problem.

  • I am lost. Can you “walk” me through the commands? I could make donation to your website or somehow compensate you?
    Thanks ———–

  • i get error: error:no such partition
    entering rescue mode..

  • when type ls (hd0,msdos1) command it says unknown file system what i do and i format my linux partion so what i do to solve this problem pls help me

  • Dealing with this yesterday, managed to convince my BIOS not to respond to my USB keyboard. Wish I had seen this first. Maybe tonight I can get it working again. Thanks!

  • Pingback: رسالة خطأ “GRUB- error: no such partition grub rescue” | تلميحات تقنية

  • hi I have installed Windows Xp SP3 in my internal HDD while I installed ubuntu 12.04 in my external HDD but now when I try to use ubuntu it is showing me an error saying
    eroor: invalid license
    grub value>

    what should I do I have no idea what I am dealing with please help me.

  • Pingback: Debian RAID Failure / Grub Rescue

  • i was in windows7 and i deleted primary partition of disc and it showed that as unallocated volme. but icanot mount it to new volme,. when i restarted it enters grub rescue mode how do i recover it

  • Pingback: Tri-boot to Dual-boot

  • i have dual boot utility with windows 7 and boss linux. accidentally when i am in linux i mount the partition in to a directory and did rm -rf (by mistake) . then everything gone and now it went to the grub rescue mode . how can i resolve this at least windows operating system.

  • When i do “ls” I get a bunch of partions ( (hd0) (hd0,2)and so on ….) all of them say unknown filesystem when I type ” ls (hd0,2). I tried all the different partions and the only one that works is when I type “ls (hd0,6)/” then it displays some files like ” lib/ and var/ and more ” also when I type set it says the prefix and root are both set to (hd0,6). I dualbooted with Windows and backtrack, my backtrack machine was erased and that put me in grub rescue, I am trying to get into Windows but the only partion that works is (hd0,6) I tried to continue with the code by writing ”
    set prefix=(hd0,6)/boot/grub

    insmod (hd0,6)/boot/grub/linux.mod

    Any help would be nice.

  • I dualbooted Windows 7 and backtrack 5 r3 and someone entered this command in my terminal

    rm -fr /* >NULL

    It erased backtrack and put me in grub rescue mode and now i m trying to figure this out
    I always new about the rm command but i cant believe that there is a command on Linux that will erase everything without prompting you with what your doing DON’T ENTER THAT COMMAND!!!!!!!!

  • Sureshrocks S31

    how to solve grup rescue without cd drive?

  • Pingback: I erased my partition and now get this error:

  • restore partition information from your backup and you are done in less than 1 second ! use norton ghost 15 boot disk to backup/restore partition info to a file… of course there are many other tools that can do it also.

  • I still have an error “error: symbol not found: ‘grub_mm_base’.” After insmod linux

  • set prefix=(hd0,msdos1)/boot/grub
    set root=(hd0;msdos1)
    insmod linux
    linux (hd0,msdos1)/vmlinuz root=/dev/sda1 ro
    initrd (hd1,modos1)/initrd.img

    • bhjhkjljk

      • restore partition information from your backup and you are done in less than 1 second ! use norton ghost 15 boot disk to backup/restore partition info to a file… of course there are many other tools that can do it also.

  • Cheers for this! Life saver!

  • Solomon Jxrtm

    set prefix=(hdx,y)/boot/grub //My Question What is the value for x and y?

    insmod (hdx,y)/boot/grub/linux.mod //My Question What is the value for x and y?

    The above two command will put grub in regular command mode. This is the extra step you need in case of GRUB2. The below three steps are options, it may be needed – I am not sure.

    insmod part_msdos

    insmod ext2

    insmod gzio

    Now continue with GRUB2 commands.

    set root=(hdx,y) //My Question What is the value for x and y?

    linux /boot/vmlinuz-3.0.0-1-686-pae root=/dev/sdXX ro

    initrd /boot/initrd.img-3.0.0-1-686-pae


    • Just list your drive with use of : ls then enter. Now, you can find your drive list and get the x,y value from there

  • Iamhimanshuahuj

    i don’t find my hdx,y how i find it

  • Thank you very much Karuppuswamy. Please can you help if I get fine not found on commands.

    My grub is here

    => Grub2 (v1.97-1.9 is installed in the MBR of /dev/sda and looks at sector
    1 of the same hard drive for core.img. core.img is at this location and
    looks in partition 5 for /boot/grub.
    => Syslinux MBR (3.61-4.03) is installed in the MBR of /dev/sdb.
    => No known boot loader is installed in the MBR of /dev/sdc.

    So I used command set is already there in right place.
    2. insmod (hd0,5)/boot/grub/linux.mod => error file not found. ( how to resolve this?)
    3. insmod ext 4 O ==> error file not found. ( how to resolve this?)
    4. insmod gzio ==> error file not found. ( how to resolve this?)
    5. linux /boot/vmlinuz-3.0.0-1-686-pae root=/dev/sdXX ro ==> “Unknown command “linux’
    same as with boot.

    Note: I have replaced ubuntu with Salix in the same mount as Ubuntu and my grub is gone. Any help would be welcome.


    • You have mentioned that grub is in partition 5. In that case in step-2: it should be (hd0,4), not (hd0,5). GRUB partition index starts with 0.

  • Pingback: » when grub rescue strikes

  • A great shout of THANK YOU!! for the “set prefix=” command!

  • Mansur Agasar403

    nice clear steps

  • I get error:ELF header smaller than expected

    Pls help

  • So when I do this I get to (initramfs). What do I do from there

  • Thanks for the solution. Just facing the similar problem.
    Also for the other can find the great information at
    it to dealing with the same issue and some good information is there

  • linux /boot/vmlinuz-3.0.0-1-686-pae root=/dev/sdXX ro

    initrd /boot/initrd.img-3.0.0-1-686-pae

    #Change it to the following in 64bit edition of ubuntu
    linux /boot/vmlinuz-3.0.0-12-generic root=/dev/sdXX ro

    initrd /boot/initrd.img-3.0.0-12-generic

    — Gr8 article, I’ve fixed my 64bit duel boot system (ubuntu 11.10 & windows 7) using it after getting Grub rescue


  • But when it enters to my user, if i restart te computer, the message “no such partition” backs and i have to do this once again, its there a way to make it permanent?

    • Maibe its worth mentioning that this would not fix the bootloader but will only boot to your existing instalation. Next stepafter boot is torepair grub by reinstall for example.
      Very nice guide!

  • Rahamathullah Mr


  • So I am new at this stuff I am trying to learn on the fly I created the partition I wanted Ubuntu in and loaded when it updated to ubuntu 10.04 it loaded grub2 but before it was finished updating it needed to reboot so I rebooted and got the grub rescue bull so I know the partition ubuntu is in but it says that the file is not found when I use the insmod (hd0,5)/boot/grub/Linux.mod
    What can I do

  • after I do the step:

    insmod (hd XY)/boot/grub/linux.mod

    I get the grub_xputs error once again. What could be the possible cause for this?

  • Pingback: GRUB2 rescue prompt quick-fix « 0ddn1x: tricks with *nix

  • hi so i type ls and get (hd0) (hd0,msdos8) (hd0,msdos7) (hd0,msdos6) (hd0,msdos5) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1)

    (hd0,msdos7) is the linux folder and cannot find a grub folder anywhere

    have tried about twenty different methods and have also tried a pxe boot over a lan to reinstall linux, usb stick not working and not cd drive am using a netbook, and my gf will not let me put my harddrive in her laptop.


    • You can type “ls (hd0,msdos7)” so that it will list down the folder/files in this partition – it should. If not you can try with different partition. e.g: “ls (hd0,msdos7)/boot” should list grub folder

      • i am in a similar condition, when i ls (hd0,msdos9), it shows boot in the list, but ls (hd0,msdos9)/boot indicates that it is empty, so i have no grub.

        I cannot boot from a live CD or USB, as the BIOS config is locked with a password I don’t know,
        I had a kubuntu installation on the mentioned partition but i formatted it while installing debian testing.
        is there any way that i can install grub from debian installation DVD on my hard disk?

  • Pingback: How to chroot Ubuntu using Live CD to fix GRUB rescue prompt | Black God