Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Ubuntu Server using VBoxHeadless. How do I send ACPI shutdown signal through VirtualBox and make Ubuntu Server respect it and comply with the shutdown signal?

share|improve this question
Do you want to shutdown the host from the guest or do you want to shutdown the guest only? – Takkat Nov 23 '11 at 11:02
@Takkat Guest only. – Oxwivi Nov 23 '11 at 11:06
up vote 21 down vote accepted

If you want to shutdown the guest Ubuntu you have two options:

Shutting down a guest using VBoxManage

A virtual machine can be controlled by command line using the VBoxManage command line tool:

VBoxManage controlvm [nameofmachine] savestate       # saves the state of the VM like in suspend
VBoxManage controlvm [nameofmachine] poweroff        # simply "unplugs" the VM
VBoxManage controlvm [nameofmachine] acpipowerbutton # sends ACPI poweroff signal

For power off by ACPI the virtual OS needs to be capable to do so, and VirtualBox may also need to enable ACPI support for the VM.

  • Enable VirtualBox ACPI options:

    VBoxManage modifyvm [nameofmachine] --acpi on
  • Install ACPI support in the Ubuntu VM:

    sudo apt-get install acpid

Shutting down guest from SSH

A safer way to shut down the machine in case you have SSH access woud be to issue

user@virtualmachine: sudo poweroff

This will take care to safely shut down and poweroff your guest OS.

share|improve this answer
I want to use the VM as a LAMP server for testing purposes. So after the initial set up, I wanted to avoid interacting with it entirely (like SSH). But it looks like there's no clean way to shutdown with VirtualBox. – Oxwivi Nov 23 '11 at 11:28
Wait, now that you've mentioned VBoxManage, I checked it's manpage - there's an option that goes VBoxManage controlvm <uuid>|<name> acpipowerbutton. Will Ubuntu Server respect the signal and shutdown? – Oxwivi Nov 23 '11 at 11:32
I think the package acpid is required. Though I'd need to check if it's installed by default in Ubuntu Server. – Oxwivi Nov 23 '11 at 11:35
I use the acpipowerbutton trick to shutdown some Windows Virtual Machines from cron and it works very well. Unluckily, I have never tried to use it in to shut down a linux server. – Javier Rivera Nov 23 '11 at 11:55
Please add those to the answer. – Oxwivi Nov 23 '11 at 11:56

I found this here and tested it - works nicely.

/usr/bin/net rpc shutdown -f -t 1 -I XXX.XXX.XXX.XXX -U <shutdown_acc>%<password>

assumes samba is installed on the host.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.