How to reinstall grub in ubuntu.

After the reinstall of windows grub disappeared. I think this is a big problem for all of us.
So…

Boot the livecd.
Start a terminal.
and type

sudo -i
grub
find /boot/grub/stage1         // this will print something like (hd0,1) this is the disk that you have to write next
root (hd0,1)
setup (hd0)
quit

then restart your machine and now your old grub menu should be there.

Thanks

Advertisements

2 thoughts on “How to reinstall grub in ubuntu.

  1. Adamos says:

    few additions. in case you cant get the grub to find the stage1 file:
    You have to mount your root partition.
    CODE:

    sudo mkdir /mnt/root
    sudo mount -t ext3 /dev/sda6 /mnt/root
    sudo mount -t proc none /mnt/root/proc
    sudo mount -o bind /dev /mnt/root/dev
    sudo chroot /mnt/root /bin/bash
    sudo grub
    find /boot/grub/stage1 (i.e you found (hd0,5)
    root (hd0,5)
    setup (hd0)

    **RESTORE GRUB** after windoz installation
    sudo -s
    mkdir /target
    mount /dev/sda2 /target
    mound –bind /dev /target/dev
    mount –bind /proc /target/proc
    mount –bind /sys /target/sys
    chroot /target
    grub-install /dev/sda

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