This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-users] Booting FreeBSD diskless in DomU

To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-users] Booting FreeBSD diskless in DomU
From: Geoff Buckingham <geoffb@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 8 Sep 2005 16:40:20 +0000
Delivery-date: Thu, 08 Sep 2005 16:38:14 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
Using the 2.0.6 demo cd image, I booted the supplied freebsd image and rsync'd
the file system to an NFS server. However I don not seem to be able to 
succesfully boot from it the system just hangs here:

xn0: bpf attached
xn0: Ethernet address: aa:00:00:61:1c:d4
lo0: bpf

I have modified /sbin/start_freebsd.sh and /etc/xen/freebsd.py to generate 
the following  configuration:

xendemo:~# start_freebsd.sh
Starting new guest domain

Using config file "/etc/xen/freebsd.py".
    (name FreeBSD-69)
    (memory 48)
    (cpu 69)
            (kernel /boot/freebsd)
            (root /dev/dns)
    (device (vif (mac aa:00:00:5b:7a:53)))

Is there something I am missing? The bridge seems OK I can access the nfs
exports from the demo cd's default DomUs. 

I include my modified files, as I am currently using a fixed IP I have only
been launching one instance of FreeBSD at a time.

xendemo:~# brctl show
bridge name     bridge id               STP enabled     interfaces
xen-br0         8000.00110a543046       no              eth0
xendemo:~# ifconfig xen-br0
xen-br0   Link encap:Ethernet  HWaddr 00:11:0A:54:30:46  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
          RX packets:291944 errors:0 dropped:0 overruns:0 frame:0
          TX packets:533910 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:16437710 (15.6 MiB)  TX bytes:77603155 (74.0 MiB)

xendemo:~# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=7.95 ms
64 bytes from icmp_seq=2 ttl=64 time=0.416 ms
64 bytes from icmp_seq=3 ttl=64 time=0.342 ms

 new FreeBSD guest domain

# Wait for the user if we're called on a VT
if [ $PPID -eq 1 ] ; then 
  echo "Press Enter to start a new FreeBSD guest OS"

# First it needs an ID

# Now here we go
echo "Starting new guest domain"

xm create -c -f /etc/xen/freebsd.py \
 root=/dev/dns \
 name=FreeBSD-$VMID \
 kernel=/boot/freebsd \
 ip='' \
 netmask='' \
 nfs_server='' \
 nfs_root=/FreeBSD53 \
 blkif=no \
 netif=no \
 memory=48 \

xendemo:~# cat /etc/xen/freebsd.py 
import xen.util.ip

##### Edit this python file to reflect the configuration of your system

##### This example script expects a variable called 'vmid' to be set.

def config_usage ():
    print >>sys.stderr,"""
The config file '%s' requires the following variable to be defined:
 vmid             -- Numeric identifier for the new domain, used to calculate
                     the VM's IP address and root partition. E.g. -Dvmid=1

Additionally the following variable may be defined:
 image            -- Path to kernel image, can be gzip'ed. [/boot/freebsd]
 mem              -- Memory size. [16]
 name             -- Domain name. [FreeBSD VM vmid]
 ip               -- Primary IP address for domain. [this domain's IP + vmid]
 nfsserv          -- NFS server IP address. []
 nfsroot          -- Path to nfs root filesystem. [/netboot/freebsd]
""" % config_file

# Define script variables here.
# xm_vars is defined automatically, use xm_vars.var() to define a variable.

def vmid_check(var, val):
    val = int(val)
    if val <= 0:
        raise ValueError
    return val
            use="Virtual machine id. Integer greater than 0.",

# This checks the script variables.

    kernel = kernel 
    kernel = "/u/kmacy/kernel" 

builder='linux' # this is a FreeBSD domain

# STEP 2. The initial memory allocation (in megabytes) for the new domain.
    memory = int(mem)
    memory = 256

# STEP 3. A handy name for your new domain.
    name = name
    name = "FreeBSD VM %d" % vmid

# STEP 3A. Which CPU to start domain on?
cpu = vmid # set based on vmid (mod number of CPUs) 

# STEP 4. Specify IP address(es), for the new domain.  You need to
# configure IP addrs within the domain just as you do normally.  This
# is just to let Xen know about them so it can route packets
# appropriately.

#vfr_ipaddr = ["111.222.333.444","222.333.444.555"]
# try:
#    vfr_ipaddr = [ip, xenctl.utils.add_offset_to_ip('',vmid),]
# except:
#  vfr_ipaddr = 
#                 xenctl.utils.add_offset_to_ip('',vmid),]
#vfr_ipaddr = [""];
vfr_ipaddr = [""] # xen-vm0

# STEP 5a. Identify any physcial partitions or virtual disks you want the
# domain to have access to, and what you want them accessible as
# e.g. vbd_list = [ ('phy:sda6','sda6', 'w'),
#        ('phy:sda%d' % (3+vmid), 'hda2', 'r'), 
#        ('vd:as73gd784dh','hda1','w'),
#        ('phy:cdrom','hdd','r')

#disk = [ 'phy:loopa,loopa,w' ]

# STEP 5b. Set the VBD expertise level.  Most people should leave this
# on 0, at least to begin with - this script can detect most dangerous
# disk sharing between domains and with this set to zero it will only
# allow read only sharing.

vbd_expert = 0

# STEP 6. Build the command line for the new domain. Edit as req'd.
# You only need the ip= line if you're NFS booting or the root file system
# doesn't set it later e.g. in ifcfg-eth0 or via DHCP
# You can use 'extrabit' to set the runlevel and custom environment
# variables used by custom rc scripts (e.g. VMID=, usr= )

netmask = xen.util.ip.get_current_ipmask()
gateway = xen.util.ip.get_current_ipgw()
    nfsserv = ''
extra = "boot.netif.ip="+vfr_ipaddr[0]
extra += ",boot.netif.netmask="+netmask
extra = ",vfs.root.mountfrom=nfs:"
extra += ",boot_verbose=yes"
extra += ",boot_single=yes"
#extra += ",boot_gdb=yes"
#extra += ",boot_gdb_pause=yes"

#cmdline_ip += ",init_path=/sbin:/sbin/init"
# there is no real MAC address - need hack in device driver
# cmdline_ip += ",boot.netif.hwaddr=00:00:00:00:00:00"
# cmdline_ip += ",boot.nfsroot.server="+nfsserv
# try:
#    cmdline_ip += ",boot.nfsroot.path="+nfspath
# except:
#    cmdline_ip += ",boot.nfsroot.path=/netboot/freebsd"
# something is appending garbage to the end - make sure it is separate
#    cmdline_ip += ","

# STEP 7. Set according to whether you want the script to watch the domain 
# and auto-restart it should it die or exit.

auto_restart = False
#auto_restart = True


Xen-users mailing list

<Prev in Thread] Current Thread [Next in Thread>