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

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

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:
You should be going like ( in GPT ):

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

until you find out something like

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 !


[Grub] Fixing GRUB the hard way

It’s been almost an year since I touched the Linux Grub and for the past two days, I have been paying very well for that.
* Created Debian Wheezy (7) live USB disk wont boot in UEFI mode ( It just wont show up in BIOS )
* Windows 8.1 is installed in UEFI mode.
* Debian Wheezy installed in Legacy mode.
* Grub wont show up – shows grub rescue :\
* Tried Boot-Repair : it wont fix as I can only boot the Debian Live in Legacy mode. Boot repair needs Linux to be booted in EFI mode to fix this. Deadlock situation in which the boot repair needs a UEFI booted OS to fix the GRUB and your USB wont boot in UEFI mode.

The following series will be fixing these one by one 🙂 Stay tuned. Happy hacking!