Hi Folks,
I try to switch the behavior of Virtualbox Plugin for how it terminates VMs in case of the host shutting down.
Most OS do not take well, if you just pull the plug. The OS usually then trys to think: and on next start it says:
Windows VMs (unlike Linux machines), that are currently not logged in, do need to get hit twice by "acpibutton", the first time kind of "wakes them up" , the second time shuts them down .
In the past I used this string su -c "vboxmanage list runningvms | sed -r 's/.*\{(.*)\}/\1/' | xargs -L1 -I {} VBoxManage controlvm {} acpipowerbutton" vbox from root CLI of OMV with a shutdown shell script repeating the string twice with a 10 seconds wait and then waiting an other 60 sekonds before shutting down the host.
Take note that the vobxmanage command to list running VMs only works with the user that runs the VMs, in OMV this is the user vbox. if you issue this as root, the return is empty. Took me a while back when i started to build that command, to figure this one out.
But then, I need to run that before the host shuts down, that obviously IS a problem with power failures
Now I lost a VM it got corrupted by the hard kill.
I tried to edit /etc/default/virtualbox from the standard entry "SHUTDOWN=poweroff" to two times SHUTDOWN=acpibutton and for safety reasons followed by SHUTDOWN=savestate. To no result, my test Windows VM still gets hard killed, as if the virtualbox daemon does not know the host is going down, or the host wont wait for the virtualbox service to report back VMs shutdown successfully.
Do I work the wrong file, or does the OMV Plugin has the shutdown routine not implemented into the host routine? Does it even know the host going down per WebUI or by remote command from UPS?
somebody any clue
Thanks
Manne
edit: I found that in /etc/rc6.d there is a link to /..init.d/virtualbox, so my question if virtualbox does know about the shutdown, is obsolet.
edit2: /etc/init.d/virtualbox stop_vms doese indeed switch off the VMs accorindg to /etc/default/virtualbox
new question: why is /etc/init.d/virutalbox not or not propperly called on shutdown with the case stop_vms (I susspect it IS indeed called but with case stop
I just had the server shut down from root CLI with shutdown -r 1
But I have no clue as there where to look to troubleshoot that further.
Cheers Manne