UPDATE 4/27/2011: Since writing this HOWTO several years ago, I've learned how easy it is to backup and restore an entire Fedora system in various ways. It now seems to me that the simplest way to deal with this issue (until XP goes away) is to backup the Fedora system, delete its partitions, re-install XP, and restore the Fedora system from the backup. I am not motivated to test the idea, but I feel certain it would work. Anyway, the original ideas (for the record)...
In a system that dual boots XP and Linux, the XP CD sometimes will not boot when the reinstallation of XP is attempted. XP Setup may halt immediately after displaying "Setup is inspecting your computer's hardware configuration...". This doesn't always happen when Linux partitions are present in the system. But when it does happen, Linux partitions always seem to be present. And removing the Linux partitions universally "cures" the problem. The usual remedies for this well-known but poorly-understood situation include completely wiping all data from the hard drive, destroying the master boot record, or deleting the Linux partitions. Those procedures do work to allow the XP CD to boot again, but what can be done about this problem when destroying a Fedora system is undesirable?
I conducted many tests of various ideas. Below are at least a few of the ideas that worked for me in the limited scenarios in which I was able to make my XP CD balk. I am omitting from here what did not work and what I could not test. The tests that I conducted were always done with Fedora 7 installed with its boot partition as /dev/sda1 on the first drive in the BIOS boot order. XP was either in a partition also on sda or on a separate drive. That is the only way that I can make my XP CD balk. This can happen in the real world when people use a partition manager to create space for Fedora "in front of" an existing XP partition. From reading many posts on this subject, I know that there are other partition layouts in which this problem can happen. But I cannot test every partition scenario that can make an XP CD balk. Therefore these solutions may not work for you.
IMPORTANT: Some of the methods described below require somewhat advanced tweaking abilities and an understanding of both GRUB and NTLoader. The level of detail in the instructions will not suit a complete newbie. Proceed with caution and at your own risk. No promises. No guarantees. I cannot be expected to assist in repairing a system busted by anything here.
WARNING: Some of the procedures described below involve utilities and commands that have the potential to ruin your operating systems and hard drive data. Do not use them unless you thoroughly understand what you are doing or can accept the risk of completely destroying your systems and data.
The Things I Tested for the Balking XP CD
Code:
The XP CD Setup program halts after
inspecting the hardware configuration
and a Linux system is present.
|
|
|
Is the Linux system
to be preserved?
/ \
No Yes
/ \
Delete all of the Are XP and Linux
Linux partitions. on the same drive?
Reinstall XP. See / \
Note 1. Yes No
/ \
Can another drive Make the XP drive first
without Linux partitions in the BIOS boot order.
be made first in Reinstall XP. Restore
the BIOS boot order? the BIOS boot order.
/ \
Yes No
/ \
Make any drive without Is /dev/sda1 the
Linux partitions first Linux boot partition?
in the BIOS boot order. / \
Reinstall XP. Restore No Yes
the BIOS boot order. / \
See Note 2. ??? Delete the boot partition.
Not tested. Reinstall XP. Restore the
boot partition. See Note 3.
Note 1: Delete all of the Linux partitions. If nothing on the drive needs to be preserved, you may clear the drive by any means including DBAN and destroying the master boot record with zeroes using dd. If only the Linux partitions are to be removed leaving other partitions, use a partition manager such as the GParted LiveCD or fdisk in linux rescue. If LVM physical volumes need to be removed, use fdisk in linux rescue.
Note 2: Make any drive without Linux partitions first in the BIOS boot order. The drive that you make first in the BIOS boot order can be any other drive in the system or even a temporarily installed drive. XP Setup requires that the drive that is first in the BIOS boot order have a compatible active primary partition (NTFS or FAT) for the XP boot loader files. It cannot use a logical partition for this. If a compatible active primary partition is not present when Setup starts, it will stop and require you to make one using its "disk druid". It can be as small as 8MB. If there is no room for a new partition, XP Setup can delete an existing partition to make room, but it cannot resize partitions. When a compatible active primary partition is either found or created on the drive that is now first in the BIOS boot order, XP Setup will copy ntldr, ntdetect.com and boot.ini to the root directory of it. XP Setup will also write new boot code in the master boot record. After reinstalling XP but before you remove the temporary drive or restore the drive boot order, you must copy ntldr, ntdetect.com, and boot.ini to the XP partition. You must also edit the boot.ini file and change the drive number (rdisk value) so that XP will boot when the temporary drive is removed or the drive boot order is restored. All of that file copying and editing work can be done in the newly installed XP system. Then the normal drive order can be restored and the computer rebooted. If you botched any of that file copying and editing work causing XP not to boot, you can access those files from Fedora to fix things.
Note 3: Delete the Fedora boot partition (do not confuse with /boot directory). That allowed the XP CD to boot normally in my tests when the boot partition was /dev/sda1. After XP is reinstalled, the Fedora boot partition can be restored. Moving the boot partition to another drive with a partition manager also worked, but just moving it elsewhere on the same drive did not. I finally found that deleting the Fedora boot partition followed by restoring it after XP was reinstalled was easier than moving the boot partition with a partition manager. The method that I tested is described below. The ext3 Fedora boot partition was /dev/sda1, the NTFS XP partition was /dev/sda2, and the ext3 Fedora root partition was /dev/sda3. I cannot know how this method will work in other scenarios and situations that I did not test. I leave it to you to know whether or not this method is appropriate for you to try. Your partition scenario may require some adjustments to what I did.
- Delete the Fedora boot partition using fdisk in linux rescue. IMPORTANT: Write down the Start and End cylinders of the partition as reported by fdisk before deleting the partition.
Note 3.1: I made an Acronis backup image of the boot partition but didn't need it. I recommend making a backup of your boot partition with imaging software or with dd before deleting it.
- Reinstall XP in its same partition.
- When XP boots, edit boot.ini to change the partition number so XP will boot when the Fedora boot partition is restored to its original place "in front of" the XP partition. If you botch this causing XP not to boot later when the boot partition is restored, you can access boot.ini from Fedora to fix it.
- Reboot into linux rescue.
- Restore the Fedora boot partition using fdisk "add a new partition" and using the same first and last cylinders.
Note 3.2: If the partitions are now renumbered, you will have to use whichever primary partition number is now available (see how to deal with this in the next step). But you must use the same first and last cylinders for the boot partition files to be restored.
- Still in fdisk, I used the extra functionality menu of fdisk and "fix partition order" to return my partitions to "disk order". After fixing the partition order, the boot partition was sda1 again. The other partitions were back to their original numbers. WARNING: If you started out with your fdisk partition table entries "not in disk order", using fdisk "fix partition order" now to correct the boot partition after installing XP could "misnumber" the other partitions causing some additional tweaking to be needed.
Note 3.3: An alternative to fixing the order of the partitions is to leave them that way and instead edit /boot/grub/grub.conf and /etc/fstab for the shifted partitions. I tested this and it works. But I had to edit boot.ini again to change the partition for XP to boot.
- Save the fdisk partition table changes with "write table to disk and exit".
- Exit linux rescue but reboot right back into linux rescue for the system to use the new partition table.
Note 3.4: After a reboot back into linux rescue, the files and folders were back in the boot partition since it was restored using the original first and last cylinders. As long as the new partition is created using the same cylinders which were not damaged or changed in the meantime, the boot partition files sort of "auto-restore". I could see them with ls /boot. I confirmed their partition location with the GRUB shell command find /grub/stage1. I did not have to use my Acronis backup image of the partition, but it is still a good idea to make a backup.
- Reinstall GRUB in the master boot record if it was there before reinstalling XP.
- Exit linux rescue and reboot the computer.