Solved bhyve exited with status 4

tl;dr network_type and network_switch settings were completely wrong in .template file.

# freebsd-version -k -r ; uname -a
12.4-RELEASE-p3
12.4-RELEASE-p3
FreeBSD vhost01.hamilton.harte-lyne.ca 12.4-RELEASE-p3 FreeBSD 12.4-RELEASE-p3 GENERIC amd64

I am attempting to create a new linux vm using vm-bhyve. I am using these commands:
Code:
# vm create -t rocky_linux_uefi_zfs_3if -s 192G vhp3k101x
# vm install vhp3k101x Rocky-8.8-x86_64-minimal.iso
Rocky-8.6-x86_64-minimal.iso
Starting vhp3k101x
  * found guest in /zroot/vm/vhp3k101x
  * booting...

The configuration file contains:
Code:
# Rocky Linux 8.6  2023-07-04
# guest="linux"
#
loader="uefi"
cpu=4
memory=6G

# On the vm in order to use classic i/f configuration commands and scripts
# it is necessary to run 'systemctl start NetworkManager'.  To have this
# automatically start on boot run 'systemctl enable  NetworkManager'.

# Need one i/f for WAN access
network0_type="vm_public_net"
#network0_switch="vm_public_net"

# Need one i/f for internal LAN
network1_type="vm_public_net"
#network1_switch="vm_private_net"

# Need one i/f for Charon guest
network2_type="vm_public_net"

# Set -s (size) to 192GB
# rl-root partition 24GB
# rl-home partition 8GB
# rl-log partition 8GB
# rl-var-hp3000 152GB
#
disk0_type="virtio-blk"
disk0_name="disk0"
disk0_dev="sparse-zvol"

# set up serial console post-install
# Logon with vncviewer to gui console
# append "console=tty0 console=ttyS0,115200" to kernelopts
# using: grub2-editenv - set "kernelopts=root=<options list>"

# gui console
# run vm list to get vnc port
# run vncviewer to connect to console
# do not use vm console

graphics="yes"
graphics_vga="io

I cannot connect to the vm to complete the install because it immediately exits with status 4.
Code:
# vm list
NAME        DATASTORE  LOADER     CPU  MEMORY  VNC  AUTO  STATE
vbsd-01     default    bhyveload  4    8G      -    No    Stopped
vhp3k101-m  default    uefi       4    6G      -    No    Stopped
vhp3k101x   default    uefi       4    6G      -    No    Stopped
#

Code:
# cat /zroot/vm/vhp3k101x/vm-bhyve.log
Jul 04 13:59:46: generated static mac 58:9c:fc:02:38:a9 (based on 'vhp3k101x:0:1688493586:0')
Jul 04 14:00:27: initialising
Jul 04 14:00:27:  [loader: uefi]
Jul 04 14:00:27:  [cpu: 4]
Jul 04 14:00:27:  [memory: 6G]
Jul 04 14:00:27:  [hostbridge: standard]
Jul 04 14:00:27:  [com ports: com1]
Jul 04 14:00:27:  [uuid: 8fc8e45e-1a94-11ee-a5d2-7085c2da884f]
Jul 04 14:00:27:  [debug mode: no]
Jul 04 14:00:27:  [primary disk: disk0]
Jul 04 14:00:27:  [primary disk dev: sparse-zvol]
Jul 04 14:00:27: initialising network device tap0
Jul 04 14:00:27: generated static mac 58:9c:fc:0a:d9:ef (based on 'vhp3k101x:1:1688493627:0')
Jul 04 14:00:27: initialising network device tap1
Jul 04 14:00:27: generated static mac 58:9c:fc:0a:38:1c (based on 'vhp3k101x:2:1688493627:0')
Jul 04 14:00:27: initialising network device tap2
Jul 04 14:00:27: dynamically allocated port 5900 for vnc connections
Jul 04 14:00:27: booting
Jul 04 14:00:27:  [bhyve options: -c 4 -m 6G -Hwl bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -U 8fc8e45e-1a94-11ee-a5d2-7085c2da884f -u]
Jul 04 14:00:27:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,virtio-blk,/dev/zvol/zroot/vm/vhp3k101x/disk0 -s 5:0,vm_public_net,tap0,mac=58:9c:fc:02:38:a9 -s 5:1,vm_public_net,tap1,mac=58:9c:fc:0a:d9:ef -s 5:2,vm_public_net,tap2,mac=58:9c:fc:0a:38:1c -s 6:0,fbuf,tcp=0.0.0.0:5900,vga=io,wait]
Jul 04 14:00:27:  [bhyve console: -l com1,/dev/nmdm-vhp3k101x.1A]
Jul 04 14:00:27:  [bhyve iso device: -s 3:0,ahci-cd,/zroot/vm/.iso/Rocky-8.6-x86_64-minimal.iso,ro]
Jul 04 14:00:27: starting bhyve (run 1)
Jul 04 14:00:27: bhyve exited with status 4
Jul 04 14:00:27: destroying network device tap0
Jul 04 14:00:27: destroying network device tap1
Jul 04 14:00:27: destroying network device tap2
Jul 04 14:00:27: stopped
Jul 04 14:07:22: initialising
Jul 04 14:07:22:  [loader: uefi]
Jul 04 14:07:22:  [cpu: 4]
Jul 04 14:07:22:  [memory: 6G]
Jul 04 14:07:22:  [hostbridge: standard]
Jul 04 14:07:22:  [com ports: com1]
Jul 04 14:07:22:  [uuid: 8fc8e45e-1a94-11ee-a5d2-7085c2da884f]
Jul 04 14:07:22:  [debug mode: no]
Jul 04 14:07:22:  [primary disk: disk0]
Jul 04 14:07:22:  [primary disk dev: sparse-zvol]
Jul 04 14:07:22: initialising network device tap0
Jul 04 14:07:22: initialising network device tap1
Jul 04 14:07:22: initialising network device tap2
Jul 04 14:07:22: dynamically allocated port 5900 for vnc connections
Jul 04 14:07:22: booting
Jul 04 14:07:22:  [bhyve options: -c 4 -m 6G -Hwl bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -U 8fc8e45e-1a94-11ee-a5d2-7085c2da884f -u]
Jul 04 14:07:22:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,virtio-blk,/dev/zvol/zroot/vm/vhp3k101x/disk0 -s 5:0,vm_public_net,tap0,mac=58:9c:fc:02:38:a9 -s 5:1,vm_public_net,tap1,mac=58:9c:fc:0a:d9:ef -s 5:2,vm_public_net,tap2,mac=58:9c:fc:0a:38:1c -s 6:0,fbuf,tcp=0.0.0.0:5900,vga=io]
Jul 04 14:07:22:  [bhyve console: -l com1,/dev/nmdm-vhp3k101x.1A]
Jul 04 14:07:22: starting bhyve (run 1)
Jul 04 14:07:22: bhyve exited with status 4
Jul 04 14:07:22: destroying network device tap0
Jul 04 14:07:22: destroying network device tap1
Jul 04 14:07:22: destroying network device tap2
Jul 04 14:07:22: stopped

I have previously successfully created and run linux vms on this host. I have an identical vm on this machine which runs without problem. I just cannot create a new one.

What is the problem?
 
Code:
graphics="yes" 
graphics_vga="io
Is that a copy/paste error or does the configuration actually miss a proper graphics_vga? At the very least it's missing a quote, but I'm wondering if graphics_vga is valid at all.
 
Is that a copy/paste error or does the configuration actually miss a proper graphics_vga? At the very least it's missing a quote, but I'm wondering if graphics_vga is valid at all.
Cut and paste error.
Code:
. . .
# gui console
# run vm list to get vnc port
# run vncviewer to connect to console
# do not use vm console

graphics="yes"
graphics_vga="io"

Code:
VM-BHYVE(8)             FreeBSD System Manager's Manual            VM-BHYVE(8)

NAME
     vm - utility to manage bhyve virtual machines
. . .
     graphics_vga       This configures how the graphics card is exposed to
                        the guest. Valid options are io (default), on or off.
                        Please see the bhyve(8) man page for more details on
                        this option.
. . .
 
Found the problem. I had completely messed up the virtual network settings. They should be:
Code:
# Need one i/f for WAN access
network0_type="virtio-net"
network0_switch="vm_public_net"

# Need one i/f for internal LAN
network1_type="virtio-net"
network1_switch="vm_public_net"

# Need one i/f for Charon guest
network2_type="virtio-net"
network2_switch="vm_public_net"
 
Back
Top