vmactions / vbox

vbox.sh
MIT License
2 stars 2 forks source link

Use serial console instead of OCR #1

Open mia-0 opened 1 year ago

mia-0 commented 1 year ago

VirtualBox can expose a serial port, and *BSD guests can use it at bootup. That should be used instead of screen scraping text.

Neilpang commented 1 year ago

I had spent a lot of time making serial port work, but failed.

nijave commented 1 year ago

In the FreeBSD image,

cat <<EOF > /boot/loader.conf
boot_multicons=YES
boot_serial=YES
comconsole_speed=9600
EOF

Then with VirtualBox

vboxmanage modifyvm freebsd --uart1 0x3F8 4 --uartmode1 file serial.log

then I get serial.log

refs https://globalengineer.wordpress.com/2017/12/04/applied-freebsd-enabling-the-serial-console/ https://docs.oracle.com/en/virtualization/virtualbox/6.0/user/serialports.html https://docs.oracle.com/en/virtualization/virtualbox/6.0/user/vboxmanage-modifyvm.html#vboxmanage-modifyvm-other https://github.com/pombredanne/hyperkit/blob/b1a2db0b1d73c3a6650b5cb54e34851a18481736/hyperkit/hypervisor/vboxmanage.py#L35C46-L35C46

nijave commented 1 year ago

For compatibility, this could probably just check for a hardcoded serial log name and fallback to current method if it's missing