I try to backup an Ubuntu VirtualBox guest. VirtualBox save state is not a solution, because it's VirtualBox version dependent. So I need to do an ACPI shudown (with VirtualBox acpipowerbutton). The problem is that, the ACPI shutdown for Ubuntu seems to work if no user session exists or user session is not locked.
What I have done so far is writing a (Windows cmd) script to acpi shutdown (acpipowerbutton) VirtualBox the Linux guests (Ubuntu and MINT). Works perfect, but not with locked guest system user sessions.
Again: ACPI for unlocked sessions works already. But not for locked sessions. systemctl status acpid.service tells me 'active (running)'. So I think the ACPI service itself is existing and working but needs to be configured?
Is there a way to change settings within Ubuntu to allow an ACPI shutdown for locked sessions?
Or maybe is there any "force" option in VirtualBox to do an ACPI shutdown for locked Ubuntu guests?
21 Answer
You will likely need to install the acpid service to accomplish this goal. Here are the full set of steps to follow:
Open a Terminal (if not already open)
Install the
acpidservice:$ sudo apt install acpidConfigure
acpidto run a script calleddoevents.shon events:$ sudo echo -e 'event=.*\naction=/etc/acpi/doevents.sh %e' > /etc/acpi/events/anythingNote: The file name can be anything. If you'd rather use something other than
doevents.sh, feel free to substitute it.Create the
doevents.shfile:$ sudo echo -e '#!/bin/bash\n\ncase "$1" in\nbutton/power)\ncase "$2" in\nPBTN) shutdown -h now ;;\nesac\nesac\n' > /etc/acpi/doevents.sh $ sudo chmod +x /etc/acpi/doevents.shRestart the
acpidservice:sudo systemctl restart acpid.serviceSimulate a power-button press on the VM. It should gracefully shut down.
Hope this solves your problem 👍🏻
2