You can start VMs automatically during system boot on Linux, Oracle Solaris, and Mac OS X platforms for all users.
On Linux, the autostart service is activated by setting two variables in /etc/default/virtualbox
. The first one is VBOXAUTOSTART_DB
which contains an absolute path to the autostart database directory. The directory should have write access for every user who should be able to start virtual machines automatically. Furthermore the directory should have the sticky bit set. The second variable is VBOXAUTOSTART_CONFIG
which points the service to the autostart configuration file which is used during boot to determine whether to allow individual users to start a VM automatically and configure startup delays. The configuration file can be placed in /etc/vbox
and contains several options. One is default_policy
which controls whether the autostart service allows or denies to start a VM for users which are not in the exception list. The exception list starts with exception_list
and contains a comma separated list with usernames. Furthermore a separate startup delay can be configured for every user to avoid overloading the host. A sample configuration is given below:
# Default policy is to deny starting a VM, the other option is "allow". default_policy = deny # Bob is allowed to start virtual machines but starting them # will be delayed for 10 seconds bob = { allow = true startup_delay = 10 } # Alice is not allowed to start virtual machines, useful to exclude certain users # if the default policy is set to allow. alice = { allow = false }
Any user who wants to enable autostart for individual machines must set the path to the autostart database directory with the following command:
VBoxManage setproperty autostartdbpath autostart-directory
On Oracle Solaris hosts, the Oracle VM VirtualBox autostart daemon is integrated into the SMF framework. To enable it you must point the service to an existing configuration file which has the same format as on Linux, see Section 9.21.1, "Linux: Starting the Autostart Service With init". For example:
# svccfg -s svc:/application/virtualbox/autostart:default setprop \ config/config=/etc/vbox/autostart.cfg
When everything is configured correctly you can start the Oracle VM VirtualBox autostart service with the following command:
# svcadm enable svc:/application/virtualbox/autostart:default
For more information about SMF, see the Oracle Solaris documentation.
On Mac OS X, launchd is used to start the Oracle VM VirtualBox autostart service. An example configuration file can be found in /Applications/VirtualBox.app/Contents/MacOS/org.virtualbox.vboxautostart.plist
. To enable the service copy the file to /Library/LaunchDaemons
and change the Disabled
key from true
to false
. Furthermore replace the second parameter to an existing configuration file which has the same format as on Linux, see Section 9.21.1, "Linux: Starting the Autostart Service With init".
To manually start the service use the following command:
# launchctl load /Library/LaunchDaemons/org.virtualbox.vboxautostart.plist
For additional information on how launchd services can be configured see:
On Windows, autostart functionality consist of two components. The first component is a configuration file where the administrator can both set a delayed start for the VMs and temporarily disable autostarting for a particular user. The configuration file should be located in a folder accessible by all required users but it should have permissions allowing only reading by everyone but administrators. The configuration file contains several options. The default_policy
controls whether the autostart service allows or denies starting of a VM for users that are not in the exception list. The exception list starts with exception_list
and contains a comma separated list with usernames. Furthermore, a separate startup delay can be configured for every user to avoid overloading the host. A sample configuration is given below:
# Default policy is to deny starting a VM, the other option is "allow". default_policy = deny # Bob is allowed to start virtual machines but starting them # will be delayed for 10 seconds bob = { allow = true startup_delay = 10 } # Alice is not allowed to start virtual machines, useful to exclude certain users # if the default policy is set to allow. alice = { allow = false }
The user name can be specified using the following forms: "user", "domain\user", ".\user" and "user@domain". An administrator must add the VBOXAUTOSTART_CONFIG
environment variable into system variables containing the path to the configuration file described above. The environment variable tells the autostart services which configuration file is used.
The second component of autostart functionality is a Windows service. Every instance of this works on behalf of a particular user using their credentials.
To enable autostarting for a particular user, a member of the administrators group must run the following command:
VBoxAutostartSvc install --user=user
[--password-file=password_file
]
The password file should contain the password followed by a line break. The rest of the file is ignored. The user will be asked for a password if the password file is not specified.
To disable autostarting for particular user, a member of the administrators group must run the following command:
VBoxAutostartSvc delete --user=user
If a user has changed their password then a member of the administrators group must either reinstall the service or change the service credentials using Windows Service Manager. Due to Windows security policies, the autostart service cannot be installed for users with empty passwords.
Finally, the user should define which VMs should be started at boot. The user should run the following command for every VM they wish to start at boot:
VBoxManage modifyvm VM name or UUID
--autostart-enabled on
The user can remove a particular VM from the VMs starting at boot by running the following command:
VBoxManage modifyvm VM name or UUID
--autostart-enabled off