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
boot
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.

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!!!!!!!!
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.
Jimmy.
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
boot
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.
Jimmy.
Cheers for this! Life saver!
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
boot
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
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.
Regards
-Anand
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: anatexis.net » when grub rescue strikes
A great shout of THANK YOU!! for the “set prefix=” command!
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
http://ubuntuforums.org/showthread.php?t=1417672
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
Thx.
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!
awesome
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?
It looks like you have selected wrong partition (hdX,Y) or it could not be grub2 installation (legacy grub 1)
same problem here. but i know it’s the right partition and grub 2
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.
PLEAASE HELP ME
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