Showing posts with label grub. Show all posts
Showing posts with label grub. Show all posts

Monday, March 8, 2010

Struggling with Grub-rescue

I am having two hard disk on my desktop, so just for fun I tried to install newer version of Ubuntu (Ubuntu 10.04 LTS: The Lucid Lynx) on another hard disk and wanted to dual boot.

During installation I don't know what goes wrong but i corrupted my original boot entry and after installation i was not able to see my original Ubuntu installation on  boot entry. And to my horror i was seeing strange grub-rescue prompt.

I thought I lost my previous installation and I will not able to use my new installation as well. but then after searching a while I found following commands using which I was able to boot into my both installation.

If you encounter this prompt then don't panic there are plenty of way out. I just figured out one way. Not a permanent solution but will work till I found permanent solution.

Type "ls" command on "grub rescue" prompt, it will display available partition on and available hard disk on machine.

It will show something like following

grub rescue> ls
(hd0) (hd0,1) (hd0,2) (hd0,3)


"Set" command will show you current boot entry, something like following


grub rescue> set
prefix=(hd0,1)/boot/grub
root=hd0,1
To see content inside partition, give following command.



grub rescue> ls (hd0,1)/
./ ../ lost+found/ boot/ sources/ /scripts/ /tools/ /dev proc/ sys/ bin/ etc/
home/ lib/ mnt/ opt/ media/ sbin/ srv/ var/ root/ tmp/ usr/ antarix/ README log/
So this way you can be sure if you have lost any data or not. I my case everything was fine.
So now I wanted to boot into my  installation on hd0. For that i used "insmod" command.
insmod /boot/grub/normal.mod
It will load grub module in to normal mod, you can press tab twice to see list of available option or type help.
And after  grub loaded in to normal mode I used "normal" command and my older installation of Ubuntu started to boot.