View Full Version : Installing Windows after Fedora: Fixing the GRUB boot menu

2nd December 2008, 07:31 PM
Because you always ask.
How do I install XP when I've already installed Fedora?

There really isn't any need for me to write this up and post it in the forum. There are already so many posts and threads about dual booting that we really don't need any more, but since I was doing this today I thought that I'd make notes and post the result here. Hopefully one or two people will benefit from it.

This applies to a disk that is already partitioned and people using just about any release of Fedora and many other distros. I have an 80GB disk that was already partitioned with 4 - 20GB EXT3 partitions. Fedora was installed on the first partition, or /dev/sda1. I wanted to install Windows XP on this disk and then be able to dual boot without losing my current Fedora installation. I decided that I would install XP on the 4th partition, or /dev/sda4. The first thing I did was to boot the computer with my GParted Live disk. I told the partitioner to delete the 4th partition. Then I told it to create a new partition in the free space and format it as NTFS. Once those 2 operations were complete I rebooted the computer and began the XP install. When the installer asked me what partition to install to I naturally chose the 1 NTFS partition that I had just created and let it format the partition again as NTFS. You've all installed XP before so you know the routine. The formatting completed and the install continued. When it was done the system rebooted and went immediately into XP. No options for any other OS here. Windows is the boss, right? Wrong. Now it's time to take back control of the boot process. Insert your Fedora installation DVD and reboot the computer. Choose Rescue Installed System. I'm using the Fedora 10 install DVD and it appears that the options to select keyboard and language have been removed. You can handle those questions yourself if you see them. You may also see the option to start the network. I've never had the need so I choose No here. The first screen I see after selecting rescue mode is one entitled simple "rescue". It tells me that:

The rescue environment will now attempt to find your Linux installation and mount it under /mnt/sysimage. You can then make any changes required to your system. If you want to proceed with this step choose "Continue". You can also choose to mount your file systems read-only instead of read-write by choosing "Read-Only". If for some reason this process fails you can choose "Skip" and this step will be skipped and you will go directly to a command shell.

Choose "Continue" here. Now you see a screen entitled "System to Rescue" and it asks you "
What partition holds the root partition of your installation? In my case my choices are /dev/sda1 and /dev/sdb2 (a second hard disk with a Linux partition or two). Of course I want to choose /dev/sda1 here so I press OK. Another window entitled "Rescue" is shown telling you "
Your system has been mounted under /mnt/sysimage. Press <return> to get a shell. If you would like to make your system the root environment, run the command chroot /mnt/sysimage. The system will reboot automatically when you exit from the shell. Choose OK here. You are dropped to the shell and you see a black screen with a command prompt,
sh-3.2#. Type chroot /mnt/sysimage and press enter. If there are no errors you will still be at the command prompt. Type grub-install /dev/sda and press enter. You should see

Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script "grub-install".

# this device map was generated by anaconda
(hd0) /dev/sda
(hd1) /dev/sdb

Type exit and press enter. Type exit again and press enter and the system will reboot. You should see a boot menu offering Fedora and Other. Other will be Windows XP.

Please feel free to reply here if you see any errors and I'll make the appropriate change(s). Good luck.