Ticket #16160 (new enhancement)

Opened 5 years ago

Add option to not return immediately after a contolvm command

Reported by: VirtualBarista Owned by:
Component: VM control Version: VirtualBox 5.1.8
Keywords: Cc:
Guest type: other Host type: other


While running VBoxManage from various systemd unit scripts, I found the following problem:

Systemd service commands like ExecStop return immediately, for example:

ExecStop=/usr/bin/VBoxManage controlvm MyVBoxVM acpipowerbutton

The above command will send an ACPI power down signal, which will cause the guest OS to start a shutdown procedure (if configured properly).


Systemd will see that the PID is still alive (since the guest OS is still powering down) and immediately issue a KILL signal to end the VM process. Thus, the guest OS will not have shutdown cleanly.

A temporary solution, is to create a dedicated shutdown script, which waits and constantly checks if the VM has shutdown or not, before returning. A better solution, would be to add a new parameter to VBoxManage that tells VBoxManage not to return immediately, like:

ExecStop=/usr/bin/VBoxManage controlvm MyVBoxVM acpipowerbutton noImmediateReturn

This will make VirtualBox more friendly with systemd units.

Thank you.

Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use