Bug 966186 - Power button not working as expected in LXDE
Power button not working as expected in LXDE
Product: Fedora
Classification: Fedora
Component: acpid (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jaroslav Škarvada
Fedora Extras Quality Assurance
: Patch
Depends On: 894329
  Show dependency treegraph
Reported: 2013-05-22 14:06 EDT by Jan Pokorný
Modified: 2013-08-12 09:30 EDT (History)
17 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 894329
Last Closed: 2013-08-12 09:30:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
bz966186: partially fix power button not working as expected in LXDE (to be applied directly in fedpkg repo) (1.70 KB, patch)
2013-05-22 14:11 EDT, Jan Pokorný
no flags Details | Diff
seemingly more proper patch, but does not work with systemd 201 (1.91 KB, patch)
2013-05-23 07:46 EDT, Jan Pokorný
no flags Details | Diff

  None (edit)
Description Jan Pokorný 2013-05-22 14:06:27 EDT
+++ This bug was initially created as a clone of Bug #894329 +++

Original storyline:

--- Additional comment from Jan Pokorný on 2013-04-03 19:30:55 CEST ---

> In LXDE, I am used to get a "logout menu" when touching power button.
> As this bug reports, this does not happen with this setup.
> I've also tried installing and running acpid, acpi_listen shows nothing.
> It probably doesn't matter but I am running legacy mode, not UEFI.
> # lsmod | grep -e ibm -e think
> thinkpad_acpi          79427  0 
> snd                    79379  16 snd_hda_codec_realtek,snd_hwdep,snd_timer,
>                                  snd_hda_codec_hdmi,snd_pcm,snd_seq,
>                                  snd_hda_codec,snd_hda_intel,thinkpad_acpi,
>                                  snd_seq_device
> rfkill                 21736  6 cfg80211,thinkpad_acpi,bluetooth
> kernel-3.8.5-201.fc18.x86_64
> acpid-2.0.18-3.fc18.x86_64

--- Additional comment from Jan Pokorný on 2013-04-05 11:06:12 CEST ---

> No change after updating to the newest BIOS (2.53 from 2013-02-22).

--- Additional comment from Jan Pokorný on 2013-04-08 11:15:27 CEST ---

> And also no change regardless being in dockstation (and trying either
> power-off button) or not.
> Neither showkey nor acpi_listen shows anything.

--- Additional comment from Aleksandar Kostadinov on 2013-04-08 11:37:11 CEST ---

> Jan, could you try holding the power key down for a second or two? It is
> strange but *without* updating the bios it is working for me when I hold it
> down for awhile.

--- Additional comment from Jan Pokorný on 2013-05-21 19:03:23 CEST ---

> Sorry, I missed the updates (via email) on this bug as they were sorted
> to the kernel subfolder, which I do not visit very often :)
> Holding power key down for a while means power off for me (instant one,
> IIRC).  I'd like to see short press -> logout/shutdown menu as it should
> be, IMHO.

--- Additional comment from Aleksandar Kostadinov on 2013-05-22 08:42:59 CEST ---

> Jan, I meant holding for a second or two at max. Not over 4 seconds that
> usually powers the machine down.

--- Additional comment from Jan Pokorný on 2013-05-22 19:57:20 CEST ---

> Aleksandar, thanks!  You made me realize that the problem is somewhere else.
> Respective bug+fix against acpid to make it work with LXDE will follow.
> There were three things that made me misunderstand the situation:
> (1.) I am used to power button taking effect immediately after press,
>      not after holding it 1-2 sec.
> (2.) I am used to LXDE offering logout menu (as in lxsession-logout)
>      upon power button press
> (3.) I am used to longer press of power button doing "circuit level"
>      instant shutdown
> Hence I though that longer press was causing instant shutdown (3.) while
> in fact, it was doing orderly shutdown triggered by interception of ACPI
> event utilized on systemd level (logind).  But this was so fast (perhaps
> also thanks to SSD) that it realistically looked like the instant one :)
> While nothing can probably be done about (1.), I solved the (2.) point
> for myself and am about to ask to propagate my change into power.sh script
> in acpid (should be pretty neutral in other use cases) so that LXDE
> works as expected almost [*] out-of-the-box.
> [*] One has to edit one line in /etc/systemd/logind.conf to allow acpid
>     power off button fallback;  I expect such change in defaults wouldn't
>     yield much support

Based on this, I'd like to ask for considering patch that is halfway to
make power button work as expected in LXDE.  The other part is manual
(due to the reason few lines above) and comprises editing
/etc/systemd/logind.conf to set HandlePowerKey=ignore, hence to
take acpid power events into account at all.

Indeed, if there is more elegant/viable/superior solution -- only better.
Comment 1 Jan Pokorný 2013-05-22 14:11:20 EDT
Created attachment 751795 [details]
bz966186: partially fix power button not working as expected in LXDE (to be applied directly in fedpkg repo)
Comment 2 Jan Pokorný 2013-05-22 14:12:33 EDT
The patch is meant for master (rawhide?) but F18 is almost the same.
Comment 3 Jan Pokorný 2013-05-22 14:29:52 EDT
Of course, those who are used to poweroff upon power button press are
not affected as modification of logind.conf is required to switch
the behavior (I realized I am not sure what is a common expectation,
originally suspecting that it was "ask" as it is a safe choice, i.e.,
no loss of unsaved work when accidentally the button... really dunno).
Comment 4 Jan Pokorný 2013-05-23 07:46:23 EDT
Created attachment 752159 [details]
seemingly more proper patch, but does not work with systemd 201

Unfortunately, the problem with session state switching to online [1]
is back in systemd 201.  So either it should be fixed in systemd
or the grep statement in power.sh should reflect this circumstance.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=57887
Comment 5 Jaroslav Škarvada 2013-08-12 09:30:57 EDT
Sorry, this is ugly hack, I don't want to support it. Nor it doesn't work out of the box - the user needs to mod the systemd settings. If he/her can mod the settings, he/her can also install it's own acpid script.

The proper solution would be for lxde to provide it's own power manager or for users to run some power manager like xfce4-power-manager.

Note You need to log in before you can comment on or make changes to this bug.