close

Home Remodeling Boise

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

Posted on by

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

Your comments are welcome on corrections and omissions.

, , , , , , ,

Previous     Next


TAGS


CATEGORIES

.