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.
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
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.
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.