I rewrite this question to be clear. I have problems only on VirtualBox.
1. Physical hardware
If press Power Button on physical hardware:
- on console ttys system shutdowns
- on the GDM system goes to sleep (suspends)
- in GNOME session it goes to suspend
If I manually run
gsettings set org.gnome.settings-daemon.plugins.power power-button-action interactive GNOME asks me what to do.
The system will power off automatically in 60 seconds
Cancel | Restart | Power Off
It is expected behavior.
But currently there is no such option in GUI (
gnome-control-center power), request for enhancement was filed as bug 1769614 :
2. VirtualBox guest
I have ordinary Ubuntu 18.04 LTS installed as VirtualBox guest ( ! ! ! ).
When I press RightCtrl+H (or Machine->ACPI Shutdown) to initiate reaction on ACPI Power Button press it shutdowns immediately.
I expect that Ubuntu 18.04 LTS with default desktop would ask me about action on pressing power button as Ubuntu 16.04 LTS do:
or as Ubuntu MATE 18.04 LTS do:
I did some investigations with no positive results.
System journal reports that
systemd-logind may handle ACPI Power key.
Its settings are default:
$ cat /etc/systemd/logind.conf | grep -i power #HandlePowerKey=poweroff #PowerKeyIgnoreInhibited=no
I have set GNOME to use interactive reaction on Power button:
$ gsettings list-recursively | grep -i power | grep -i button org.gnome.settings-daemon.plugins.power button-power 'interactive' org.gnome.settings-daemon.plugins.power power-button-action 'interactive'
Once more interesting thing that I do not have When the Power Button is pressed in VM (it is bug 1769623):
HandlePowerKey=ignore in /etc/systemd/logind.conf does not help:
sudo sed -i "s/#HandlePowerKey=poweroff/HandlePowerKey=ignore/" /etc/systemd/logind.conf
so I set it back
sudo sed -i "s/HandlePowerKey=ignore/#HandlePowerKey=poweroff/" /etc/systemd/logind.conf
So I reported bug 1769372 to LaunchPad.
Note: in terminal session aka
systemctl isolate multi-user.target) all variables from /etc/systemd/logind.conf are sourced normally. So the problem is with GNOME session (
systemctl isolate graphical.target) in
gnome-settings-daemon or something other.
How to stop such behavior in VM?
Does anyone have the same problem in VM or real hardware?
<RightCtrl+H>MATE asks, GNOME shutdowns quietly.