Bug 966186

Summary: Power button not working as expected in LXDE
Product: [Fedora] Fedora Reporter: Jan Pokorný [poki] <jpokorny>
Component: acpidAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: akostadi, extras-orphan, gansalmon, itamar, johannbg, jonathan, jpokorny, jskarvad, lnykryn, madhu.chinakonda, msekleta, notting, plautrba, systemd-maint, ted, vpavlin, zbyszek
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 894329 Environment:
Last Closed: 2013-08-12 13:30:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 894329    
Bug Blocks:    
Attachments:
Description Flags
bz966186: partially fix power button not working as expected in LXDE (to be applied directly in fedpkg repo)
none
seemingly more proper patch, but does not work with systemd 201 none

Description Jan Pokorný [poki] 2013-05-22 18:06:27 UTC
+++ 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ý [poki] 2013-05-22 18:11:20 UTC
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ý [poki] 2013-05-22 18:12:33 UTC
The patch is meant for master (rawhide?) but F18 is almost the same.

Comment 3 Jan Pokorný [poki] 2013-05-22 18:29:52 UTC
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ý [poki] 2013-05-23 11:46:23 UTC
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 13:30:57 UTC
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.