FreeBSD 5.3 Xen DomU Install HOWTO

Impressed (and spoiled) by how easy NetBSD was to install as a guest under Xen 2.0.7 using the supplied netbsd-INSTALL_XENU kernel/root, I expected to be able to install FreeBSD in a similar way. I couldn't find anything similar, so I had a shot at building my own FreeBSD kernel/root image. And.. it works!

Before we get started, if you're more interested in root access to your own virtual server than actuallly creating your own virtual environment, you should consider services by prgmr.com. If you're technically adept, then for just $5 per month you can get your own system running the OS of your choice (Linux/NetBSD etc) to configure as you please, with the bonus of remote console and remote power recycling too! It's probably cheaper than running a box in your basement where the eletricity alone would cost $5 a month. Makes sense.

Installing

  1. Launch a guest using this config and this kernel. Edit the config first to specify your install partition, obviously.
  2. Complete a regular FTP install with sysinstall
  3. After the install has finished, grab this config file and specifying your install partition again, boot the guest using this kernel.
  4. Done!

Install Notes:

  1. Consider blanking your install partition with dd if=/dev/zero of=/dev/WHATEVER before you start
  2. The slice configuration screen will crash if you don't manually specify disk geometry for xbd0, before you press anything else. Just enter bogus geometry like 1024/1024/1024, and sysinstall will guess some good values for you
  3. Make sure to install the FreeBSD Boot Manager when asked
  4. Both manual network configuration and DHCP configuration should work
  5. Only active FTP installs were tested. Passive FTP may/may not work
  6. "Looking up host ftp.freebsd.org" takes a while to clear on my system
  7. All the sysinstall help files are removed due to space issues
  8. Don't be tempted to remove the , from the start of the extra section in the guest config. For some reason the kernel wont boot and mount root without it
  9. At post install time, make sure the console is defined in the TTYS configuration, and disable all the virtual terminals ttyv0-8.
  10. Also at post install time, enable SSH logins, add a local user account, and make sure it's in the wheel group before you reboot. You might need a way in to your guest if the console isn't working as expected

Build Notes:

  1. The install kernel was built using source at Kip Macy's website
  2. The kernel config file I used is here This config contains what I believe to be the bare essentials for an install, which was necessary as when the MFS file and kernel together went over around 3800k in size (roughly), the image wouldn't boot in Xen. This also made it necessary to strip some useless parts out of the MFS file, to get that as small as possible
  3. The MFS merged inside the kernel is here if you want to mount it and poke around
  4. The MFS contains only a few files, as crunchgen is used to squeeze everything in to the available space. The crunchgen config file is here
  5. The merge of the kernel and MFS was doing using the old write_mfs_in_kernel which I compiled from this slightly modified source
  6. I had to modify sysinstall slightly to recognize the Xen virtual block device, and virtual ethernet

Misc Notes:

  1. My FreeBSD guest doesn't seem all that stable and crashes under load, but that could be down to either the low (32MB) physical memory allocated to it, or the fact that I'm not using all the latest patches on Kip Macy's site. I'd be interested to hear other peoples experiences, and keen to try any current 5.3 FreeBSD Xen U kernels available
  2. Help me out with my hosting costs! Consider powweb.com who provide reliable and stable web hosting. $7.77 a month gets you 300GB of transfer per month, 5GB of disk, and all the other popular services you can imagine. Buy two hosting packages, and you're basically getting over a T1's worth of bandwidth for under $15 a month. Pretty outstanding. See the Netcraft report for these guys! Sorry for the sneaky advert by the way, but a guy's gotta make ends meet somehow, you know?
  3. The FreeBSD guest does not seem to respond to xm shutdown in any way. apmd complains: "apm: sysctlbyname(machdep.wall_cmos_clock): No such file or directory" ...possibly related to "adjkerntz[242]: sysctl(put_wallclock): No such file or directory " which turns up as the system boots? Haven't spent much time on this yet.
  4. I tried all this using NetBSD as my Domain-0, and using a physical partition as the install disk. If you're going to try it on Linux, or you're going to try it with a file backed storage, drop me a line and let me know how it goes
  5. Feel free to mail me at gmail.com cbrookes@ if you have any questions/comments