Ticket #12262 (closed defect: fixed)

Opened 17 months ago

Last modified 11 months ago

vboxautostart-service is not executed correctly on startup in Debian

Reported by: _Thomas_ Owned by:
Priority: major Component: host support
Version: VirtualBox 4.3.0 Keywords:
Cc: Guest type: all
Host type: Linux

Description (last modified by frank) (diff)

Somehow the startup script in the Debian dist does not auto start configured auto start engines. To fix this it is necessary to tweak the vboxautostart-service script not to exit when the modules are not detected. I don't know why but somehow the checking of loaded modules fails, probably it is because of some background startup. However the modules are loaded after start and also auto startup works when simply disabled the checking. Of course it breaks handling of real problems.

Please see following discussion for some users haveing this issue:

*** vboxautostart-service.orig	2013-10-26 22:28:25.000000000 +0200
--- vboxautostart-service	2013-10-26 22:09:13.000000000 +0200
*************** start() {
*** 271,277 ****
      begin_msg "Starting VirtualBox VMs configured for autostart";
      vboxdrvrunning || {
          fail_msg "VirtualBox kernel module not loaded!"
!         exit 0
      PARAMS="--background --start --config $VBOXAUTOSTART_CONFIG"
--- 271,277 ----
      begin_msg "Starting VirtualBox VMs configured for autostart";
      vboxdrvrunning || {
          fail_msg "VirtualBox kernel module not loaded!"
!     ##    exit 0
      PARAMS="--background --start --config $VBOXAUTOSTART_CONFIG"

Change History

comment:1 Changed 17 months ago by frank

  • Description modified (diff)

comment:2 Changed 17 months ago by frank

Which Debian version is this?

comment:3 Changed 14 months ago by artixk


I had the same problem on a ubuntu server 12.04. I do think that the proble is that in rc2.d vboxdrv is scheduled to start with the same priority as vboxautostart-service. Since init scripts with same priority are launched in alphabetical order it happens that vboxautostart-service is started before vboxdrv. This causes the the check to fail.

I fixed this updating runlevels using update-rc. You have to remove all links from runlevels and then repudate xboxdrv to start with proprity 19 (since vboxautostart-service starts with priority 20):

root@host:/etc/# update-rc.d -f vboxdrv remove
root@host:/etc/# update-rc.d -f vboxdrv defaults 19

You should fix your deb package to schedule vboxdrv with the right priority.

Hope to be usefull and to be in the right place.

Thanks for the great work.

comment:4 Changed 12 months ago by smbear

I've encountered the similar problem on Ubuntu 12.04 LTS. The solution proposed by atixk works for auto-start, but it doesn't work for auto-shutdown - on auto-shutdown, e.g. when host is going to reboot, vboxdrv stop hangs and blocks shutdown of the host. The problem seems to be that if there is an host-only interface configured, host system is unable to do rmmod vboxnetadp (host hangs) on reboot or poweroff of the host.

In dmesg one can see:

unregister_netdevice: waiting for vboxnet0 to become free. Usage count = 1

The solution that works for me:

sudo update-rc.d -f vboxdrv remove
sudo update-rc.d vboxdrv defaults 19 21

Basically: vboxdrv has to be started before vboxautostart-service and it has to be stopped after vboxautostart-service.

Another problem is that if I connect to guest using SSH (guest OS is also Ubuntu 12.04 LTS, guest has two interfaces configured: a bridged and a host-only interface, ssh connection uses the bridged interface), guest receives ACPI shutdown signal, SSH client informs that connection is lost, but host is unable to reboot - it again hangs trying to unload vboxnetadp. In processes running on host I can see that VBoxHeadless didn't exit. Killing it makes possible to unload the module.

For this I've applied a workaround: in vboxautostart-service in function stop() I've added sleep 3 just before return $RETVAL. This seems to resolve the problem.

Details of virtualbox-4.3 package:

apt-cache show virtualbox-4.3
Package: virtualbox-4.3
Version: 4.3.10-93012~Ubuntu~precise


Filename: pool/contrib/v/virtualbox-4.3/virtualbox-4.3_4.3.10-93012~Ubuntu~precise_amd64.deb

Last edited 12 months ago by smbear (previous) (diff)

comment:5 Changed 12 months ago by frank

Thanks for the report and the findings. Actually this was a misunderstanding. The installer thinks that update-rc.d will always scan the 'Required-Start' fields of the startup scripts. This is not always the case. The universal installer does this already correct, the postinst Debian script didn't. Fixed in r51040. The fix will be part of the next 4.3.x maintenance release. I'm not sure if updating the package will help to fix the boot priority, a uninstall + re-install might be necessary.

comment:6 Changed 11 months ago by frank

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

Fix is part of VBox 4.3.12.

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