Bug 247599

Summary: bhyve exits when booting UEFI OpenBSD 6.7 guest
Product: Base System Reporter: Travis Cole <kelp>
Component: bhyveAssignee: freebsd-virtualization (Nobody) <virtualization>
Status: New ---    
Severity: Affects Some People CC: me
Priority: ---    
Version: 12.1-RELEASE   
Hardware: amd64   
OS: Any   

Description Travis Cole 2020-06-27 19:15:54 UTC
On FreeBSD 12.1-RELEASE-p6 when installing an OpenBSD 6.7 guest with UEFI boot, bhyve exits very early in the boot process.

I'm running bhyve like this:

bhyve -c 1 -m 4G -Hwl bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        -s 0,hostbridge \
        -s 31,lpc -l com1,stdio \
        -s 3:0,ahci-hd,/zroot/vm/.iso/install67.fs,ro \
        -s 4:0,virtio-blk,/dev/zvol/zroot/vm/openbsd1/disk0.img \
        -s 5:0,virtio-net,tap3,mac=58:9c:fc:01:ff:4e \
        openbsd1

And I get:

probing: pc0 com0 com1 mem[640K 3049M 16M 20K 4M 64K 1024M]
disk: hd0 hd1*
>> OpenBSD/amd64 BOOTX64 3.50
boot>
cannot open hd0a:/etc/random.seed: No such file or directory
booting hd0a:/6.7/amd64/bsd.rd: 3826379+1557504+3881976+0+598016 [301104+128+465696+311208]=0xa71778
entry point at 0x1001000
rdmsr to register 0xc80 on vcpu 0

When searching around for solutions, I found this github issue:
https://github.com/machyve/xhyve/issues/179

That contains a workaround, which does work for me at the OpenBSD boot: prompt run this:

set tty com0

Then I can get a clean boot and install, and everything is fine after that.

I'm not sure if this is more a bhyve issue, or an OpenBSD issue, but figured it was worth reporting here. I can reproduce this 100%.
Comment 1 Anatoli 2020-06-27 19:34:12 UTC
That't not an issue. Buy default OpenBSD doesn't start a serial console during kernel boot and you can't see anything it shows after certain point in the boot process (it does ask you about configuring to always start it during the setup process if it detects you are on it).

You may start bhyve with VNC graphics and connect to it (e.g. "-s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,vga=off,wait").

Or you can specify "set tty com0" during OpenBSD boot as you already figured out.

This is just the way OpenBSD works.
Comment 2 Travis Cole 2020-06-27 20:40:47 UTC
But bhyve exits. Is that expected?
Comment 3 Anatoli 2020-06-28 07:08:44 UTC
Not sure why exactly, but I guess this is due to the guest exiting and this is probably happens only on bsd.rd boot (it detects there's no input/output attached so no way to proceed with the setup?).

Normal installation can boot without issues even without "set tty com0" in the /etc/boot.conf.