Page 1 of 1

Force VirtualBox to save VM state on KILL signal

Posted: 10. Dec 2013, 12:48
by brunoais
Is there a way to force virtualbox to save the VM state when it receives the KILL signal?

The server it is running is shared and requires to be restarted from time to time and seeing the crash message on the guest windows system is definitely not a pleasant sight.

It happens like this:
I have my user logged in.
User A requires reboot of the machine to continue.
A has no access to my account.
  1. A initiates a reboot which includes a logoff of all connected accounts.
  2. My programs receive the KILL signal which includes a default timeout (in that machine, the sysOP declared that all programs have, at most 30 secs to terminate (this number can be increased when requesting the reboot in the command line (or equivalent)).
  3. Virtual box locks waiting for the user response (which is impossible to give).
  4. After the 30 secs all programs are ready except for virtual box that is still waiting.
  5. Virtual box is killed as with the OS inside.
The steps 4 and 5 are the wrong ones. It should start saving the state in those 30 seconds it has available. Usually, 10s is enough to save the state of that machine given the hardware it has.

How do I make it so that VBox reacts to the KILL signal with a savestate?

Re: Force VirtualBox to save VM state on KILL signal

Posted: 10. Dec 2013, 14:40
by scottgus1
You may want to try running your guest as a service. It has auto-save-state on host shutdown, no need to be logged in, and headless running (which you probably have now since your host is being used by someone logging into another acount while your guest is running on your account, it sounds like).
I've used this setup from time to time and found it solid. See viewtopic.php?f=6&t=8595