This will restore grub if you already had grub installed but lost it to windows install or some other occurrence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.
Boot into the live Ubuntu CD. This can be the live installer or older Live session of Ubuntu cd.
When you get to the desktop, open a terminal and type following commands.
This will get you a “grub>” prompt.
This will returns a location.If you have more than one, select the installation that you want to provide the grub files.
Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)
Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)
Next enter the command to install grub to the mbr.
Following output will be displayed on your screen if the grub re-installed successfully.
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)"... failed (this is not fatal)
Running "embed /boot/grub/e2fs_ stage1_5 (hd0,10)"... failed (this is not fatal)
Running "install /boot/grub/stage1 d (hd0) /boot/grub/stage2 p /boot/grub/menu. lst "... succeeded
Finally type the “quit” to exit from the “grub>” prompt. Then reboot the machine. So you will see the grub menu at startup.