AutoStart VirtualBox VMs on System Boot on Linux


On a Linux system with VirtualBox installed, you can start VMs automatically during system boot. In this guide, we are going to learn how to autostart VirtualBox VMs on system boot on Linux. This demo uses Ubuntu 16.04 as the Linux machine that hosts multiple VirtualBox 6.0 virtual machines.

AutoStart VirtualBox VMs on System Boot on Linux

VirtualBox comes with a service called vboxautostart-service that makes it easy to automatically start virtual machines during system reboot.

Configure VirtualBox Autostart Service

In order to configure a VirtualBox VM to start on system boot on Linux, you need to activate the autostart service. The autostart service can be activated by setting two variables in /etc/default/virtualbox;

  • VBOXAUTOSTART_DB – which defines the absolute path to the autostart database directory, usually the /etc/vbox.
  • VBOXAUTOSTART_CONFIG – defines the path to the virtual machine autostart configuration.

These variables can be defined as;


To place these variables in the /etc/default/virtualbox, run the command below;

echo -e "VBOXAUTOSTART_DB=/etc/vbox\nVBOXAUTOSTART_CONFIG=/etc/vbox/autostartvm.cfg" | sudo tee /etc/default/virtualbox

Define the virtual machine autostart configuration settings. The autostart configuration file contains options that controls how the virtual machine is auto started.

vim /etc/vbox/autostartvm.cfg
default_policy = deny

amos = {
    allow = true
    startup_delay = 10
  • default_policy – defines whether to allow or deny the virtual machine autostart by default. In our example above, we denied any one from auto-starting the VM and explicitly allow one user, amos.
  • username (amos) – with the default deny policy, you can define the specific users that are allowed to autostart the virtual machine (allow = trues). You can also define how long to delay the VM startup. 10 seconds is used in this demo.

Set Ownership of Database directory

The database directory, /etc/vbox, should be writable by the user to be used to start VMs automatically. To make it easy, you can simply add your user to vboxusers group and set the group ownership of the database directory to vboxusers group. After that, set the write permissions for the group. In this case, amos user is to be used to automatically start the virtual machine.

sudo usermod -aG vboxusers amos
sudo chgrp vboxusers /etc/vbox

Assign the group write permissions on the autostart database directory.

sudo chmod g+w /etc/vbox

To shield the directory from being modified or deleted by other users except the owner or the root user, set sticky bit.

sudo chmod +t /etc/vbox

Enable Virtual Machine Autostart

As a user, you can enable autostart for individual machines. This requires that you define the path to the database directory first.

VBoxManage setproperty autostartdbpath /etc/vbox/

Once that is done, you can now setup the virtual machine to automatically start on system boot.

vboxmanage modifyvm fedora30 --autostart-enabled on

Where fedora30 is the UUID or the name of your virtual machine.

Restart  vboxautostart-service

The configuration is now done. To effect the settings, you need to restart the  vboxautostart-service.

sudo systemctl restart vboxautostart-service

Testing the Virtual Machine autostart

To test that your virtual machine can actually autostart on system boot, reboot you system and check. When system boots, your VM should now be running.

If you which to disable the virtual machine autostart;

vboxmanage modifyvm fedora30 --autostart-enabled off

That is all on how to autostart VirtualBox VMs on system boot on Linux. Feel free to drop any comment. Enjoy.

Related Tutorials;

Resize Root Partition of VirtualBox VM Snapshot

Install VirtualBox Guest Additions on Debian 10 Buster

Install Debian 10 Buster on VirtualBox

Install and Configure Endian Firewall on VirtualBox

How to Upgrade VirtualBox 5.2 to VirtualBox 6.0 on Ubuntu 16.04


  1. Your directions are great! Thanks! Much, much better than the official VirtualBox documentation (see “9.23.1. Linux: Starting the Autostart Service With init”) which very, very briefly mentions about one tenth of what you mentioned above.

  2. You have an error in your
    echo -e “VBOXAUTOSTART_DB=/etc/vbox\nVBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg” | sudo tee /etc/default/virtualbox

    you have autostart.cfg but you name the file autostartvm.cfg

  3. Hi all
    Can you help me?
    I have issue with autostart my vm(ls: cannot access ‘/etc/vbox/*.start’: No such file or directory).

    Loaded: loaded (/usr/lib/virtualbox/; enabled; vendor preset: enabled)
    Active: active (exited) since Wed 2020-03-18 10:05:12 CET; 13s ago
    Process: 14472 ExecStart=/usr/lib/virtualbox/ start (code=exited, status=0/SUCCESS)
    Mar 18 10:05:12 is3 systemd[1]: Starting vboxautostart-service.service…
    Mar 18 10:05:12 is3[14472]: Starting VirtualBox VMs configured for autostart.
    Mar 18 10:05:12 is3[14472]: ls: cannot access ‘/etc/vbox/*.start’: No such file or directory
    Mar 18 10:05:12 is3 systemd[1]: Started vboxautostart-service.service.”

    Anyone have an idea where is issue?
    Thank you


Please enter your comment!
Please enter your name here