Ticket #14955 (closed defect: fixed)

Opened 7 years ago

Last modified 5 years ago

Ubuntu 15.10 vboxautostart-service stop does not work

Reported by: Peter Sburg Owned by:
Component: other Version: VirtualBox 5.0.12
Keywords: vboxautostart-service Cc:
Guest type: Linux Host type: Linux


I have install VirtualBox 5.0.12 on a fresh install of Ubuntu 15.10. I want to use the vboxautostart-service to start and stop a virtual machine automatically at startup and shutdown of the system.

I was able to do the vbox specific setup, so I can call /usr/lib/virtualbox/ start/stop from the shell and it works perfectly. I can also use systemctl start vboxautostart-service.service to start the vbox guest. It is even started automatically at system startup after I enabled the service. However if I try to stop the service with

systemctl stop vboxautostart-service.service

it does nothing, so the guest is still running afterwards. systemctl status shows the following:

root@linux:~# systemctl -l status vboxautostart-service.service
● vboxautostart-service.service
   Loaded: loaded (/usr/lib/virtualbox/; enabled; vendor preset: enabled)
   Active: inactive (dead) since Sa 2015-10-31 16:39:10 CET; 4min 57s ago
  Process: 5645 ExecStop=/usr/lib/virtualbox/ stop (code=exited, status=0/SUCCESS)
  Process: 5586 ExecStart=/usr/lib/virtualbox/ start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/vboxautostart-service.service
           ├─ 875 /usr/lib/virtualbox/VBoxXPCOMIPCD
           ├─ 880 /usr/lib/virtualbox/VBoxSVC --auto-shutdown
           └─5602 /usr/lib/virtualbox/VBoxHeadless --comment server --startvm b3376916-8562-442e-a25e-cfe26fa800db --vrde config

Okt 31 16:37:52 linux systemd[1]: Starting vboxautostart-service.service...
Okt 31 16:37:52 linux[5586]: Starting VirtualBox VMs configured for autostart
Okt 31 16:37:52 linux systemd[1]: Started vboxautostart-service.service.
Okt 31 16:39:10 linux systemd[1]: Stopping vboxautostart-service.service...
Okt 31 16:39:10 linux systemd[1]: Stopped vboxautostart-service.service.


VBox.log Download (94.9 KB) - added by Peter Sburg 7 years ago.

Change History

Changed 7 years ago by Peter Sburg

comment:1 Changed 6 years ago by _sly_

I can confirm this behavior on Debian Jessie (8.0) with systemd as well. While on Wheezy (7.x) without systemd, it works.

I've answered here for an ugly work around. But for package updates it would be great to solve this on debian based systemd OS

comment:2 Changed 5 years ago by ebertland

I can confirm the problem on Ubuntu xenial, with virtualbox-5.0 package version 5.0.34-113845~Ubuntu~xenial.

# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.2 LTS
Release:	16.04
Codename:	xenial

# dpkg -l |grep virtualbox
ii  virtualbox-5.0                                5.0.34-113845~Ubuntu~xenial                amd64        Oracle VM VirtualBox

Inspired by _sly_'s answer, I made a local fix by removing the unnecessary --background option from start-stop-daemon.

# diff -u 
---	2017-03-11 14:04:46.957195122 -0800
+++	2017-03-11 14:09:09.078268653 -0800
@@ -119,7 +119,7 @@
-        start-stop-daemon --background --chuid $usr --start --exec $bin -- $@
+        start-stop-daemon --chuid $usr --start --exec $bin -- $@
     killproc() {
         start-stop-daemon --stop --exec $@

I don't think the process needs to be backgrounded. According to the start-stop-daemon manpage, the --background option "is a last resort, and is only meant for programs that either make no sense forking on their own, or where it's not feasible to add the code for them to do this themselves." VBoxAutostart is started with the --background option, putting it into daemon mode, so there is no reason to try to do something extra in the start-stop-daemon wrapper.

Note that gentoo also uses start-stop-daemon and the --background option, so it may need to be fixed as well. Somebody else would have to test it, though.

comment:3 Changed 5 years ago by frank

Thanks for the investigation. I think removing the --background option from start-stop-daemon makes completely sense. This option was probably copied from other scripts. The next 5.1.x and 5.0.x maintenance releases will include the fix.

comment:4 Changed 5 years ago by frank

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in VBox 5.1.18.

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