If you install a dual boot of Windows or Mac OSX on your Ubuntu machine, you may find that your Grub bootloader are wiped out and you can’t boot into any of your OS. If this is the case, the only way is to restore Grub back in your Ubuntu system.
Restoration of Grub is very easy. All you need is the Ubuntu Live CD (you should already have it if you install Ubuntu).
Boot up your live CD
In the desktop, open terminal (Applications -> Accessories -> Terminal).
This will set it to grub mode
This will locate your boot partition. If you already know the location, you can ignore this step.
Replace the (hd0,0) by your boot partition number. If your Ubuntu is installed in the second partition, then change it to (hd0,1)
Reboot your system. You should be able to access the Grub bootloader now.