bhyve virtual machine boot script

Hello FreeBSD community!
The following boot script is working with no errors & my virtual machine boots up but once I reboot the machine it shutdown completely and I have to run the script again, is there is a way to keep the machine running in a loop?

Code:
#!/bin/sh
bhyve -AHP -c 2 -m 16G \
-s 0:0,hostbridge \
-s 1:0,lpc \
-s 2:0,virtio-net,tap0 \
-s 3:0,virtio-blk,/dev/zvol/zroot/VMs/IPFW/IPFW \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1024,h=768 \
-s 30,xhci,tablet \
-l bootrom,../efi.fd \
IPFW > /dev/null 2>&1 &

Thanks,
Amr
 
No way to reboot that I know of.
But to restart a VM you can run bhyectl --vm=IPFW --destroy then restart your bhyve VM.
 
Look at the exit status from bhyve.

0 is reboot, so put your bhyve statement in a loop and check the exit status.

reference:
man bhyve
0 rebooted
1 powered off
2 halted
3 triple fault
4 exited due to an error
 
  • Thanks
Reactions: amr
Back
Top