Boot fails after Windows trouble: Use GRUB from Live-CD to reinstall MBR

The other day a colleague did some maintenance work on a multiboot system. Unfortunately he ended up with a completely unbootable system.

This was the right moment to have the Ubuntu CD ready. We booted Gutsy and then:


sudo su
grub

At the grub prompt, we typed root space left bracket and then the TAB key:


grub> root (hd0,
Possible partitions are:
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 1, Filesystem type unknown, partition type 0x7
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x82

This was an easy decision. There is only one partition, which carries an ext2. So input 2:


grub> root (hd0,2)

Now GRUB knows where to take his files from. The second and final step is to run setup. Again TAB is your friend.


grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 17 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,2)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.

Please note that in this case we wanted to replace the MBR. That is why we wrote (hd0).
Finally leave grub with quit.

If for any reason you are not able to use the above described method root + TAB, you may use the find command in GRUB:


grub> find /boot/grub/stage1
(hd0,0)
(hd0,4)

Advertisements

Tags: , , ,

One Response to “Boot fails after Windows trouble: Use GRUB from Live-CD to reinstall MBR”

  1. red high heel shoes Says:

    YAA Adding this to my bookmarks. Thank You

Leave a Reply

Fill in your details below or click an icon to log in:

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


%d bloggers like this: