VirtualBox

Opened 8 years ago

Closed 7 years ago

#14955 closed defect (fixed)

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

Description

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/vboxautostart-service.sh 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/vboxautostart-service.sh; 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/vboxautostart-service.sh stop (code=exited, status=0/SUCCESS)
  Process: 5586 ExecStart=/usr/lib/virtualbox/vboxautostart-service.sh 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 vboxautostart-service.sh[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.

Attachments (1)

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

Download all attachments as: .zip

Change History (5)

by Peter Sburg, 8 years ago

Attachment: VBox.log added

comment:1 by sylvain Gplservice, 8 years ago

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 http://askubuntu.com/questions/692283/ubuntu-15-10-vboxautostart-service-stop-does-not-work for an ugly work around. But for package updates it would be great to solve this on debian based systemd OS

comment:2 by ebertland, 7 years ago

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 vboxautostart-service.sh.orig vboxautostart-service.sh.local 
--- vboxautostart-service.sh.orig	2017-03-11 14:04:46.957195122 -0800
+++ vboxautostart-service.sh.local	2017-03-11 14:09:09.078268653 -0800
@@ -119,7 +119,7 @@
         shift
         bin="$1"
         shift
-        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 by Frank Mehnert, 7 years ago

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 by Frank Mehnert, 7 years ago

Resolution: fixed
Status: newclosed

Fixed in VBox 5.1.18.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use