Headless bhyve

could you please share more information on what exactly the problem is and what is it you want to achieve?
What is the guest OS, you want to boot?
Sorry I wasn't CLEAR enough.

I want to start bhyve headless (without a display attached)
How do I do this, or where do I find out how to do this.

Do you understand my question?

That's not what I'm looking for. I thank you, though.
The most common way of running bhyve guests "headless" is to use null modem devices.
You attach the serial console of the bhyve guest to a null modem 'A' port using the -l option:
bhyve ... -l com1,/dev/nmdm0A ...
Then you can access the console if needed by connecting to the 'B' port:
cu -l /dev/nmdm0B
If you have more than one vm you can use nmdm1A, 2A, etc.

This is covered in the handbook pages linked by SirDice above.

It's also possible to run bhyveload in this way using the -c /dev/nmdmA option, although you probably don't need to do that when running bhyveload/bhyve by hand.

The bhyve process will still 'hang' until the guest exits though, so you'd need to run bhyve ...options... guest & to have it actually run in the background and return you to your terminal.

I'd highly recommend just using one of the bhyve tools already available though.
Actually, you can only run VMs "headless". There's no VGA adapter virtualization yet. So in essence they're always headless :D

Defenitely read the handbook and play with the examples. Then try the tools I mentioned earlier. They make it so much easier to create, move, delete, stop/start and get a console.
Hello all. I have same problem with run bhyve headless.

I do like you describe.

This is my settings for bhyve guest.

bhyveload -c /dev/nmdm1A -m 1024 -d /vm/f1/f1.img f1

bhyve -c 1 -m 1024M -H -P -A \
-l com1,/dev/nmdm1A \
-s 0:0,hostbridge \
-s 1:0,lpc \
-s 2:0,virtio-net,tap2 \
-s 4,virtio-blk,/vm/f1/f1.img f1

I create startup script and locate it to /usr/local/etc/rc.d/.

Script is starting on booting bhyve server, but it's not headless.

Instructions like:
bhyveload -c /dev/nmdm1A...
-l com1,/dev/nmdm1A...
Is not working.

Please tell me what to do?
It depends exactly what you mean by headless, which seems to have gathered numerous meanings...
If you run bhyve using a nmdm device, the guest console will output to that. You then open the "B" nmdm device using cu to connect to it. However the bhyve command will still "hang" until the guest shuts down, because the bhyve command obviously keeps running while the guest is running.

Unless you really want to get your hands dirty I'd recommend just using something like my sysutils/vm-bhyve manager ;)
Rather old thread with no exact answer...
There were other comments and suggestions since, so here is my solution that works for me now.
To start/stop automatically (no terminal / interaction) my simple single VM (runs instance of OpenBSD7.2 for experimental uses) I use this rc(8) script:
# $FreeBSD$

# PROVIDE: obsd
# REQUIRE: some necessary stuff here
# BEFORE: some other stuff
# KEYWORD: shutdown

. /etc/rc.subr


desc="OpenBSD7.2 running in bhyve hypervisor"

    if [ ! -e /dev/nmdm0A ]; then
        kldload nmdm

    pkill $procname
    sleep 20

load_rc_config $name
run_rc_command "$1"
As can be seen for the script, my bhyve(8) command is contained in a sh script located at /user/local/bin/obsd .
Notice, too, that the script uses ... -l com1,/dev/nmdm0A ... $my-vm-name & . This allows to start it silently WIHTOUT any need for a terminal. Although it does use /dev/nmdm0A, it doesn't require me listening on cu -l /dev/nmdm0B to move any further than bhyve(8) start command. So the script includes $start_precmd to check if such device exists and the module loaded. Of course, nmdm_load="YES" is put into /boot/loader.conf, but additional checking won't hurt, right?
It's shame that including the whole bhyve(8) command line into this rc script didn't work... maybe you ppl have any suggestions?

Another thing to observe is procname="bhyve". As you already mentioned, logically, the process will be named "bhyve". So why not use the rc builtins on this one?
Ans sleep 20 is added because, for some reason or other, my OpenBSD system reacts to pkill bhyve within that time. And if killed prematurely, it will then run fsck on startup...

And finally, the $name of your script MUST NOT, for goodness sake, contain figures or dashes. If it does, rc(8) will keep complaing and your rc.conf option $myscript_enable="YES" will never work. Can't explain why, but I had to reduce my programs fancy name to simple "obsd". Which I didn't like because after all we're on FreeBSD... )))))

And of course, PROVIDE:name must be the same as name= below. Excellent tutorial about it in the handbook.