# Dual boot with existing Windows XP and FreeBSD11.3



## fixit9660 (Jul 29, 2020)

Could someone please save my sanity. I've got a laptop running Windows XP SP3. I wanted to create a dual-boot with FreeBSD 11.3. After a LOT of research I can't find anything matching something so old to something so new. I've read lots about MBR and GPT and established that this is MBR via "gpart show" by booting off the DVD. I reduced the XP partition to about half using AOMEI Partition Assistant which worked perfectly as far as I could tell. I booted off the FreeBSD 11.3 iso DVD and went through the install process, using the free part of the partition, expecting to reach a point where it offered to install a Boot menu option, which it didn't.
I expect you all know where this is going, but now the laptop boots straight into FreeBSD. This is great but I would still like to be able to use the Windows XP. As there is no Boot menu/option I was expecting to install GRUB, but further research shows it turned into GRUB2 which is now discontinued. I researched some more and PLOP came up.

I think that I can achieve what I want using boot0, but right about now my brain is fried and I could really do with a little advice please. Can I install a dual/multi-boot loader menu from here and if so how please?


----------



## Emrion (Jul 29, 2020)

I did something like that. But I can't remember all the details. I used the multiboot function of Windows but it was Windows 7... Is Windows XP has the same, I don't know.

I copied boot0 boot1 on an USB key (FAT formatted). You need to activate the partition where Windows is. You can do that with `gpart set...` under FreeBSD.

Then, boot on the Windows DVD and select "Repair". You need to change the MBR program with the one of Windows. It's `fixmbr` I think for XP.

After that, you reboot on Windows and you copy the boot0 file at the root of the windows partition. There, you search how to multiboot on Windows XP with a foreign MBR program.


----------



## fixit9660 (Jul 29, 2020)

Hi Emrion. Thanks for the response. I'm not sure about the Windows similarities or multiboot. I'd like to use the FreeBSD one? I appreciate I might have to boot into Windows to repair the MBR at some point though. After a break, and reading the boot0 and boot-cfg manual over and over it seems like I should just be able to enter the command:
"boot0cfg –B ada0", but I get an error:
"boot0cfg: Unable to get providername for ada0"

Any further ideas please?


----------



## Emrion (Jul 29, 2020)

I think I confused the file I copied in Windows, it was maybe /boot/mbr.
As I read the code of boot0, it has multiboot capability. I never used this, but it could be fun.

From what I read in the man page of `boot0cfg` the command you wrote is ok. It's ada0 the problem. What's the output of `gpart show`?


----------



## fixit9660 (Jul 29, 2020)

I humbly apologise Emrion! If I'd have been concentrating and actually been "su root" I wouldn't have been wasting your time..... so sorry.
In my defence, as I said earlier, "...my brain is fried ...", and the moral is, don't do system admin when you are tired.
I came back from a short break and noticed I wasn't root, so I su'd, repeated the command and bingo, it all works as expected.
Why, if the install procedure can see there's another OS installed, doesn't it offer to perform a multi-boot install?
Ah well, thank you again Emrion


----------



## SirDice (Jul 30, 2020)

The "Howto" section is not for asking how to do things. Thread moved.


----------



## Emrion (Jul 30, 2020)

After inspection of my old system, the file I copied on Windows to multiboot with FreeBSD was /boot/boot1.

Tried `boot0cfg –B ada0` and it works. It detects my Windows installation (two in fact, because there are two partitions in a standard installation of Windows 7). Only the first one actually starts Windows (you get an error if you try the second). That said, this works, either to boot Windows or FreeBSD.

I wrote back my previously saved mbr with `dd` to return to my initial setting.


----------



## SirDice (Jul 30, 2020)

Note that boot0cfg(8) only works for MBR and UFS. It does not work on GPT and it cannot boot ZFS.


----------



## SirDice (Jul 30, 2020)

fixit9660 said:


> I wanted to create a dual-boot with FreeBSD 11.3.


Why 11.3? It will be EoL in a few months. Try 11.4 or, probably better, 12.1.


----------



## mickey (Jul 30, 2020)

fixit9660 said:


> Could someone please save my sanity. I've got a laptop running Windows XP SP3. I wanted to create a dual-boot with FreeBSD 11.3. After a LOT of research I can't find anything matching something so old to something so new.


If I remember it right, Windows XP still used the older boot mechanism (pre the BCD stuff that came with Windows 7 onwards) so it should still work the way I've done it for years in Win2k. First thing you'll need is a copy of the BSD boot1 loader /boot/boot1 on a medium that you can later use to copy the file to your windows C: partition (USB stick, diskette, whatever floats your boat). Next you should be able to get Windows booting again by changing the active partition to the Windows C: partition, using a tool like gpart(8). In Windows copy the boot1 file from the medium you prepared to your Windows C:\ directory, rename it to boot1.bsd. In your C:\ directory you should find a boot.ini file (you will probably have to enable the display of hidden files and folders / protected system files in Windows Explorer, or you wont see it). It's a plain text file, so you can edit it in Notepad(++) or whatever, but before that you need change the file attributes using `ATTRIB`, or Windows wont let you write your modifications to the file. You can display the current file attributes in an administrator command prompt by using `ATTRIB C:\boot.ini`. Using `ATTRIB -S -H -R C:\boot.ini` should do the trick. Now open the file in a text editor and append a new line at the end of the file, within the _operating systems_ section, that reads:

```
C:\BOOT1.BSD="FreeBSD 11.3"
```
Save the modified file, close the text editor and reapply the original file attributes i.e. `ATTRIB +S +H +R C:\boot.ini`. On the next reboot you should be presented with a boot menu .


----------



## fixit9660 (Jul 31, 2020)

Solved! Thank you all.


----------

