9

I'm always wondering if power management facilities in a virtual machine is necessary?

i.e acpid.

And I'm not sure if they still function in a virtual machine.

3 Answers 3

9

Strictly speaking, no you don't need acpid in a virtual machine nor on a real system. But you should install acpid in a VM as it typically handles the power button press which is simulated by the hypervisor if you shutdown a VM.

So for practically reasons, yes you should install acpid on a VM.

P.S: acpid doesn't really do power management

1
  • 2
    This can be really annoying. As it's not part of Windows' genome (at least the earlier versions) to behave well in a VM I one installed W2K or XP in a VM without ACPI (it's no fun on the Windows part to change that later). The result was that the VM used up a whole CPU core while saying: "You may turn the computer off now". Commented Apr 27, 2013 at 9:47
6

I would leave it. I believe ACPI does more than just power management. For example I believe there is a ACPI event that is sent in via the VM Host to the guests when you want them to shutdown or reboot.

Excerpt from Manual:KVM:

shut-down

issue ACPI shut-down command to KVM guest, if guest does not support ACPI, command have no effect.

reboot

issue ACPI shut-down command to KVM guest, if guest does not support ACPI, command have no effect. After KVM guest is shut-downed it will be automatically started by host when shut down is complete.

References

1

It seems that on modern systems acpid is not necessary to cleanly shutdown or reboot a virtual machine, even when the hypervisor uses ACPI. The kernel exports the power button as a input device (in /dev/input):

$ sudo journalctl -b 0 | grep Power
kernel: input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
...
systemd-logind[451]: Watching system buttons on /dev/input/event0 (Power Button)

This button press in turn is handled by systemd-logind in logind-button.c.

This works for me with virsh shutdown and virsh reboot, in both cases I can see from the log that the server cleanly shut down

systemd-logind[535]: Power key pressed.
systemd-logind[535]: Powering Off...
systemd-logind[535]: System is powering down.

You must log in to answer this question.

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