Restoring GRUB after Windows installation
July 18th, 2007
When choosing to dual-boot between GNU/Linux and Windows it is recommended that you first install Windows and then GNU. However, sometimes you may want to install Windows on a system with an existing GNU/Linux installation, or you may simply need to re-install Windows.
Windows have the bad habit of removing any boot loaders and installing their own which is able to boot only Microsoft specific operating systems. Modern GNU/Linux distributions (like Ubuntu) use GRUB as the default boot loader. In order to restore GRUB on your dual-boot system you have to run the grub shell.
If possible try to boot into your Linux system from a CD or floppy disk. If you're unable to do so you can boot a GNU/Linux Live CD (like the Ubuntu installation CD/DVD) and run the grub shell from there. Open a terminal or a console and type the following:
Make sure to replace (hd0,0) and (hd0) with the values that correspond to your disk's configuration. Here, hd0 represents the first hard disk (which is the primary master, in most configurations). After rebooting, GRUB should be in position and take it from there.
Chances are that you may want to also edit the file /boot/grub/menu.lst to add a menu option for booting to your Windows installation. Edit the file and add somewhere the following lines:
Again, make sure that you replace (hd0,1) to point to your Windows' partition.
Windows have the bad habit of removing any boot loaders and installing their own which is able to boot only Microsoft specific operating systems. Modern GNU/Linux distributions (like Ubuntu) use GRUB as the default boot loader. In order to restore GRUB on your dual-boot system you have to run the grub shell.
If possible try to boot into your Linux system from a CD or floppy disk. If you're unable to do so you can boot a GNU/Linux Live CD (like the Ubuntu installation CD/DVD) and run the grub shell from there. Open a terminal or a console and type the following:
# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
# rebootMake sure to replace (hd0,0) and (hd0) with the values that correspond to your disk's configuration. Here, hd0 represents the first hard disk (which is the primary master, in most configurations). After rebooting, GRUB should be in position and take it from there.
Chances are that you may want to also edit the file /boot/grub/menu.lst to add a menu option for booting to your Windows installation. Edit the file and add somewhere the following lines:
title Windows
root (hd0,1)
chainloader +1Again, make sure that you replace (hd0,1) to point to your Windows' partition.