Why would you have to Install / reconfigure Grub in the first case?
1) You had to install Windows after you installed Ubuntu/Linux which led to the Grub ( Previously installed by Ubuntu ) to be over written by the Windows Boot loader.
2) You screwed up an installation right at the wrong spot and now you can boot neither Windows nor Linux.
Installing Grub through a Live CD:
- Insert the Ubuntu Live CD into the tray and restart your system
- Once you’re at the Live CD Desktop, Navigate to the terminal ( Applications>Accessories>Terminal)
- Type sudo fdisk -l /* This would list all the OS installations and drives that you have. Make note in which drive Ubuntu has been installed – Let’s say it’s hda3*/
- Next we’ll have to enter the Grub shell. Fot that type sudo grub
- In the grub menu type find /boot/grub/stage1 . This would return a listing of the drives in which the OS’s/ boot records are installed.
- Identify where Ubuntu’s Grub is on, by relating the output from step 3 and the above output.Now to let the Grub shell know what grub files are to be used, type root (hd0, 3) /* You’ll have to change this accordingly as per your output from step 3*/
- Now to install Grub on MBR, type setup (hd0)
- By now, You should have got a success message from the grub shell telling you that the Grub has successfully been installed.
- Type quit and exit the terminal. Reboot and this should have properly fixed your Grub.
Installing Grub using the Super Grub disk:
If in case you do not have a Live CD, you can download a super grub disk and use it to setup the Grub for you. Check this page for more info on using the Super grub disk.
Installing Grub in your MBR will overwrite WIndows bootloader. If in case you do not find Windows in your boot menu after rebooting, all that you have to do is to make an entry in the Grub boot list.
Making an Entry of Windows in the Grub boot list:
- In the terminal , type sudo gedit /boot/grub/menu.lst /* Always have a backup of this file. Screwing this will only cause more trouble */
- Add the following lines wherever you would like the Windows entry to be listed
title WIndows XP Professional Edition
root(hdX,Y) /* Based on the fdisk -l output. Note: /dev/hda1 ==(hd0,0). /dev/hda2==(hd0,1) –> Grub convention */
- Save Menu.lst and reboot. This should resolve the issue