[Grub] Booting Linux from a faulty grub – rescuing grub_resuce

This would be the most interesting post in the grub series – if you have read the previous ones and you are in the above situation.

Situation:
* Grub wont show up – shows an error and grub_resuce>
* Cannot do boot repair – as the live disc is booting only in Legacy mode – and UEFI entry for the USB drive is missing from the boot menu [1]
* Linux was successfully installed somewhere on your drive – and you forgot where – and you want to boot that one.

Fix:
I am personally attaching a few screenshots to add beauty to the steps. These are taken from my Virtualbox – where linux was installed as legacy.
* You would have a grub rescue terminal similar to this one:
Grub rescue
* Find the partition where you installed Linux

grub > ls
(hd0) (hd0,msdos5) (hd0,msdos4)

If your partition is a GPT one. ie OS was installed as UEFI : you would find something like :

grub > ls
(hd0) (hd0,gpt5) (hd0,gpt4)

* Bruteforce ‘ls’ to find your Linux partition:
ls
You should be going like ( in GPT ):

grub > ls (hd0) 
grub > ls (hd0,gpt5)

until you find out something like
initrd

grub > ls (hd0,msdos1)
Filesystem type ext2 - Last modiifcation date : blahblah

The ext2 type of partition shows that you have probably hit the right one. To ensure that:

grub > ls (hd0,msdos1)/

ls into partition
Yay ! That looks similar to a standard Linux ‘/’ partition. So you would get that your linux resides in (hd0,msdos1).
* Start the boot procedures.
Before we start – let me copy paste a standard grub:
standard grub
We will have to give roughly similar params to make sure that our grub boots right.

grub> set root=(hd0,msdos1)
grub> linux /boot/vmlinux-3.2.x.x  root=/dev/sda1
grub> initrd /boot/initrd.img-3.2.x.x 
grub> boot

boot params
Hint: You can find out the proper root=/dev/sda1 with a trick.
(hd0,msdos1) means /dev/sda1.
(hd0,msdos2) means /dev/sda2.
(hd1,msdos1) means /dev/sdb1.
(hd0,gpt1) means /dev/sda1.
Thats it ! Hit enter – and you will see your installed linux booting !! Yay!
You will find out how to re-install grub in the next post !

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s