Running bhyve guest on boot

I have just configured an Ubuntu bhyve guest, all working perfectly (bhyve is super awesome).

I currently start bhyve with this script

# /local/bhyve/ubuntu/running

The contents of this script are:
Code:
grub-bhyve -m device.map -r hd0,msdos1 -M 4096M linuxguest
bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap1 \-s 3:0,virtio-blk,./bhyve-ubuntu.img \
-l com1,stdio -c 4 -m 4096M linuxguest &

Now this is all well and good, but I am required to press enter on the bootloader/grub screen, then the vm loads and returns me to the command prompt.

How can I avoid having to press enter and automate the entire process? So I can then write a custom rc.d service script.
 
Grub has a timeout value that can be set. I'm not sure of the details, probably editing /boot/grub/grub.cfg and then running grub-install /dev/sda1 on the VM.
 
On Ubuntu (maybe other distros as well), grub2 is set up to handshake with the o/s where it unsets autoboot, and relies on the o/s to reset it when it successfully boots. If there is an issue with the boot process e.g. a kernel crash, the autoboot won't be unset and you'll be put into grub2 to give a chance to boot an alternate kernel/run a test/etc. This avoids boot/crash loops.

It should go away after a successful boot, but if you don't want this behaviour, or just want to modify the existing timeout, some info is at
http://askubuntu.com/questions/2149...oot-the-default-option-after-upgrade-to-12-10

Regarding your script, make sure you issue a bhyvectl --destroy --vm=linuxguest before the initial grub-bhyve command to clean out vm state from a previous run.

Thanks for using bhyve :)
 
Thanks, I knew I could set a time out value for grub but wondered if everything else was correct and or another way to launch hosts.

The rc.d script has a destroy option to destroy all created vms, but adding it in before the launch command is a good idea and should fix most issues.

Bhyve is so awesome, it allows me to host Linux clients securely and run software that isn't yet supported in FreeBSD... Also running in its own zfs mount just makes it even more sweeter :)
 
Back
Top