2

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

2
  • 1
    Well, have you checked the contents of /etc/acpi/powerbtn.sh?
    – ptman
    May 2, 2010 at 11:51
  • Yes, looks quite complex (for my shell scripting capabilities), but appears as though it would do the correct thing. I've also tried commenting out all the lines apart from the last line, which is a call to 'shutdown -h'
    – Bryan
    May 2, 2010 at 11:57

2 Answers 2

3

I hate posting answers to my own questions, but I've found the solution...

Simply install acpi-support into the guest.

apt-get install acpi-support

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.

2

Is your guest configured to shutdown when it gets the acpipowerbutton signal ?

2
  • Just edited my question, as I've just installed acpid on the guest. I don't know how to tell if the guest is configured to shutdown when it receives the acpipowerbutton signal though?
    – Bryan
    May 2, 2010 at 11:30
  • For windows guests it's in control panel->Power Options-> ... Power Buttons
    – user9517
    May 2, 2010 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .