> bhyve Zones

To run zones using the bhyve hypervisor, first ensure that the bhyve overlay is installed

zap install-overlay bhyve

To boot Tribblix (or other illumos distributions) as a bhyve guest, you will need to use a fairly recent version of the distribution. For Tribblix specifically you'll need to use m24.1 or later. The command would be something like:

zap create-zone -t bhyve -z bhyve1 \
  -x 192.168.0.236  \
  -I /var/tmp/tribblix-0m35.iso \
  -V 8G

Here, the -t flag tells us that this is a bhyve zone, the -z flag gives the name of the zone, the -x flag specifies the zone's permitted IP address, the -I flag tells bhyve where to find the ISO image to boot from, and the -V flag says to create an 8G virtual disk for the guest to use.

You can set the number of vcpus for the guest with the -c flag (the default is a single cpu). Likewise, the guest memory can be set with the -m flag (the default is 1G of memory). As an example, add -c 2 -m 2G.

That will create and boot the zone. To interact with it, use VNC. As root, start up socat like so:

  socat TCP-LISTEN:5905,reuseaddr,fork UNIX-CONNECT:/export/zones/bhyve1/root/tmp/vm.vnc

Note the name of the path to the zone, which you'll need to change depending on the name of the zone. Also, you can choose a different port, just remember that it must be unique, and the VNC display number is offset by 5900.

Then, as yourself, you can connect with

vncviewer :5

and you should see, and be able to interact with, the system as it boots.

You can run the installer as normal. But before you can use the installed system you need to remove the virtual CD and reboot.

zap remove-cd -z bhyve1 -r

At the present time, you're unable to run X in Tribblix under bhyve. (Although you could run an X session under VNC.)

Sharing data

In other zone types, you can share directories using the -S and -s flags (for writable and read-only shares respectively).

The same works with bhyve, but the bhyve guest will use virtfs. In a Linux guest you can mount these as follows:

mount -t 9p -o trans=virtio,uname=root bhyvefs0 /mnt/foo

The name bhyvefs# is fixed and, if you have multiple shares, will start from 0 and increment, in the order given by the -S and -s flags.

Cloud-init

Often, you'll want the guest to automatically configure itself. You can use cloud-init for this.

Adding the -C flag to the create-zone invocation will enable cloud-init. On its own, this doesn't do a great deal, but should set up the IP address and dns resolution correctly.

Using the -k flag with the name of an SSH public key file will enable cloud-init and configure the guest to allow SSH access to the default account (or root) using the given SSH key. For example, you might use:

zap create-zone -t bhyve -z bhyve2 \
  -x 192.168.0.237  \
  -I /var/tmp/ubuntu-22.04.1-live-server-amd64.iso \
  -k /export/home/ptribble/.ssh/id_rsa.pub \
  -V 8G

Index | Previous Section | Next Section


tribblix@gmail.com :: GitHub :: Privacy