Black God

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.

55 comments for “How to fix GRUB rescue prompt without Live CD? (For GRUB2)

  1. Stella
    December 17, 2014 at 4:01 am

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

  2. Carl
    July 9, 2014 at 8:29 am

    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?

  3. Sharath
    June 30, 2014 at 6:24 pm

    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…

  4. Mint
    June 8, 2014 at 12:25 am

    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.

  5. arun
    November 20, 2013 at 7:31 pm

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

  6. Ganapathy
    July 6, 2013 at 12:29 am

    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.


    • Bri
      October 17, 2014 at 6:42 pm

      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.

  7. Alex
    June 4, 2013 at 1:12 am

    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.

  8. Rvinth
    May 30, 2013 at 6:49 pm

    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.

  9. Bill
    May 11, 2013 at 2:58 am

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

  10. saravanan
    April 21, 2013 at 7:36 pm

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

  11. mani
    April 18, 2013 at 10:05 pm

    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

  12. Lee Hulbert
    April 1, 2013 at 8:10 pm

    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!

  13. Vinesh
    February 28, 2013 at 11:26 pm

    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.

  14. svg
    October 30, 2012 at 4:30 pm

    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

  15. arun
    August 30, 2012 at 3:44 pm

    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.

    August 18, 2012 at 8:11 pm

    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.

    August 18, 2012 at 5:35 am

    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!!!!!!!!

  18. Sureshrocks S31
    August 9, 2012 at 3:57 pm

    how to solve grup rescue without cd drive?

  19. Osa1
    July 17, 2012 at 12:05 am

    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.

  20. michael
    July 7, 2012 at 9:21 am

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

  21. Costoo69
    May 25, 2012 at 3:36 pm

    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

    • dfgfdhdfgd
      May 25, 2012 at 3:45 pm


      • Osa1
        July 17, 2012 at 12:04 am

        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.

  22. Jones
    May 18, 2012 at 8:05 am

    Cheers for this! Life saver!

  23. Solomon Jxrtm
    May 14, 2012 at 3:03 pm

    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


    • Sarathy2010
      May 25, 2012 at 1:43 pm

      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

  24. Iamhimanshuahuj
    May 3, 2012 at 8:35 pm

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

  25. Anand
    May 2, 2012 at 3:38 am

    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.


    • Black God
      May 2, 2012 at 9:52 pm

      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.

  26. TALF
    April 5, 2012 at 1:40 pm

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

  27. Mansur Agasar403
    April 2, 2012 at 9:18 pm

    nice clear steps

  28. Ubuntuuser1
    March 16, 2012 at 7:57 pm

    I get error:ELF header smaller than expected

    Pls help

  29. Anonymous
    February 23, 2012 at 2:47 pm

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

  30. January 16, 2012 at 3:00 pm

    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

  31. January 10, 2012 at 2:06 pm

    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


  32. December 26, 2011 at 2:07 am

    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?

    • Kaloyan
      April 25, 2012 at 11:48 am

      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!

  33. Rahamathullah Mr
    December 16, 2011 at 4:40 pm


  34. Dmnhunter4god
    November 20, 2011 at 8:28 pm

    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

  35. Ibag4life
    September 18, 2011 at 11:16 pm

    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?

    • Anonymous
      September 19, 2011 at 7:15 pm

      It looks like you have selected wrong partition (hdX,Y) or it could not be grub2 installation (legacy grub 1)

      • Andrea Scalezi
        March 12, 2012 at 6:46 pm

        same problem here. but i know it’s the right partition and grub 2

  36. Spindoctaa
    September 12, 2011 at 11:45 am

    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.


    • Anonymous
      September 12, 2011 at 2:21 pm

      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

      • Majid Einian
        December 25, 2012 at 3:35 pm

        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?

Leave a Reply

Your email address will not be published. Required fields are marked *