Anyway I tried to google search for a solution, and the following were the steps to resolve the problem that appear in the most of the forum postings or articles I have found:
- sudo grub
- find /boot/grub/stage1
- root (hd0,1)
- setup (hd0)
Anyway my system consists of 2 harddrives, with Windows XP installed in the primary harddrive and Ubuntu in the secondary harddrive. The MBR is in the primary harddrive, while the grub program is in the secondary harddrive.
Following are the steps I have taken that have finally helped me solve the problem, as well as some explanation for each step:
- Boot up using a ubuntu live CD.
- Open a terminal and type:
- In the grub command line utility that appears, type the following:
- The above command is for finding where your grub is located. In my case the value returned is: hd1,0. This means grub is in the 1st partition of my second harddrive. If your grub is in the 2nd partition of the first harddrive, the value returned should be hd0,1.
- The next command is to "tell" MBR where grub is located. So you should use the value found in the step above:
- Make sure there is a space between "root" and the opening bracket.
- Next step is to tell grub which MBR to fix. Typically, this should be the first harddrive, which means hd0 should be used. If you have only one harddrive then it should be hd0.
- After that you should see some statements about the program is running and whether it is successful.
- Once the program has finished running, you can quit the utility:
Now another thing I have to mention is that my Ubuntu was a rather old version (version 8.10). It is still using the so called "legacy grub". I think for Ubuntu version 9.10 and after, grub program used is grub2. The above steps are meant for "legacy grub". If you are using grub2, please refer to my related links for the solution.