5.1-RELEASE & Windows XP dual-boot issues

Andrew Boothman andrew at cream.org
Mon Jun 30 17:34:30 PDT 2003

On Monday 30 June 2003 11:36 pm, Scott Reese wrote:
> On Mon, 2003-06-30 at 22:10, Andrew Boothman wrote:
> > On Monday 30 June 2003 7:19 pm, Scott Reese wrote:
> > > Previously, I had a dual-boot setup with FreeBSD 5.0 and Windows XP.  I
> > > was using booteasy as the boot loader and I had no problem booting into
> > > either Windows or FreeBSD.  However, I found myself having to reinstall
> > > FreeBSD so I decided to go with 5.1-RELEASE.  As usual, I chose to use
> > > the FreeBSD boot loader on ad0 (the Windows drive) and to install a
> > > standard mbr on ad1 (the FreeBSD drive).  After the install, I was able
> > > to boot FreeBSD with no problems at all, but when I went to boot up
> > > Windows, I received the dreaded 'NTLDR missing' message.
> >
> > This seems to be a recurring problem after 5-RELEASE. I had exactly the
> > same problem, and I know of others that are the same. For some reason
> > -current doesn't seem to be inter-operating well with the WinXP/Win2k
> > loader anymore. I'm not sure if it's only happening to some installations
> > - but I was certainly in the same boat.
> >
> > I ended up having to re-install Win2k and I used Grub as my new
> > bootloader.
> This sounds promising.  If you don't mind my asking, what steps did you
> follow exactly?  I've never used grub before and I'd like to avoid
> reversing my current situation (having a bootable Windows installation,
> but suddenly rendering my FreeBSD install unreachable).

Here's a message from George Hartzell that he posted to -current in response 
to me having trouble. For some reason I can't persuade the mailing list 
search mechanism to return anything at the moment so here's the message again 
in it's entirety :

(Unfortunately - by stunning coincidence - I recently hosed by Grub 
installation so I can't use my own system to show others how to get it 
working ;) Hopefully this email will be enough to get you going)

----------  Forwarded Message  ----------

Subject: Re: "NTLDR missing" after 5-RELEASE install
Date: Thursday 27 February 2003 6:52 pm
From: George Hartzell <hartzell at kestrel.alerce.com>
To: "Andrew Boothman" <A.J.Boothman at sms.ed.ac.uk>
Cc: "Darryl Okahata" <darrylo at soco.agilent.com>, <current at FreeBSD.ORG>

Andrew Boothman writes:
 > [...]
 > OK Guys, I think I'm still a little confused here.
 > I've just had a few botched installs of GRUB so I think I need a little
 > more direction, if you could :)
 > I've got GRUB on a floppy and it boots fine. If I type :
 > rootnoverify (hd0,0)
 > makeactive
 > chainloader +1
 > boot
 > I get Win2k booted no problem!
 > So, following the instructions in the Grub Manual, I typed
 > root(fd0)
 > setup(hd0)
 > I remove the floppy from the drive and reboot
 > On boot I get "Loading GRUB... Please Wait..." but after that I get "GRUB
 > Error 17" which according to the manual means that GRUB doesn't know how
 > to load the selected partition. Even though when I boot from the floppy it
 > starts no problem and I can type commands to get it to boot Win2k....

That told it to install GRUB into the beginning of (hd0) [e.g. the
Master Boot record], but configured it to use (fd0) as the root of the
place to find stuff.  Since the floppy wasn't in when you booted, it
didn't do anything useful.

There are some grub things that need to be on the disk that you give
the "root" designation too, e.g. "stage1", etc...

I don't know how/where to install those files into an NTFS partition,
I assume that GRUB can read NTFS filesystems, and you could tuck them
there, but I don't know for sure.

Here's what I'd do.

Get yourself booted into freebsd any way that you can.

FREEBSD DISKLABEL, AND SAVE IT.  "fdisk -s" and "disklabel -r
diskname" are your friends!!!!

Build grub from the ports tree and install it.  It installs all of the
juicy bits into some directory in
/usr/local/share/grub/i386-freebsd/..., which doesn't seem to be a
place where grub can find it.  I make a directory called /boot/grub
and copy all of them there.

Start grub (e.g. boot from your grub floppy).  Under the 5.0 systems,
GEOM is picky about letting you doink with disks that you have
mounted, so you either need the "let me shoot myself in the foot
sysctl patch
(ftp://ftp.jurai.net/users/winter/patches/geom-foot.patch) or boot
from something else (e.g. floppy, live cdrom, ...)

Make sure that grub can see it's various interesting bits:

grub> find /boot/grub/stage1

and it should say:


assuming that you have Something Else (e.g. windows) in the first
primary BIOS partition/slice, a set of FreeBSD slices in the second
primary BIOS partition/slice, and the /boot/grub stuff is in the first
("a") BSD_DISKLABEL/slice.

If you have the grub bits living in a Linux filesystem in the third
primary BIOS partition, it'd say (hd0,2).  If you had them in a Linux
filesystem living in the first extended partition, it'd say (hd0,4),

That's the drive that you want to declare as your root, which just
configures the low level grub code that "setup" installs so that it
knows where to look for it's various useful bits.


grub> root (hd0,1,a)

Then you need to install grub onto somewhere where the computer will
trip over it and boot it.

One possibility is to install it into the master boot record, which
would be:

grub> setup (hd0)

Here you boot process would be

  power on->bios->load the MBR which is really GRUB->grub loads its

Or you could leave a "normal" MBR at the beginning of the disk and
install GRUB into the beginning of the FreeBSD BIOS partition
(assuming that FreeBSD is in the second primary parition):

grub> setup (hd0,1)

If that's all that you do, thing's won't quite boot.  You'll need to
also mark that partition active, so that the stock MBR code will jump
to it.  I always do that by getting to this point, booting by hook or
by crook (e.g. a grub boot floppy, a bootable freebsd CD, a bootable
linux CD) and using some utility (e.g. partition magic from windows,
fdisk from windows, fdisk from freebsd, fdisk or cfdisk from linux) to
mark the partition active.  I prefer partition magic because I believe
that it has the most robust partition table integrity checks, but
whatever you trust....

Now, your boot process will look like:

  power on->bios->"real" MBR which jumps to the active parition -> (next

  ... -> GRUB at the beginning of active partition -> GRUB stage1,...

When grub get's up and running, it'll look for a file called menu.lst
(unless you override the name when you "setup") which contains the
info for the boot menu.  Here's mine (notice that there are a bunch of
mutually exclusive things that I've tucked into the 3rd BIOS partition
at various times and I just keep the info around for reference.  As
long as I don't actually choose any of the "wrong" selections, there's
no trouble.

title FreeBSD 4.7
        root (hd0,1,a)
        kernel /boot/loader
title FreeBSD 5.0
        root (hd0,2,a)
        kernel /boot/loader
title Redhat Linux 8.0
        root (hd0,2)
        kernel /boot/vmlinuz-2.4.18-14 ro root=/dev/hda3
        initrd /boot/initrd-2.4.18-14.img
title Redhat Linux 8.0 (hires)
        root (hd0,2)
        kernel /boot/vmlinuz-2.4.18-14 ro root=/dev/hda3 vga=791
        initrd /boot/initrd-2.4.18-14.img
title Windows 2000
        rootnoverify (hd0,0)
        chainloader +1

 > I then used "fdisk /mbr" on a Windows 98 boot disk to remove GRUB and get
 > me back to a normal Win2k boot. But that doesn't help me get FreeBSD dual
 > booting.....
 > Can you offer any insight into how to make this work? I remember using
 > GRUB before and being very happy with it, but it was installed for me by
 > RedHat....


 run an "fdisk -s" and print out the output
 run and "disklabel -r ad0" (or whatever device) and print out the info.

BEFORE you start playing around!!!!


I left out a detail:

  I use the --prefix=/boot/grub option to setup.


  setup --prefix=/boot/grub (hd0)


  setup --prefix=/boot/grub (hd0,1)


More information about the freebsd-questions mailing list