2

I have my Linux/Debian/Sid amd64 (with i7 3770K, 16Gb RAM, 1 SSD + 2 hard disks) PC with xen (notably I have installed a package xen-linux-system-amd64), so

 sudo xen list
 Name                                        ID   Mem VCPUs State   Time(s)
 Domain-0                                     0 16016     8     r-----    2634.8

I am understanding that the Dom0 is my Linux 4.0 kernel & system; I have xen-hypervisor-4.5-amd...

I have a disk with two partitions for FreeBSD

sudo fdisk -l /dev/sdd
Disk /dev/sdd: 465.8 GiB, 500106780160 bytes, 976771055 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x624aeae3

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sdd1            2048 754976767 754974720  360G 83 Linux
/dev/sdd2       754976768 773851135  18874368    9G 82 Linux swap / Solaris
/dev/sdd3       773851136 792725503  18874368    9G b8 BSDI swap
/dev/sdd4       792725504 976771054 184045551 87.8G b7 BSDI fs

(BTW, this is not my system disk; /dev/sdd1 is for my /xtra Linux ext4 file system, and dev/sdd2 is my second swap partition)

I would like to run FreeBSD, probably only on the command line since I don't need to run X11 server under FreeBSD, (preferably FreeBSD 10.1 for x86-64 architecture) under xen using /dev/sdd4 for its root (and only) filesystem and /dev/sdd3 for its swap area. But I am not sure of how to proceed next.

Should I download FreeBSD-10.1-RELEASE-amd64-bootonly.iso or what? What are the next steps to run it under xen? The http://wiki.xen.org/wiki/How_to_Install_a_FreeBSD_domU_on_a_Linux_Host page is not helpful enough (& https://www.freebsd.org/doc/handbook/virtualization-guest.html don't mention xen)

FWIW, I am an old Unixer (my first Unix was SunOS3.2 on Sun3/160 in the mid 1980s) and my main motivation for trying FreeBSD is to check that my MELT software (a GPLv3 plugin for recent GCC to easily extend and customize GCC in a Lisp-like language) can be used on FreeBSD.

1

Since I couldn't find an accurate guide for setting up FreeBSD 10 as a domU under Xen either, I wrote my own. I believe you're using a newer OS release and Xen version than me, but the process should be similar. Here's the gist:

  1. Download a FreeBSD 10 ISO (I used FreeBSD-10.1-RELEASE-amd64-disc1.iso) and put console="comconsole" in its /boot/loader.conf to let you install over a serial console. If you know how to use VNC instead, that should be fine too -- in that case, ignore what I say about using serial. The FreeBSD handbook has detailed instructions on extracting and recreating the ISO.

  2. Allocate disk partitions and MAC addresses, and create your domU configuration. Here's mine:

    memory = 1024
    name = "eagle"
    
    # PVHVM stuff
    builder = "hvm"
    kernel = "hvmloader"
    boot = "dc"
    
    vif = [ 'mac=00:16:3E:01:AB:23' ]
    disk = [ 'phy:/dev/solid-state/eagle-disk,hda,w',
             'file:/virt/iso/FreeBSD-10.1-RELEASE-amd64-headless.iso,hdb:cdrom,r'
           ]
    
    # Necessary for getting the serial console in `xm console`
    serial = "pty"
    
  3. Start the domU and install as normal. At the mountroot prompt after the bootloader but before the installer, use ? to enumerate your options -- you probably want something like cd9660:cd0.

    At the end of the installation process, choose to open a shell in the newly-installed system and put console="comconsole" in its /boot/loader.conf as well. Then, shut down the domU.

  4. In your domU configuration file, change boot = "dc" to boot = "c" to boot from the disk you installed to rather than the ISO. You can also remove the ISO's disk entry if you want.

  5. Start the domU -- at this point, you should be all set.

1

As one approach that I'd estimate could work, though I've yet to get up and running with Xen myself: The FreeBSD foundation publishes a pre-installed VMDK edition of the FreeBSD base system [where][amd64][i386]. The Xen project, moreover, provides some documentation about installing a VMDK under Xen, using QEMU tools [Migration from VMware]. Naturally, this assumes that there is an operating system environment where the QEMU tools would be available.

Assuming that it may be a relatively straightforward process, then towards installing ports and packages and configuring the the virtual machine after its first boot, I'd recommend The FreeBSD Handbook as a reference.

Personally, I'm not greatly familiar with the Xen architecture. I'm not sure how an Install from ISO might proceed with the same. The VMDK image can also be used with VirtualBox, for applications on non-Xen-dom0 architectures -- personally, I've found some successes with the same, towards a simple XFCE desktop albeit in a virtual guest image on a proprietary operating system. I've read some advice about how Xen can be installed bare-metal on a Microsoft Windows PC, but with UEFI on my laptop, it's nothing I've ventured about as yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.