Solutions to the Windows, Fedora Core 2
Dual Boot Problem

Bill Moss
Updated June 7, 2004

Introduction

The purpose of this note is to serve as a warning to users planning to dual boot Windows XP and Fedora Core 2 (FC2) and provide a solution for users who have reported that Windows cannot be booted after the installation of FC2. This is not a how-to article on dual booting but rather a note about a couple of additional steps that can be added to a traditional dual boot installation that will avoid the disk geometry problem that is now being widely reported. We also discuss several fixes that may help restore a system that will not boot. Note that an article on dual booting the Clemson Laptop Program IBM T42 is posted.

The Disk Geometry Problem

Consider a dual boot installation on a single IDE drive: /dev/hda. The 2.6 kernel in FC2 reads disk geometry directly from the disk. This so-called untranslated geometry has a head count of 16. The 2.4 kernel reads disk geometry from the BIOS and this so-called translated geometry is characterized by a head count of 240 or 255. To have a successful, FC2 dual boot installation, it is necessary manually pass along the BIOS's translated disk geometry to the 2.6 kernel. See the dual boot article for more details. Here is summary of the steps.

  1. Assume that Windows XP has been installed and unallocated space has been made available on the hard disk for FC2.
  2. Insert FC2 disc 1 and boot in rescue mode
      boot: linux rescue
      chroot /mnt/sysimage
      fdisk -l /dev/hda
      Disk /dev/hda: 40.0 GB, 40007761920 bytes
      240 heads, 63 sectors/track, 5168 cylinders
      Units = cylinders of 15120 * 512 = 7741440 bytes
    Record the hard disk geometry reported as three integers: CYLINDERS, HEADS, SECTORS. Don't mix this up!
  3. Reset and boot the FC2 disc 1 again and now type
      boot: linux hda=CYLINDERS,HEADS,SECTORS
  4. When you reach the point in the installation where the grub boot loader is set up, type the kernel parameter
      hda=CYLINDERS,HEADS,SECTORS

If you have windows installed on one disk and plan to put FC2 on a second disk, I would suggest that you repeat the above procedure to find the geometry of both disks and then boot the installer with a kernel parameter for each disk as in

  boot: linux hda=CYLINDERSa,HEADSa,SECTORSa 
      hdb=CYLINDERSb,HEADSb,SECTORSb

Otherwise, user reports suggest that the FC2 installer may change both partition tables.

Fixes

If Windows will not boot after installation of FC2, do not reinstall Windows. You have not lost any data. Here are several fixes that may help you recover.

BIOS LBA Setting. If your BIOS contains a disk geometry option, change it from Auto to LBA. This options is not available on the laptop BIOS's I have seen.

Fix the Partition Table. Modify your partition table using the sfdisk command. The FC2 installer changed the number of heads recorded in your partition table if you failed to use the hda kernel parameter as discussed above. Assuming that your head count was 255 before the installation, you can fix your partition table by booting FC2 disc 1 to rescue mode.

  boot: linux rescue
  chroot /mnt/sysimage
  sfdisk -d /dev/hda > MyPartitionTable.txt

Remove the initial error messages from MyPartitionTable.txt, then do

  cat MyPartitionTable.txt | sfdisk --no-reread
      -H255 /dev/hda

Please see the article at

http://www.redhat.com/archives/fedora-devel-list/2004-May/msg00908.html
for an explanation of why this works.

Fix the MBR. The default installation of FC2 puts the grub boot loader in the master boot record (MBR) at the beginning of the hard disk. My preference is to install grub in a separate Linux boot partition /boot. The MBR contains an early stage boot loader and the partition table. If your Windows partition is active and your machine will not boot, chances are the boot loader part of the MBR is toast. Get a Windows 2000 or XP installation CD and boot to the recovery console. At the prompt, type fixmbr. This will overwrite the boot loader part of the MBR without touching the partition table. Now you should be able to boot Windows. You can try reinstalling FC2 again or you can install grub in your Linux boot partition.

Install Grub. Some users have reported booting and getting a grub prompt. This means that the grub installation did not install the stage1_5 boot loader but it does not mean that you have lost any data or that your Linux installation is toast. I have seen this happen but I cannot explain why. In fact you can boot your system from the grub prompt by issuing the commands in /etc/grub.conf followed by the boot command.

If you have fixed your MBR and would now like to install grub in your Linux boot partition, here is an outline of the steps. Let's assume that your C partition is /dev/hda1 and that your boot partition, /boot, is /dev/hda3. Now grub refers to the hard disk /dev/hda as (hd0)and it refers to the partition /dev/hda3 as (hd0,2) because it counts partitions starting at zero. Boot FC2 disc 1 to rescue mode using the correct disk geometry. Start grub and then issue these grub commands.

  boot: linux hda=CYLINDERS,HEADS,SECTORS rescue
  chroot /mnt/sysimage
  grub
  grub> geometry (hd0)
  grub> root (hd0,2)
  grub> setup (hd0,2)
  grub> install (hd0,2)/grub/stage1 d (hd0,2) (hd0,2)/grub/
  e2fs_stage1_5 p (hd0,2)/grub/stage2
  grub> quit
  parted
  parted: set 1 boot off
  parted: set 2 boot on
  parted: quit

Note that the install grub command is one long line but is written as two lines here. The grub install command is only necessary if the output from the setup command says that the stage1_5 loader failed to embed. I have seen this happen but I don't know why. The parted commands make /dev/hda3 the active partition. When you reboot, you should see the grub splash screen and be given a choice of OS's if you have previously executed a typical dual boot installation.