Wednesday, December 19, 2012

How to make your VM respond to ACPI shutdown

Several virtualization products give you the option of shutting down your VMs using ACPI. Without interacting with your OS, ACPI shutdown is most often your only option for a clean shutdown unless you are using some kind of client software on the guest, like VMware Tools.

In VirtualBox, ACPI shutdown is specially useful if you have started your VM in headless mode. ACPI shutdown is available from the VirtualBox GUI, or by using command
 VBoxManage controlvm "<VM name>" acpipowerbutton  

Configure the OS to respond


Not every OS in every configuration responds to an ACPI shutdown as expected. ACPI shutdown has the same effect as pushing the power button on a physical machine, so you need to look for how your server would respond to that.

Windows servers that are configured as domain controllers, are prevented from shutting down in this manner for security reasons. You can enable shutdown through registry or group policy. I prefer the last one, done with "Domain Controller Security Policy". You'll find the setting under "Local Policies - Security Options - Shutdown: Allow system to be shut down without having to log on":


For CentOS servers, you only need to install and enable the acpid package:
 yum install acpid  
 chkconfig acpid on  
 service acpid start  
Your favorite Debian/Ubuntu server needs the same package:
 sudo aptitude install acpid