Restore Grub

Tuesday, September 18, 2007

How to restore grub, the linux boot manager. Maybe a Windows installation has written over the MBR?

Use a boot disk, such as Knoppix or Ubuntu LiveCD.

1. $ sudo grub
2. grub> find /boot/grub/stage1
(If it fails here, jump to 'preparing root' below)
3. grub> root (hd#,#) (where 'hd#,#' is the result of step 2)
4. grub> setup (hd#)
5. grub> quit
That's it. Done!

-------------------------------------------------------------------------
Preparing root
If step 2 failed above then do these steps first:
A. $ sudo mkdir /mnt/root
B. $ sudo mount /dev/sda1 /mnt/root (where sda1 is your linux partition)
C. $ sudo mount -t proc none /mnt/root/proc
D. $ sudo mount -o bind /dev /mnt/root/dev
E. $ sudo chroot /mnt/root /bin/bash
Now start again from step 2 above.

Full credit to the guys on this thread at ubuntuforums.

posted 8:18 pm  

0 comments:

Post a Comment