How to repair / restore Grub on Ubuntu using Live CD

I just upgraded Ubuntu and selected the wrong location to install Grub onto. Basically, I installed Grub on /dev/sda1 and not /dev/sda and so I need to repair and installing grub.

I got out an Ubuntu installer cd which is essential a live cd and booted in it up. Then mounted the sda1 partition:

sudo mount /dev/sda1 /mnt

Grub then needs to have access to /dev so:

sudo mount --bind /dev /mnt/dev

To install Grub on sda then:

grub-install /dev/sda --root-directory=/mnt/ /dev/sda

Note: we are using the –root-directory option rather than changing the root directory using the chroot command which sometimes doesn’t work on a live CD.

For a tutorial with more words these two pages might helped you learn more: