OK, a few minutes with Google has found this page:
http://lifeofageekadmin.com/how-to-set-your-virtualbox-vm-to-automatically-startup/With a few alterations to be consistent with the installation on SME, the process looks like this:
- Edit /etc/default/virtualbox to add VBOXAUTOSTART_DB and VBOXAUTOSTART_CONFIG
- Create /etc/vbox/autostart.cfg giving the root user the ability to start VMs
- Since any VMs that would be running on SME are running as root, there's no need to change the group or permissions of /etc/vbox/, nor to add groups to the root user
- VBoxManage setproperty autostartdbpath /etc/vbox
- Make sure VM(s) you want to autostart aren't running
- VBoxManage modifyvm (VM name or UUID) --autostart-enabled on. Repeat this for each VM you want to start automatically.
- service vboxautostart-service start
I don't see that either /etc/default/virtualbox or anything in /etc/vbox/ are templated--the standard template warning header isn't on either file, and neither /etc/e-smith/templates/etc/default/ nor /etc/e-smith/templates/etc/vbox/ exist. This process does seem to work for me--the two VMs I want to start on boot are starting. Any red flags before I add this to the wiki for phpvirtualbox?
Edit: VBoxManage allows you to set a few other flags for the VM that may be relevant. Two are --autostop-type (I don't see that its options are documented very well, but the value of savestate will suspend the machine) and --autostart-delay (delay in seconds before the VM is started).