I'm currently testing Ubuntu 10.04, and have install the VirtualBox software. I have also installed Ubuntu 10.04 as a VirtualBox guest running on the host system.
I've installed the VirtualBox Utils into the guest OS, as follows:
sudo apt-get install virtualbox-ose-guest-utils
What I want to be able to do is to initiate a controlled shutdown of the guest, from the host system using the VBoxManage command.
I first tried this command:
VBoxManage controlvm guest poweroff
which worked, but didn't initiate a controlled shutdown, it effectively pulls the plug on the guest.
I've since found that this command should do the trick:
VBoxManage controlvm guest acpipowerbutton
but this doesn't appear to do anything.
Can anyone tell me what I'm doing wrong?
p.s. I don't want to use SSH & Certificates to do this, as I'm also going to be running Windows guests, and I want the solution to work for all guests.
Edit: Just found this post which suggests installing acpid into the guest, however having just done this and rebooted the system, it doesn't appear to have made any difference, as the host still appears to accept the command, but nothing happens to the guest.
Second Edit: acpi powerbutton event config as follows:
# /etc/acpi/events/powerbtn
# This is called when the user presses the power button and calls
# /etc/acpi/powerbtn.sh for further processing.
# Optionally you can specify the placeholder %e. It will pass
# through the whole kernel event message to the program you've
# specified.
# We need to react on "button power.*" and "button/power.*" because
# of kernel changes.
event=button[ /]power
action=/etc/acpi/powerbtn.sh
The above shell script (/etc/acpi/powerbtn.sh) exists
I hate posting answers to my own questions, but I've found the solution...
Simply install acpi-support into the guest.
I figured acpid would have been enough, but it appears as though it wasn't.
I can now issue a VBoxManage command to send an ACPIPowerButton event from the host, which now cleanly performs a shutdown on the guest.
Thanks everyone for your suggestions.
Is your guest configured to shutdown when it gets the acpipowerbutton signal ?