After reinstalling windows, or a messed up Master Boot Record, you might be in a loss, that how can i access my ubuntu?
This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.
the solution is just here. You need a Ubuntu Live CD
All commands should be entered without the quotes “”
01. Boot from the Live CD and goto terminal
02. Then you will get the “grub>” prompt which is the grub shell.
At grub> prompt, type
03. You will see some output. It should be like (hd0,1) or (hd0,5).
The coimmand sysntax is “root (hdX,Y)”
Suppose you got (hd0,1) at the output or step 02.
04. Enter the command to install grub to the MBR.
05. Exit the grub shell with the quit command.