These are bare-bones instructions for creating a Windows image for bhyve on SmartOS. You will need a platform image that has the fix for OS-7117. Platform images that I've used in testing are here: iso tgz usb
Create a volume that will be the disk.
zfs create -o volblocksize=4k -V 16g -s zones/hdd-windows
This script will be used for booting from the CD.
#!/bin/sh
bootrom=/usr/share/bhyve/uefi-rom.bin
[ "$1" = "-k" ] || pfexec bhyvectl --vm=windows --destroy
bhyve -H -w \
-s 0,hostbridge \
-B "1,product=SmartOS HVM" \
-s 31,lpc \
-l bootrom,$bootrom \
-l com1,stdio \
-c 2 \
-m 2G \
-s 3:0,ahci-cd,/zones/media/win2016eval.iso \
-s 4:0,ahci-hd,/dev/zvol/rdsk/zones/hdd-windows \
-s 28,fbuf,vga=off,tcp=0.0.0.0:5900,w=1024,h=768,wait -s 29,xhci,tablet \
windows
You will need to connect via vnc and hit the any key to tell it to boot from the CD. After doing the first chunk of work, Windows willl reboot. You will need to re-run the script one or more times to complete the installation. In the subsequent boots, you do not want to boot from the CD, so don't hit the any key. Note that the ,wait
on the fbuf
argument will cause bhyve to wait for the VNC connection before booting.
Once the installation is complete, we need to associate zones/hdd-windows
with a VM. The simplest way to do that is with the following.
First, stop the windows VM. Shutdown from within the VM or kill the bhyve process (-TERM
for an orderly shutdown, -KILL
or -9
for pull the cord).
Next, create an empty vm and swap disks.
vmadm create -f bhyve-empty.json
uuid=...
zfs destroy zones/$uuid/disk0
zfs rename zones/hdd-windows zones/$uuid/disk0
Now you should be able to start the Windows VM with vmadm start $uuid
Some things are not fully baked. We're working on them.
- Currently you must configure networking statically or have an external DHCP server.
- The procedure above does not include virtio drivers for disks or networking. It is unknown whether any other networking emulation works with bhyve on SmartOS. The virtio drivers we use on kvm and will likely use with bhyve are on this iso. It should be possible to add that iso to the command line during installation and adjust
hdd-windows
to usevirtio-blk
instead ofahci
.
The VNC console only works with bootrom=uefi. Even then, the bhyve VNC server implementation is quite limited and does not work well with all clients. I find Chicken of the VNC works well.
If you are trying to have GUI access to a guest for any purpose other than installation, I highly recommend that you use any method other than the bhyve VNC console.