VirtualBox 4.3 autostart on Debian wheezy

Since VirtualBox 4.2 there is autostart script which helps you start your virtual machines during boot. Here is a howto for VirtualBox 4.3 autostart on Debian wheezy.

Before this autostart script the virtual machines ware started usually from rc.local, now you can do it with VirtualBox autostart config. Do the following to enable the autostart service:

ADVERTISEMENT

As root:

vi /etc/default/virtualbox

add this lines:

VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.conf

Now change the permissions to the folder for vboxusers

chgrp vboxusers /etc/vbox
chmod 1775 /etc/vbox

Create the /etc/vbox/autostart.conf and add this users that you want autostart to be enabled, my users for running the virtual machines is vbox

vi /etc/vbox/autostart.conf
# Default policy is to deny starting a VM, the other option is "allow".
default_policy = deny
# user vbox is allowed to start virtual machines but starting them
# will be delayed for 10 seconds
vbox = {
 allow = true
 startup_delay = 10
}

Now login as vbox and enable autostart on the machines you want to start automatically, i will do  it for two machines called VirtualMachine1 and VirtualMachine2

VBoxManage setproperty autostartdbpath /etc/vbox
VBoxManage modifyvm VirtualMachine1 --autostart-enabled on
VBoxManage modifyvm VirtualMachine2 --autostart-enabled on

Now, as root run this command, or reboot your server:

/etc/init.d/vboxautostart-service start

Note: vboxautostart-service uses only start and stop

More:
Starting virtual machines during system boot