How to Install a FreeBSD domU on a Linux Host
The FreeBSD wiki describes the current state of the FreeBSD xen port(s).
FreeBSD will run in 3 configurations:
- 32-bit PV (kernel "XEN"; requires "PAE" option)
- 64-bit HVM with PV drivers (kernel "XENHVM")
- 32- or 64-bit HVM without PV drivers (kernel "GENERIC")
For instructions on building user-space xenstore tools, see HOWTO-xen-tools.txt.
For instructions on building and installing a "XENHVM" kernel on XCP, see this blog post.
FreeBSD 7.2 domU on a linux dom0
It is fairly straightforward to create a FreeBSD DOMU virtual machine inside a linux DOM0.
Here's a sample configuration file. This is set to boot an ISO image file of freebsd7.2, which the author happened to need in order to create a development environment for pfSense firewall.
import os, re arch = os.uname()[4] if re.search('64', arch): arch_libdir = 'lib64' else: arch_libdir = 'lib' kernel = "/usr/lib/xen-4.0/boot/hvmloader" builder = 'hvm' memory = 768 vcpus = 1 name = "xenfreebsd" vif = [ 'type=ioemu, bridge=eth0' ] acpi = 1 apic = 1 disk = [ 'phy:/dev/xen/xen4-freebsd72-00,hda,w', 'file:/home/download/freebsd-7.2-RELEASE-i386-dvd1.iso,hdc:cdrom,r' ] device_model = '/usr/' + arch_libdir + '/xen-4.0/bin/qemu-dm' usbdevice='tablet' # boot on floppy (a), hard disk (c) or CD-ROM (d) boot='d' # use vnc for console not sdl, don't start vnc console vnc=1 sdl=0 vncconsole=0 on_poweroff = 'destroy' on_reboot = 'restart' on_crash = 'restart'
The main change required will be to fix the paths to the CD or DVD iso.
Once started with xm create, use "vncviewer localhost:0" to attach to the installer and complete the process.
It may be necessary to use ssh forwarding if the xen server isn't your local machine; e.g. "ssh -L5900:127.0.0.1:myxenhost.example.com" and then "vncviewer localhost:0".
The information below is quite out of date and has been kept for reference purposes only. Most of the links are also broken!
FreeBSD as DomU/Guest HOWTO
FreeBSD DomU on Debian GNU/Linux Dom0 with Xen 3.0.3
I wanted to migrate an existing FreeBSD system to Xen. The first part included creating dd of the hard drive image. Than i've downloaded a xen domU kernel and the appropriate config from http://www.yuanjue.net/xen/howto.html.
The FreeBSD kernel refused to boot with the following error:
Error: (22, 'Invalid argument') ERROR: Initial guest OS requires too much space (0xc08MB is greater than 256MB limit)
The problem was, that Xen 3.0.3 requires a `VIRTUAL_BASE=0xC0000000` option in the `__xen_guest` section of the kernel binary. You can view the section of your kernel binary using
objdump -j __xen_guest -s freebsd-XENU
and replace it using
objcopy -R __xen_guest freebsd-XENU objcopy --add-section __xen_guest=file_with_new_contents freebsd-XENU
(thanks to this post). The contents of the section is basically a string, but it has to be zero terminated.
The second problem i faced was that from the FreeBSD domU TCP connections worked to the outside world, but I was unable to establish a TCP connection to other (Linux) domUs on the same machine. The setup uses bridged networking. The solution that worked originates from and is explained in this post:
FreeBSD domU> ifconfig xn0 -txcsum All Linux domUs> ethtool -K eth0 tx off
Later i faced another problem. Multithreaded programs crashed in `pthread_self`. Beeing a FreeBSD newbie i learned that FreeBSD provides multiple threading libraries and that you can choose which one apps should use editing `/etc/libmap.conf`. The user space threads library `libc_r` worked for me and is good enough for a developement system, but its performence is probably suboptimal.
Notes
Ariel E. Antigua writes:
I was reading in the xen-users list and read a few emails from people that cant boot FreeBSD as a domU using the Kip Macy instructions at http://www.fsmware.com/xenofreebsd/5.3/ i have the pleasure to inform that his work is still usefull, the only thing that stop me booting that FreeBSD domU image was i forget to add de ufs: root mount device but using this config http://lists.xensource.com/archives/html/xen-users/2005-09/msg00594.html i finally have the domU boot and runing.
PS: My dom0 is Debian Sarge with Xen 2.0.6 , i get this dom0 running thanks to this guide http://www.option-c.com/xwiki/Xen_Debian_Quick_Start
I hope this can help someone else having troble with FreeBSD as domU.....
Thanks Kip Macy for the FreeBSD/domU howto.. :)