System shutdown directly by pressing power button and releasing immediately on Dell Vostro HW

Bug #1878351 reported by Kai-Chuan Hsieh
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OEM Priority Project
Incomplete
Medium
Kai-Chuan Hsieh
gnome-session (Ubuntu)
Triaged
Low
Unassigned
linux (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

kchsieh@kchsieh-laptop:~$ lsb_release -rd
Description: Ubuntu 20.04 LTS (fossa-bulbasaur X23)
Release: 20.04

kchsieh@kchsieh-laptop:~$ apt-cache policy systemd
systemd:
  Installed: 245.4-4ubuntu3
  Candidate: 245.4-4ubuntu3
  Version table:
 *** 245.4-4ubuntu3 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

Expect: When press the button, the endSeesionDialog should show up.
Actual: The system shutdown directly.

When the issue happend:
endSessionDialog is not triggered immediately after the first power button event, but triggered after the second power button event.
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu27
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
DistributionChannelDescriptor:
 # This is the distribution channel descriptor for the OEM CDs
 # For more information see http://wiki.ubuntu.com/DistributionChannelDescriptor
 canonical-oem-somerville-focal-amd64-20200502-85+fossa-bulbasaur+X23
DistroRelease: Ubuntu 20.04
InstallationDate: Installed on 2020-05-10 (3 days ago)
InstallationMedia: Ubuntu 20.04 "Focal" - Build amd64 LIVE Binary 20200502-05:58
MachineType: Dell Inc. Vostro 5301
Package: systemd 245.4-4ubuntu3
PackageArchitecture: amd64
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.6.0-1010-oem root=UUID=b16fea1e-d8bc-4c71-a2e6-c43d269b40de ro quiet splash vt.handoff=7
ProcVersionSignature: Ubuntu 5.6.0-1010.10-oem 5.6.8
Tags: focal
Uname: Linux 5.6.0-1010-oem x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
_MarkForUpload: True
dmi.bios.date: 04/30/2020
dmi.bios.vendor: Dell Inc.
dmi.bios.version: 0.1.12
dmi.board.vendor: Dell Inc.
dmi.chassis.type: 10
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvr0.1.12:bd04/30/2020:svnDellInc.:pnVostro5301:pvr:rvnDellInc.:rn:rvr:cvnDellInc.:ct10:cvr:
dmi.product.family: Vostro
dmi.product.name: Vostro 5301
dmi.product.sku: 09FC
dmi.sys.vendor: Dell Inc.

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :
tags: added: apport-collected focal
description: updated
Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : CurrentDmesg.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : Dependencies.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : Lspci.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : Lspci-vt.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : Lsusb.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : Lsusb-t.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : Lsusb-v.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : ProcEnviron.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : ProcModules.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : SystemdDelta.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : UdevDb.txt

apport information

Alex Tu (alextu)
tags: added: oem-priority originate-from-1878141 somerville
Changed in oem-priority:
assignee: nobody → Kai-Chuan Hsieh (kchsieh)
Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : Re: System shutdown directly by pressing power button and releasing immediately

It is quite special that one power button pressed, but systemd-logind receive two power button pressed event consecutively.

Changed in oem-priority:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in systemd (Ubuntu):
status: New → Confirmed
Revision history for this message
Balint Reczey (rbalint) wrote : Re: System shutdown directly by pressing power button and releasing immediately on Dell Vostro 5301

I'm not observing that on 2012 MacBook Air (MBA 5,2).

summary: System shutdown directly by pressing power button and releasing
- immediately
+ immediately on Dell Vostro 5301
affects: systemd (Ubuntu) → linux (Ubuntu)
Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

@Balint

Please try the below command:

1. $ acpi_listen => press power button
output: button/power PBTN 00000080 00000000

It is for getting the power button string which is PBTN

2. $ sudo acpidbg -b "notify _SB.PBTN 0x80"; sudo acpidbg -b "notify _SB.PBTN 0x80"
To simulate two consecutive power button event
It will shutdown directly on focal.

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

The shutdown is caused by the commit of https://bugzilla.gnome.org/show_bug.cgi?id=688076.

gnome-session-bin handle the first shutdown request, and change to QUERY_END_SESSION_PHASE, but the second shutdown request arrive before it open the endSessionDialog, and user not yet confirm to shutdown.

The second shutdown request is handled in QUERY_END_SESSION_PHASE, which goes to prepare shutdown by the commit mentioned above.

Therefore, I create a patch to check if the shutdown has been confirmed by the user then process the prepare shutdown. It seems can fix this issue.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch which verified OK on the platform has 2 key event with single press" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :
Changed in oem-priority:
status: Confirmed → In Progress
Revision history for this message
Sebastien Bacher (seb128) wrote :

Upstream (rightly) pointed out that the issue seems rather an hardware handling one, still the software could probably handle that better and we should review the patch but any plan to fix the doubled events problem?

Changed in gnome-session (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

I propose two commit to upstream:

1. shutdown without asking if and only if the logout mode has switched to force.
https://gitlab.gnome.org/GNOME/gnome-session/-/merge_requests/46
Rejected by the maintainer, since the implementation is too aggressive, and he thinks it is an workaround.

2. add 1s debounce for handling power key event
https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/merge_requests/180
The 1s value was provided by ODM experiment, maintainer has not reviewed yet.

Both commit can eliminate the original issue, but @khfeng found that the intel-hid wrongly handle the power button event for very long time since bionic, and he'd like to wait Intel's input.

Currently, I have no idea which approach I should go for.

Changed in oem-priority:
status: In Progress → Incomplete
Revision history for this message
Sebastien Bacher (seb128) wrote :

@Kai, ideally the kernel fix would resolve the issue, unsure which userspace workqround is better

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

@Sebastien

I doubt that kernel fix can really solve the problem. If a use press the power button twice very quickly, it perhaps to run into the same problem. I think we still have to debounce or adjust the original commit of https://bugzilla.gnome.org/show_bug.cgi?id=688076.

Recently, a lot of device implement fingerprints on power button, I am not sure if my assumption will happen on those hardwares, however, it is just my assumption, can be discussed.

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

A debounce delay just doesn't sound right.

If a user press the power button twice and the kernel dutifully reports two events, why a debounce is required when there are _actual_ two events?

If there's a race between gsd and gnome-session, proper ordering should be imposed, instead of adding a delay to workaround the race.

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

gnome-session did handle those two events, and it goes to prepare_shutdown which is current result.
If the original implementation of https://bugzilla.gnome.org/show_bug.cgi?id=688076 is correct, then it is expected result, and we accept it.

Unless the commit of https://bugzilla.gnome.org/show_bug.cgi?id=688076 need to be tweaked to adjust two quick button press.

A debounce is mentioned by the maintainer, not what my first implementation, I thought original implemention need to do some adjustment for handling the case. You can check the maintainer's comment.
https://gitlab.gnome.org/GNOME/gnome-session/-/merge_requests/46#note_836061

Revision history for this message
Sebastien Bacher (seb128) wrote :

Right, the debouncer doesn't seem ideal. I'm not convinced either by upstream reply that forcing shutdown on another press is by design, imho we should try to convince them that it is wrong

summary: System shutdown directly by pressing power button and releasing
- immediately on Dell Vostro 5301
+ immediately on Dell Vostro HW
Changed in oem-priority:
importance: High → Medium
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.