Creating a BHyve guest

James B. Byrne byrnejb at harte-lyne.ca
Mon May 30 18:35:09 UTC 2016


I am trying, without much success, to create a FreeBSD guest on a
FreeBSD host, both version 10.3.  These are the steps I have followed
thus far (refs.: the Handbook s. 21.7 and the wiki
https://wiki.freebsd.org/Jenkins/VMSetup ).

To create the BHyve based VM on the FreeBSD host the following steps
were followed.

1. We are using the zfs file system which combines both file-system
and volume management. We first create a pool to hold our VM disk
images. These are where the storage used by the VM will be created.

    zfs create zroot/vm


2. Next we set the mode for the VM storage pool image files to be
considered devices. This provides certain improvements in performance
and security as it relates to VM guests.

    zfs set volmode=dev zroot/vm
    zfs get volmode zroot/vm


3. Now we create a disk image file to hold the VM. We will name it
after the vm that we intend to create (samba_dc01) so that it is
readily identifiable on the host. The existing MS AD-DC can only
support a 120Gbyte disk which is only 50% utilised so a 200Gbyte (-V
200G) should prove sufficient.

    zfs create -V 200G zroot/vm/samba_dc01.img

    find /dev -name samba_dc01\*
    /dev/zvol/zroot/vm/samba_dc01.img


4. At this point a suitable install source must be obtained. These are
usually disk files that contain a CD-ROM or DVD iso9660 formatted data
disk. Because of the format specification sued these are often
referred to simply as isos. In this case the FreeBSD isos are found at
ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.3/.
The version number (10.3) naturally will change over time and so must
be accounted for when specifying the url. The utility wget or curl can
be used to directly download the appropriate iso image file to a
suitable location on the host's file system.
However the install image file is transferred it is important that the
downloaded file be checked against its SHA256 or SHA512 signature as
given on the source site to insure that the download is intact and is
identical to the file on the source. The checksums are contained in a
suitable named file provided from the host. In this case it was
ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.3/CHECKSUM.SHA256-FreeBSD-10.3-RELEASE-amd64

    sha256 -q /root/FreeBSD-10.3-RELEASE-amd64-dvd1.iso
    3f33fc506b18d752564c3ba92419592a489fceef43f73827c42a4e4d31fd4b7d

    grep FreeBSD-10.3-RELEASE-amd64-dvd1.iso
CHECKSUM.SHA256-FreeBSD-10.3-RELEASE-amd64
    SHA256 (FreeBSD-10.3-RELEASE-amd64-dvd1.iso) =
3f33fc506b18d752564c3ba92419592a489fceef43f73827c42a4e4d31fd4b7d


5. Once the iso image for the installer is downloaded, in this case to
the /root directory, and its checksum verified then the process of
creating a new FreeBSD VM instance is carried out using the supplied
shell script.

    sh /usr/share/examples/bhyve/vmrun.sh \
      -c 2 -m 4096M -t tap0 \
      -d /dev/zvol/zroot/vm/samba_dc01.img \
      -i -I /root/FreeBSD-10.3-RELEASE-amd64-dvd1.iso \
      samba_dc01

This all seems to work as documented.  I configure the new vm, confirm
my choices and shut down.  When I attempt to restart the new system
using either of the following then the attempt fails.

bhyve -A -H -P -s 0:0,hostbridge \
>   -s 1:0,lpc \
>   -s 2:0,virtio-net,tap0 \
>   -s 3:0,virtio-blk,/dev/zvol/zroot/vm/samba_dc01.img \
>   -l com1,stdio -c 2 -m 4096M \
>   samba_dc01
virtual machine cannot be booted

or

sh /usr/share/examples/bhyve/vmrun.sh \
>   -c 2 -m 4096M -t tap0 \
>   -d samba_dc01.img \
>   samba_dc01
Launching virtual machine "samba_dc01" ...
Installation CDROM image "./release.iso" is not readable


I cannot see any other steps in the documentation that I have read. 
What am I missing or what am I doing wrong?


-- 
***          e-Mail is NOT a SECURE channel          ***
        Do NOT transmit sensitive data via e-Mail
 Do NOT open attachments nor follow links sent by e-Mail

James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3



More information about the freebsd-questions mailing list