Starting virtualbox VM (headless) at boot time

Hi folks
I’m setting up my new system based on Leap 15 Virtualbox SW as supplied by Opensuse (5.2.18-lp150.4.14.1). I’ve addedVBOXAUTOSTART_DB=/etc/vbox/

to /etc/default/virtualbox

# /etc/default/virtualbox
# -------------------------------------------------------------------------------------------------
# In the "SHUTDOWN_USERS" list all users for which a check for runnings VMs should be done during
# shutdown of "vboxdrv" resp. the server:
# SHUTDOWN_USERS="foo bar"
# Set "SHUTDOWN" to one of "poweroff", "acpibutton" or "savestate" depending on which of the
# shutdown methods for running VMs are wanted:
# SHUTDOWN="poweroff"
# SHUTDOWN="acpibutton"
# SHUTDOWN="savestate"
# -------------------------------------------------------------------------------------------------

# -------------------------------------------------------------------------------------------------
# By default, vboxdrv creates a file /etc/udev/rules.d/60-vboxdrv.rules every time, it is started, 
# that allows full control of this hosts usb devices in virtual machines (given, you allow accessing
# them with the GUI).
# In order to control this ability yourself, copy the generated /etc/udev/rules.d/60-vboxdrv.rules
# file to another name and modify to your needs, e.g. comment out all lines beginning with SUBSYSTEM,
# which will make this hosts usb devices inaccessible AND enable the next line.

# Autostart added 


Then I applied*chmod 1775 /etc/vbox
chgrp vboxusers /etc/vbox
*resulting in:
*drwxrwxr-t 1 root vboxusers 36 7. Sep 14:24 vbox

Of course the user “user” owning the machine is also member of vboxusers.

vbox.cfg in that directory looks like

#settings for vboxwebsrn

# Added
# Default policy is to deny starting a VM, the other option is "allow".
default_policy = deny
# Create an entry for each user allowed to run autostart
user = {
allow = true

Added the autostart path to Virtualbox:

user@server:/root> VBoxManage list systemproperties
API version:                     5_2
Minimum guest RAM size:          4 Megabytes
Maximum guest RAM size:          2097152 Megabytes
Minimum video RAM size:          0 Megabytes
Maximum video RAM size:          256 Megabytes
Maximum guest monitor count:     64
Minimum guest CPU count:         1
Maximum guest CPU count:         32
Virtual disk limit (info):       2199022206976 Bytes
Maximum Serial Port count:       4
Maximum Parallel Port count:     2
Maximum Boot Position:           4
Maximum PIIX3 Network Adapter count:   8
Maximum ICH9 Network Adapter count:   36
Maximum PIIX3 IDE Controllers:   1
Maximum ICH9 IDE Controllers:    1
Maximum IDE Port count:          2
Maximum Devices per IDE Port:    2
Maximum PIIX3 SATA Controllers:  1
Maximum ICH9 SATA Controllers:   8
Maximum SATA Port count:         30
Maximum Devices per SATA Port:   1
Maximum PIIX3 SCSI Controllers:  1
Maximum ICH9 SCSI Controllers:   8
Maximum SCSI Port count:         16
Maximum Devices per SCSI Port:   1
Maximum SAS PIIX3 Controllers:   1
Maximum SAS ICH9 Controllers:    8
Maximum SAS Port count:          255
Maximum Devices per SAS Port:    1
Maximum NVMe PIIX3 Controllers:  1
Maximum NVMe ICH9 Controllers:   8
Maximum NVMe Port count:         255
Maximum Devices per NVMe Port:   1
Maximum PIIX3 Floppy Controllers:1
Maximum ICH9 Floppy Controllers: 1
Maximum Floppy Port count:       1
Maximum Devices per Floppy Port: 2
Default machine folder:          /home/user/VirtualBox VMs
Raw-mode Supported:              yes
Exclusive HW virtualization use: on
Default hard disk format:        VDI
VRDE auth library:               VBoxAuth
Webservice auth. library:        VBoxAuth
Remote desktop ExtPack:          Oracle VM VirtualBox Extension Pack
Log history count:               3
Default frontend:                
Default audio driver:            Pulse
**Autostart database path:         /etc/vbox**
Default Guest Additions ISO:     
Logging Level:                   all

and switched it on:

user@server:/root> VBoxManage showvminfo ........
Name:            Win 7 Neu
Groups:          /
Guest OS:        Windows 7 (64-bit)
Autostart Enabled: on
Autostart Delay: 0

The file /etc/vbox/user.start was created just containing a “1”

restarting returns:

server:/ # service vboxes restart
server:/ # service vboxes status
vboxes.service - Autostart Headless Virtual Box VMs
Loaded: loaded (/usr/lib/virtualbox/; enabled; vendor preset: disabled)
Active: active (exited) since Fri 2018-09-07 18:11:32 CEST; 1s ago
Process: 4740 ExecStop=/usr/lib/virtualbox/ stop (code=exited, status=0/SUCCESS)
Process: 4742 ExecStart=/usr/lib/virtualbox/ start (code=exited, status=0/SUCCESS)
Main PID: 4742 (code=exited, status=0/SUCCESS)

Sep 07 18:11:32 server systemd[1]: Starting Autostart Headless Virtual Box VMs...
Sep 07 18:11:32 server[4742]: Starting Virtualbox machines: no virtual machines configured
Sep 07 18:11:32 server systemd[1]: Started Autostart Headless Virtual Box VMs.

Any ideas why vboxes does not see the virtual machine to start?
Did I miss to configure something?



to enable easier identification of each item you posted, each should be preceded by a short line containing the file name or command that generated the output.
At the moment for example, I can’t identify which if any is or is from your

In any case,
I’m looking for the exact mechanism you’re using to start a specific Guest and don’t see anything that does that…

Are you following a specific guide, if so you should post a link to it so that can be inspected.



I followed this:

and as this was leaving some points open

plus amendments in:



and of course

The references you point to look like they should work, but as you describe for some reason the Virtualbox documentation seems to be oddly incomplete…

Your references describe the “mechanism” I don’t see clearly described in the steps you did… Either you did something and posted results of whatever you did or the step is missing altogether.

From your reference
The following step seems to be missing in your steps

VBoxManage modifyvm Ubuntu-VM –autostart-enabled on

From your reference
The following step seems to be missing in your steps

*VboxManage modifyvm <VM name> -autostart-enabled on*



the result of this switch command is in a box of my initial mail showing the excerpt of the VBoxManage showvminfo … command.

In the meantime i dug into the underlying script (yikes! last time i did shell scripting was surely two decades ago ;))
The script does not fit the rest and the behavior of VBoxManage which creates and deletes nicely those user.start files on switch on/off the autostart flag in the VM.
It seems not the right version. Just see the config file it wants to read, which is not supplied by the package. It further assumes “VM;user” pairs in a file to start them.

server:/usr/lib/virtualbox # 
# description: Starts and stops vbox autostart VMs.
# Based on
# By Richard Bos <rbos at opensuse dot org> - May 2010
# Converted to standalone script for systemd environments
# By Hans-Peter jansen <hpj at urpla dot net> - July 2017

PRG=$(basename $0)
SERVICE="Virtualbox machines"

if  ! -x $VBOXMGR_BIN ]]; then
  echo "$VBOXMGR_BIN does not exist"
  if  "$1" = "stop" ]; then
    exit 0
    exit 6

**# read config file
 -r /etc/sysconfig/vbox ] && . /etc/sysconfig/vbox**

start() {


    if grep -q \; <<< "$VBOX"; then
      VBOX_NAME$N]=$(cut -d\; -f1 <<< "$VBOX")
      VBOX_USER$N]=$(cut -d\; -f2 <<< "$VBOX")

Being fed up and not want to waste more time on this piece of excellent software, I decided to do my own thing and created, based on, my own dedicated service.

I’ve created in usr/lib/virtualbox


PRG=$(basename $0)
SERVICE="Virtualbox machines"

if  ! -x $VBOXMGR_BIN ]]; then
  echo "$VBOXMGR_BIN does not exist"
  if  "$1" = "stop" ]; then
    exit 0
    exit 6

start() {

              su user -c "$VBOXMGR_BIN -q startvm 'Win 7 Neu' -type headless" &> /tmp/$PRG.$$

              if  $RETVAL != 0 ]]; then
                echo "Starting virtual machine: Win 7 Neu  (user: user) failed. "
                cat /tmp/$PRG.$$


stop() {

    echo "Shutting down: Win 7 Neu"
    su user -c "$VBOXMGR_BIN -q controlvm 'Win 7 Neu' savestate"

case "$1" in
        echo "Usage: $PRG {start|stop|restart|force-reload}" >&2
        exit 3

in server:/usr/lib/systemd/system I created vivotek.service

# Autostart configured Virtual Box VMs

Description=Autostart Headless Virtual Box VMs vboxdrv.service vboxdrv.service

ExecStart=/usr/lib/virtualbox/ start
ExecStop=/usr/lib/virtualbox/ stop


Which I symlinked to /usr/lib/systemd/system/ and activated and started it

Works nicely - and will not be affected by opensuse fixes to the bug I will file tomorrow
Hope I haven’t forgotten anything!



and the Bug report


I never used any autoboot tools/service when it comes to ‘*starting virtual machines during system boot.’
*I always disable any service or manually link /dev/null to it or use the systemctl mask option to disable the autostart feature.
and i use systemd-vboxinit :wink: