Prompt the user when the power button is pressed on a VM

Bug #1769372 reported by Norbert
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gnome-control-center (Ubuntu)
Invalid
Wishlist
Unassigned
gnome-settings-daemon (Ubuntu)
Triaged
High
Unassigned

Bug Description

Steps to reproduce:
1. Install Ubuntu 18.04 LTS as VirtualBox guest
2. Login to session
3. Press ACPI Power button/key

Expected behavior:
* Ubuntu asks user about action

Actual behavior:
* Ubuntu immediately shutdowns

Note 1: Problem exists with both VirtualBox 5.1.36 and 5.2.10 (guest additions and extpack are installed and have corresponding versions). Ubuntu 16.04.4 LTS amd64 is a host.

Note 2: Problem exists if use QEMU-KVM (sudo kvm -m 1536 -drive file=/dev/sdc,format=raw) too. Sending system_powerdown from <Ctrl+Alt+2> shutdowns system without prompt.

Workaround/fix (1)

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

Workaround/fix (2)

Settings >
Power >
Suspend & Power Button >
When the Power Button is pressed = Power Off (actually does prompt the user)

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: ubuntu-desktop 1.417
ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
Uname: Linux 4.15.0-20-generic x86_64
ApportVersion: 2.20.9-0ubuntu7
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sat May 5 18:32:06 2018
InstallationDate: Installed on 2018-04-28 (7 days ago)
InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
SourcePackage: ubuntu-meta
UpgradeStatus: No upgrade log present (probably fresh install)
---
ApportVersion: 2.20.9-0ubuntu7
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
DistroRelease: Ubuntu 18.04
InstallationDate: Installed on 2018-04-28 (8 days ago)
InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
Package: gnome-settings-daemon
PackageArchitecture: amd64
ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
Tags: bionic
Uname: Linux 4.15.0-20-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
_MarkForUpload: True

Revision history for this message
Norbert (nrbrtx) wrote :
Jeremy Bícha (jbicha)
no longer affects: gnome-power-manager (Ubuntu)
no longer affects: gnome-session (Ubuntu)
no longer affects: policykit-1 (Ubuntu)
no longer affects: policykit-gnome (Ubuntu)
no longer affects: ubuntu-meta (Ubuntu)
Revision history for this message
Norbert (nrbrtx) wrote :

I posted my analysis in AskUbuntu question ( https://askubuntu.com/q/1032461/66509 ) .

Currently I can state that in terminal session aka `multi-user.target` (`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.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The default action is suspend:

    <key name="power-button-action" enum="org.gnome.settings-daemon.GsdPowerButtonActionType">
      <default>'suspend'</default>
      <summary>Power button action</summary>
      <description>The action to take when the system power button is pressed. This action is hard-coded (and the setting ignored) on virtual machines (power off) and tablets (suspend).</description>
    </key>

but you can change that in:

Settings >
Power >
Suspend & Power Button >
When the Power Button is pressed ...

Unfortunately no option exists to prompt the user. So that would be an enhancement request...

Changed in gnome-settings-daemon (Ubuntu):
status: New → Confirmed
importance: Undecided → Wishlist
summary: - Ubuntu 18.04 LTS does not ask for action when I press ACPI Power
- button/key - immediately shutdowns
+ Prompt the user when the power button is pressed
Changed in gnome-shell (Ubuntu):
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote : Re: Prompt the user when the power button is pressed

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu):
status: New → Confirmed
Changed in upower (Ubuntu):
status: New → Confirmed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Oh! The schema does support it already ("interactive"):

  <enum id="org.gnome.settings-daemon.GsdPowerButtonActionType">
    <value nick="nothing" value="0"/>
    <value nick="suspend" value="1"/>
    <value nick="hibernate" value="2"/>
    <value nick="interactive" value="3"/>
  </enum>

no longer affects: systemd (Ubuntu)
no longer affects: upower (Ubuntu)
Changed in gnome-control-center (Ubuntu):
status: New → Confirmed
importance: Undecided → Wishlist
Changed in gnome-settings-daemon (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Here's a fix :)

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

It's just not the default.

Changed in gnome-settings-daemon (Ubuntu):
status: Fix Released → Triaged
no longer affects: gnome-control-center (Ubuntu)
no longer affects: gnome-shell (Ubuntu)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

We also need a GUI enhancement to gnome-control-center to expose the setting, which already exists.

Changed in gnome-control-center (Ubuntu):
status: New → Triaged
importance: Undecided → Wishlist
description: updated
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

More weird; the GUI does contain the feature you want, but upon looking at the source code I found it is just named incorrectly:

Settings >
Power >
Suspend & Power Button >
When the Power Button is pressed = Power Off

actually prompts the user. It doesn't "Power Off".

So for now set it to "Power Off".

Changed in gnome-control-center (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
status: Triaged → In Progress
description: updated
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
Norbert (nrbrtx) wrote : Dependencies.txt

apport information

tags: added: apport-collected
description: updated
Revision history for this message
Norbert (nrbrtx) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
Norbert (nrbrtx) wrote : ProcEnviron.txt

apport information

summary: - Prompt the user when the power button is pressed
+ Prompt the user when the power button is pressed on VirtualBox guest
description: updated
Revision history for this message
Norbert (nrbrtx) wrote : Re: Prompt the user when the power button is pressed on VirtualBox guest

Dear Daniel!

Thank you for replying and for analysis.

1. On clean installation on physical hardware the behavior of Power Button is as follows:
* on console ttys system shutdowns
* on the GDM system goes to sleep (suspends)
* in GNOME session it asks what to do if run `gsettings set org.gnome.settings-daemon.plugins.power power-button-action interactive` manually (no GUI option - it is a bug 1769614 )

So seems to be expected behavior.

2. But if I run Ubuntu as VirtualBox 5.1 guest (this bug report):
* all settings are ignored (both `logind.conf` and `gsettings`).
* I do not have "When the Power Button is pressed" in `gnome-control-center power`

How to debug this? Should I report special bug to upstream?

---

You can see images on my AskUbuntu question ( https://askubuntu.com/q/1032461/66509 ).

Revision history for this message
Norbert (nrbrtx) wrote :
Revision history for this message
Norbert (nrbrtx) wrote : Re: Prompt the user when the power button is pressed on VirtualBox or QEMU-KVM guest

Note 1: Problem exists with both VirtualBox 5.1.36 and 5.2.10 (guest additions and extpack are installed and have corresponding versions). Ubuntu 16.04.4 LTS amd64 is a host.

Note 2: Problem exists if use QEMU-KVM (sudo kvm -m 1536 -drive file=/dev/sdc,format=raw) too. Sending system_powerdown from <Ctrl+Alt+2> shutdowns system without prompt.

summary: - Prompt the user when the power button is pressed on VirtualBox guest
+ Prompt the user when the power button is pressed on VirtualBox or QEMU-
+ KVM guest
description: updated
Revision history for this message
Jeremy Bícha (jbicha) wrote :

I'm closing the gnome-control-center side of this issue since I believe that it's gnome-settings-daemon that is responsible for the different behavior in virtual machines.

Changed in gnome-control-center (Ubuntu):
status: In Progress → Invalid
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Changed in gnome-control-center (Ubuntu):
status: Invalid → In Progress
summary: - Prompt the user when the power button is pressed on VirtualBox or QEMU-
- KVM guest
+ Prompt the user when the power button is pressed
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: Prompt the user when the power button is pressed

Also, the bug applies to real machines too. So I removed mention of VMs.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, as is the pattern this week, the confusion here is the intersection of two different bugs. Not one.

My gitlab merge request solves a different problem to this bug.

summary: - Prompt the user when the power button is pressed
+ Prompt the user when the power button is pressed on a VM
Changed in gnome-control-center (Ubuntu):
assignee: Daniel van Vugt (vanvugt) → nobody
status: In Progress → Invalid
Revision history for this message
Norbert (nrbrtx) wrote :

I do not understand about "confusion" and "intersection".
Will this fixed or not in Ubuntu 18.04 LTS?
Or GNOME will continue to reinvent of new unique interaction mechanisms between user and desktop?

Revision history for this message
Jeremy Bícha (jbicha) wrote :

Norbert, the upstream bug is https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/46

Once that issue is fixed in GNOME, it can be fixed in the current development release of Ubuntu and then in Ubuntu 18.04 LTS.

Comment #18 here was about something different so you can probably ignore that.

Revision history for this message
Norbert (nrbrtx) wrote :

OK, Jeremy!

Thank you! I hope to get this bug will be fixed.

Revision history for this message
Jeremy Bícha (jbicha) wrote :

I am bumping the importance of this bug based on the new test case I added to the GNOME bug today.

Changed in gnome-settings-daemon (Ubuntu):
importance: Wishlist → High
Revision history for this message
Norbert (nrbrtx) wrote :

It is absolutely expected that this bug exists in 20.04 LTS. Will not use GNOME Shell on VirtualBox.

tags: added: eoan focal groovy
Norbert (nrbrtx)
tags: added: hirsute impish
removed: eoan groovy
Revision history for this message
Alan Baghumian (alanbach) wrote :

This is also affecting Virsh (KVM/QEMU) based virtual machines. Just tested with The latest Focal update (gnome-settings-daemon 3.36.1-0ubuntu1.1) and the machine was turned off without any notifications.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.