5

With virtualbox, I use VBoxManage controlvm "$VMNAME" acpipowerbutton to shut down a virtual server when the host is shutting down.

This works well when I test, but not in real world cases (i.e. when the host reboots for updates, or even sometimes when it is manually restarted for maintenance). In some of these cases, the VM does not shut down, and after a timeout the virtualbox process is killed, which is less than ideal.

youen
  • 209
  • 2
  • 6

1 Answers1

5

The problem was hard to troubleshoot because it worked most of the time when explicitely testing the shutdown procedure. It turns out this was because I was logged on the windows server (RDP) to see if it was shutting down correctly. And this is exactly the difference between a success and a failure: if no one is logged on the server, the ACPI button does nothing!

Luckily, this can be configured easily: use regedit to set HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\shutdownwithoutlogon to 1

youen
  • 209
  • 2
  • 6
  • Did you do anything extra to make this work? Because my registry value is set to 1, but it still doesn't work for my Windows Server VM (I issue the ACPI signal from the VitrualBox UI). I've also read somewhere that my OS might be missing some ACPI scripts which I should install, but I have no idea if that is correct, where to find those scripts and how to install them. – NoOne Sep 13 '19 at 21:12
  • @NoOne Hmm, sorry, I don't remember. I suppose if there was something I would have added it to my answer, unless I didn't remember at that time already ;-) Also, I've noticed lately that my systemd script that is supposed to shut the VM down takes a long time, timeout, and kills the virtualbox process, so it seems its broken again. Haven't time right now to find out, but I guess there are tons of issues that could get in the way of proper shutdown. – youen Sep 16 '19 at 09:15