Page 1 of 1

Autostart does not stop VM

Posted: 8. Sep 2014, 23:54
by Rob_H
Hi all,

On an Ubuntu 14.04 host, I configured autostart for a VM following the advice on the Life of a Geek Admin blog and the VirtualBox user manual. Starting the VM automatically works fine, but stopping does not work at all. I think it's related to this error, which I see in the console when vboxautostart-service is stopping:

Code: Select all

ls: cannot access /etc/vbox/*.stop: No such file or directory
Sure enough, if I look in the /etc/vbox directory, I see a .start file but no .stop file:

Code: Select all

drwxrwxr-t   2 root                   vboxusers              4096 Sep  8 17:24 ./
drwxr-xr-x 143 root                   root                  12288 Sep  8 17:26 ../
-rw-------   1 MYDOMAIN\user.redacted MYDOMAIN\domain users     1 Sep  8 17:24 MYDOMAIN\user.redacted.start
-rw-r--r--   1 root                   root                     23 Sep  8 14:38 autostart.cfg
When is the .stop file supposed to be created? I tried creating it manually by making a copy of the .start file. That gets rid of the error, but the VM still does not shut down. It's not an ACPI problem because I can shut down the VM from the GUI.

Any ideas? Thanks!

Re: Autostart does not stop VM

Posted: 9. Sep 2014, 14:07
by aeichner
Did you enable auto stop with

Code: Select all

VBoxManage modifyvm <VM name> --autostop-type <type>
where <type> can be one of "disabled, savestate, poweroff, acpishutdown"?
The default is disabled and the VM is killed by the system when shutting down. poweroff will have the same consequences as disabled because the guest can't properly shut down.
savestate saves the execution state of the VM and acpishutdown sends a shutdown event to the guest (like pressing the power button on a real PC).

Re: Autostart does not stop VM

Posted: 9. Sep 2014, 16:57
by Rob_H
Thanks! I don't see that option in the documentation or the VBoxManage usage text, but when I set --autostop-type acpishutdown, it accepts it and creates the .stop file. Now, if I run:

Code: Select all

sudo service vboxautostart-service stop
The VM shuts down as expected. Unfortunately, it still doesn't work when I shutdown the host without stopping the service manually. Instead, the host shutdown loops with the following message:

Code: Select all

Stopping VirtualBox kernel modules
unregister_netdevice: waiting for vboxnet0 to become free. Usage count = 1
unregister_netdevice: waiting for vboxnet0 to become free. Usage count = 1
...

Re: Autostart does not stop VM

Posted: 10. Sep 2014, 20:20
by aeichner
Interesting, I'll have a look at it. Thanks for the report!

Re: Autostart does not stop VM

Posted: 11. Sep 2014, 20:20
by aeichner
Can you try whether the attached init script fixes the autostop feature? Just replace it with the one in /etc/init.d, thanks. (I had to replace the file extension to allow the upload, the one in /etc/init.d should not have any extension)

Re: Autostart does not stop VM

Posted: 11. Sep 2014, 22:27
by Rob_H
Sorry, no change with your script. And actually, since I accepted the upgrade from 4.3.14 to 4.3.16, auto-start no longer works at boot either. I have to manually start the vboxautostart-service from the command line to get the VM to boot up.

Re: Autostart does not stop VM

Posted: 16. Sep 2014, 11:26
by aeichner
This is weird as there was no change in that area between 4.3.14 and 4.3.16 and the autostart feature works for me. Please create a ticket in our public bugtracker because tracking
the issue is easier there and I get notified about changes to the ticket. :)