Auto Start Virtual Box VM's on Linux

04/27/2020

Create Config Files

/etc/default/virtualbox

sudo vim /etc/default/virtualbox then add:

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

/etc/vbox/autostart.cfg

sudo vim /etc/vbox/autostart.cfg then add:

default_policy = deny
kevin = {
allow = true
}

Change Permissions

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

Then, for each allowed username: sudo usermod -aG vboxusers USERNAME

Note: Log out and in for it to apply.

VBoxManage: error: Adding machine ‘Ubuntu-VM’ to the autostart database failed with VERR_ACCESS_DENIED If you this error message, manually create <userid>.start file under /etc/vbox

Choose VMs to automatically start

Run the on-time command VBoxManage setproperty autostartdbpath /etc/vbox.

Add VM’s!

  1. VBoxManage list vms
  2. VBoxManage modifyvm <uuid|vmname> --autostart-enabled <on|off>

Restart VirtualBox autostart service

sudo service vboxautostart-service restart or reboot the machine.

Post modified from Patrick Gaskin and Yakup