bhyve How to start a vm guest in console mode

I'm running a Redhat VM via vm-bhyve. When I need to work with Redhat vm, I issue vm start redhat in command line, then I open tigherVNC to connect to vm and make the system boot into graphic mode. Many times I don't need the Redhat to be in graphic mode. And when I need graphic mode, I open Remmina to connect the Redhat vm via RDP because I have better experience with RDP.
I'm wondering if there is a way skip the step of using tigherVNC. The best case for me is, when I start vm, the Redhat will boot to console mode already. When the graphic mode is needed, I do RDP. Is it possible to do this a I wish?
 
My redhat.conf used by vm-bhyve is as following:
Code:
loader="uefi"
cpu="2"
memory="8G"

graphics="yes"
graphics_res="1920x1080"
graphics_wait="yes"
graphics_listen="0.0.0.0"
graphics_port="5930"
xhci_mouse="yes"
ahci_device_limit="8"

disk0_name="disk0"
disk0_dev="sparse-zvol"
disk0_type="virtio-blk"

network0_type="virtio-net"
network0_switch="rhsw"
network0_mac="58:9c:fc:0d:be:ad"

# UEFI and COM port
bootrom="/usr/local/share/uefi-firmware/BHYVE_UEFI.fd"
com1="stdio"

# Additional bhyve options
bhyve_options="-AHw"

utctime="no"
uuid="a87578c2-443b-11f0-a9bc-34f7169d79f6"
 
Last edited by a moderator:
At the base, there is no need to connect with vnc to start a VM. It's a specific setting in the bhyve command line. In your case, you just have to set to "no", the var graphics_wait.

From vm(8):
Code:
 graphics_wait      Set this to yes in order to make guest boot wait for
              the  VNC  console  to    be opened.  This can help when
              installing operating systems that require  immediate
              keyboard  input  (such  as  a     timed    'enter    setup'
              screen).  Set    to no in order to  completely  disable
              this function.
 
graphics_wait="yes" forces user intervention. This can not be done from "vm console <vm>" but only from vnc.

It doesn't need to be set to "no", just remove it (or comment: #). The bhyve vm can be accessed by console after the vm has started, after passing boot menu (grub, FreeBSD boot menu), or connecting to the boot menu, accessed by vnc anytime after boot. I don't know how exactly Linux is booted in bhyve with Grub, does Grub boot the system after a amount of time has passed automatically or does it need user input?

Example immediate console access: vm start <vm> && sleep 2 && vm console <vm>

This connects to the vm, but until the kernel boots, no boot messages are displayed or user input is possible.
 
graphics_wait="yes" forces user intervention. This can not be done from "vm console <vm>" but only from vnc.

It doesn't need to be set to "no", just remove it (or comment: #). The bhyve vm can be accessed by console after the vm has started, after passing boot menu (grub, FreeBSD boot menu), or connecting to the boot menu, accessed by vnc anytime after boot. I don't know how exactly Linux is booted in bhyve with Grub, does Grub boot the system after a amount of time has passed automatically or does it need user input?

Example immediate console access: vm start <vm> && sleep 2 && vm console <vm>

This connects to the vm, but until the kernel boots, no boot messages are displayed or user input is possible.
Not familiar with grup commands, but command # vm start redhat && sleep 2 && vm console redhat enters grub and waits for input. Don't know how to load the kernel and boot the system.
Changing to uefi load, however, can boot the system.
 
Not familiar with grup commands, but command # vm start redhat && sleep 2 && vm console redhat enters grub and waits for input. Don't know how to load the kernel and boot the system.
Changing to uefi load, however, can boot the system.
It works out of the box with BSD OS but Linux distros need a little bit of tweaking.
See there it should help:
 
Back
Top