Need help fixing MBR - FreeBSD works, but boot menu doesn't

Hi,

I've just made my first ever install of FreeBSD 9.0, and although the install has been successful and FreeBSD boots properly, something appears to be wrong with the MBR, as I get no boot menu and therefore can't get into Windows XP anymore. I'm having trouble fixing the issue.

System specs:
Dell Dimension 4600, Pentium 4 3.0 GHz, 1Gb RAM, Two 75Gb Seagate parallel ATA harddisks, NVidia GeForce FX 5200 graphics card (Dell version). As far as I know, everything that is to be found was found by the installer. The system currently has no network connection.

This system was my father's old PC, and I reformatted both harddisks earlier today, then made a fresh install of Windows XP Home on the primary master harddisk. I used GPartedLive to shrink the partition I installed Windows XP on to 30Gb, freeing 45Gb for installing FreeBSD. After shrinking the partition, Windows XP needed to check and repair its partition, which as far as I know worked fine.
I then installed FreeBSD 9.0 from CD-ROM in the 45Gb I had freed. This went fine. However, upon reboot I get no boot menu and the system boots straight into FreeBSD. The XP partition is still there, so I guess something went wrong when updating the Master Boot Record.

When I try the procedure detailed here from root, I get an error message "fdisk: failed to write MBR. Try to use gpart(8).". Furthermore, the partition XP is installed in is not reported as "active". I've had a look at gpart and it looks quite complex:(

Any ideas?
 
Small addendum: I used the guided partitioning option when setting up the FreeBSD partition and unfortunately didn't pay enough attention to whether the installer created a GPT partition scheme or not. How can I check that after installation?
 
Okay, got a bit further on my own:

Drive uses MBR, as required. Everything that is reported by fdisk and gpart show looks fine.

Next step:
1) Booted into the XP recovery console using the Windows XP installation CD. Ran fixmbr from there, which was reported as successful, but didn't actually work (!!!). The system still booted into FreeBSD only.

2) fixmbr reports the same thing as above. bootcfg /list only lists windows. fixboot used with no arguments should write a new partition boot sector to the partition I am logged in to, in this case C:, but when using the command it tries to write a new boot sector to the partition FreeBSD is installed on. Ran fixboot C: instead. System still boots into FreeBSD only. x(

Now one peculiarity of the Dell Dimension 4600 is that there is a custom boot menu that is accessible from the initial boot screen (where you can access the BIOS). Accessing this gives an option to boot from the C: drive (normally the Windows drive - should be the case here too), but that too goes straight into FreeBSD. The menu also gives access to a hidden utilities partition (which I deleted). Could it be that this Dell boot menu somehow interferes with the bootloader?
 
XP is MBR-only. The installer did not change that, but it did install normal bootcode, which does not multi-boot, just boots from the active FreeBSD partition.

Many of us find gpart(8) to actually be simpler than fdisk(8), even though gpart does a lot more. It also works with modern stuff like GEOM, which is why fdisk is failing. One of the examples in the gpart man page shows how to do just what you need to do:
Code:
gpart bootcode -b /boot/boot0 ada0
 
Thank you very much.

I now get a menu with 4 choices:

F1 Win
F2 FreeBSD
F5 Drive 1

F6 PXE

The menu defaults to the last used boot option if no choice is entered. Am I correct in believing I can use boot0cfg to set the default boot partition permanently and to remove the useless "F5 Drive 1" option that is a data-only drive?


I guess I could have made my own life easier by installing FreeBSD to one hard disk and XP to the other, because then I could have used the BIOS bootmenu to select which hard disk to boot from. :P
 
Yes, boot0cfg(8) shows examples of setting which slice to use on the next boot. There are fancier boot managers like grub and gag, but they are larger than FreeBSD's no-frills boot0.

Using separate drives and the BIOS boot menu is a good option.
 
Back
Top