Correct way to re-install grub in Ubuntu

Solution 1:

The standard way is grub-install, so if you e.g. want to install grub on /dev/sda you would run

grub-install hd0

or

grub-install /dev/sda

If you use some other, additional boot manager in /dev/sda adjust the parameter to grub-install.

For some details see info grub-install.

EDIT

Assuming you are installing to /dev/sda (replace with whatever partition you use), you might want to back-up your boot sector with

dd if=/dev/sda of=boot_sector.bak bs=512 count=1

so you could restore it later in case of errors with

dd if=boot_sector.bak of=/dev/sda bs=512 count=1