How to make Ubuntu 18.04 LTS ask for action when I press ACPI Power button/key on VirtualBox (now immediately shutdowns)?

Solution 1:

I ran a fresh upgrade on May 6, 2018 on Ubuntu 16.04 clone to 18.04 and confirmed when pressing the power button the "old" menu appears for a split second and then the machine suspends.

I checked gsettings using:

gsettings list-recursively | sed 's/  */\n/;s/  */\n/;s/\&/\&/g' | yad --list --title "gsettings" --item-seperator='\n' --width=1800 --height=800 --wrap-width=600 --column=Group --column=Key --column=Setting --no-markup

sorted by "key" and scrolled down to "power". You can confirm your settings with:

$ gsettings get org.gnome.settings-daemon.plugins.power power-button-action
'interactive'

Checking with Ubuntu 16.04 set it the same using:

$ gsettings set org.gnome.settings-daemon.plugins.power power-button-action suspend

Double check the settings:

$ gsettings get org.gnome.settings-daemon.plugins.power power-button-action
'suspend'

You don't need to reboot. Simply press the power button and now the menu will come up and stay where you can select from:

Ubuntu Power Button.gif

I borrowed this .gif from another answer I wrote. It shows how the lock screen option was missing and how to bring it back.