VirtualBox

Opened 5 years ago

#18222 new defect

Problem with VBoxAutostart and possible workaround

Reported by: Simonmicro Owned by:
Component: other Version: VirtualBox 6.0.0
Keywords: Autostart, Crash, Systemctl, Systemd Cc:
Guest type: all Host type: Linux

Description

Hello, in the last days I've discovered a problem which seems to be a bug in the virtualbox autostart service. Here follows the overview now:

How to reproduce? Create several virtual machines and add them to the autostart of VirtualBox by following e.g. that guide (it doesn't matter which you choose) https://pgaskin.net/linux-tips/configuring-virtualbox-autostart/ . Now set also the "autostop-type" of all your autostart VMs to "savestate". If you reboot your system now, all VMs will crash and only the first VM will be automatically started, the rest stays off.

What is my system? It could be reproduced using a fresh installed debian 9 and the virtualbox version 6-RC1 (installed by https://wiki.debian.org/VirtualBox).

What is the reason for that failure? If you add more than two VMs to the autostart, the script "vboxautostart-service.sh" will start in the line

start_daemon `basename $user | sed -ne "s/\(.*\).start/\1/p"` $binary $PARAMS > /dev/null 2>&1

multiple instances of VBoxAutostart - the second one will crash, because an other instace is already running. That causes a return of the exit code of 1 - the systemd envroiment (activated by that file /lib/systemd/system/vboxautostart-service.service) take that as a failure of the service and marks it as crashed too. If you now try to stop the service by hand or reboots the system systemd will (i guess) skip the stop part of the script, because the service is not running / crashed - regardless that a VM is running. That causes the system not to stop and wait for the VMs and let them crash.

How to fix? Simply remove the "--background"-flag from the parameter list of the start procedure.

PARAMS="--background --start --config $VBOXAUTOSTART_CONFIG"

->

PARAMS="--start --config $VBOXAUTOSTART_CONFIG"

Now the bootup maybe takes some more time, but all VMs are started correctly and also gets correctly shutdowned impliced by the "autostop-type" setting.

Thanks for reading this (short) report, Simonmicro

Change History (0)

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use