[SRU] xfce4-power-manager does not inhibit systemd from handling buttons and lid events

Bug #1222021 reported by Jerre Domitilli on 2013-09-07
464
This bug affects 89 people
Affects Status Importance Assigned to Milestone
xfce4-power-manager
Fix Released
Medium
xfce4-power-manager (Debian)
New
Unknown
xfce4-power-manager (Ubuntu)
Medium
Jackson Doak
Saucy
Medium
Unassigned
Trusty
Medium
Jackson Doak

Bug Description

[Impact]
High. All users with laptops are affected.
The Laptop sleeps when lid is closed, regardless of Power Manager settings. This also occurs in the Live install where Sleep is not even an option for lid closure actions.

[Test Case]
Close the lid of any laptop running xubuntu, lubuntu or ubuntu studio 13.10.
The device will go to sleep regardless of xfce4-power-manager's settings.
Please also test that upower suspend/hibernate still works.

[Regression potential]
Low. The patch has been extensively tested is Xubuntu, SUSE, Debian, and upstream.
This change doesn't affect external packages.

[Patch]
Merge lp:~noskcaj/ubuntu/saucy/xfce4-power-manager/systemd
This contains two patches and enables dh-autoreconf to force xdt-autogen to run.

[Original Bug]
Laptop sleeps when lid is closed, regardless of Power Manager settings. This also occurs in the Live install where Sleep is not even an option for lid closure actions. Confirmed in Ubuntu Studio 13.10 Beta 1 x64 and Xubuntu 13.10 Beta 1. Does not occur in Ubuntu Studio 13.04.

WORKAROUND: This can be adjusted in /etc/systemd/logind.conf. Just set HandleLidSwitch and other the events you want handled by systemd to "ignore" - you have to delete # in the beginning of the respective lines -, save, close the file, and restart.

ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: xfce4-power-manager 1.2.0-2ubuntu1
ProcVersionSignature: Ubuntu 3.11.0-2.1-lowlatency 3.11.0-rc5
Uname: Linux 3.11.0-2-lowlatency x86_64
ApportVersion: 2.12.1-0ubuntu3
Architecture: amd64
CasperVersion: 1.336
Date: Sat Sep 7 04:34:32 2013
LiveMediaBuild: Ubuntu-Studio 13.10 "Saucy Salamander" - Alpha amd64 (20130902)
MarkForUpload: True
SourcePackage: xfce4-power-manager
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

lp:~noskcaj/ubuntu/trusty/xfce4-power-manager/systemd
Daniel Holbach: Approve on 2014-01-20
lp:~noskcaj/ubuntu/saucy/xfce4-power-manager/systemd
Micah Gersten: Disapprove on 2014-01-22

This may be marked a dupe of https://bugzilla.xfce.org/show_bug.cgi?id=9326
(This could be handled in xfce4-session by calling systemd-inhibit on session start, but could be solved here by calling the dbus calls to inhibit systemd when xfce4-power-manager is actually running).

As of systemd version 190, systemd now takes over handling lid button, power and sleep buttons, etc.
This overrides xfce4-power-manager. It would be nice if xfce4 session could inhibit this on startup.

From the systemd NEWS file:

" * logind's inhibition logic has been updated. By default,
          logind will now handle the lid switch, the power and sleep
          keys all the time, even in graphical sessions. If DEs want
          to handle these events on their own they should take the new
          handle-power-key, handle-sleep-key and handle-lid-switch
          inhibitors during their runtime. A simple way to achiveve
          that is to invoke the DE wrapped in an invocation of:

          systemd-inhibit --what=handle-power-key:handle-sleep-key:handle-lid-switch ..."

See also: http://www.freedesktop.org/wiki/Software/systemd/inhibit

It may be that xfce4-power-manager should take this instead of xfce4-session... which would allow for systemd to handle things still in cases where xfce4-power-manager was not running.

Kevin,
is it maybe possible to inhibit systemd by a script snippet via xinitrc that calls startxfce4? I guess strongly this should be only a configuration issue.

(In reply to comment #1)
> Kevin,
> is it maybe possible to inhibit systemd by a script snippet via xinitrc that
> calls startxfce4? I guess strongly this should be only a configuration issue.

Yes, but this means that it inhibits it for the entire session.

So, if for example, you don't have xfce4-power-manager installed, or running, nothing at all will handle the buttons and they won't work.

It seems cleaner to me to have xfce4-power-manager do this itself, and drop the inhibit on exit.

Of course it may not be easy to implement, so short term we may want to go with a session wide inhibit in xfce4-session (thus the other bug).

I can reproduce on Manjaro (ArchLinux). The system is going into standby mode twice, when on power supply, and first to standby, then to hibernation, after woke up from standby.

$ xfconf-query -vl -c xfce4-power-manager
/xfce4-power-manager/brightness-level-on-battery 50
/xfce4-power-manager/brightness-on-ac 120
/xfce4-power-manager/brightness-on-battery 90
/xfce4-power-manager/critical-power-action 1
/xfce4-power-manager/dpms-on-ac-off 11
/xfce4-power-manager/dpms-on-ac-sleep 10
/xfce4-power-manager/hibernate-button-action 2
/xfce4-power-manager/inactivity-on-ac 20
/xfce4-power-manager/inactivity-on-battery 15
/xfce4-power-manager/lid-action-on-ac 1
/xfce4-power-manager/lid-action-on-battery 2
/xfce4-power-manager/power-button-action 3
/xfce4-power-manager/show-tray-icon 2
/xfce4-power-manager/sleep-button-action 1
/xfce4-power-manager/spin-down-on-ac true

When on battery, first to standby, then really in hibernation, after woke up from first standby (guess systemd introduces the standby).

There is "DBus server implementation for org.freedesktop.PowerManagement.Inhibit" available.

see http://git.xfce.org/xfce/xfce4-power-manager/tree/src/xfpm-inhibit.c

Maybe systemd can use that? Sorry, I am not interested in systemd's configuration or internal logic.

see also bug #9090
"inhibit warning doesn't display application name and reason"

after some discussion has taken place on the mailing lists, this here seems to be more like a feature request. There are options available for the distributions and then also for the end user to work around the unwanted doubled sleep action.

As an alternative to the inhibit option, we could think about an enhancement to the GUI. It could detect that systemd is about handling the switches on a system wide base (generally, only the root user can modify logind.conf while xfpm can have individual settings for each user). When systemd doesn't prevent power management, there should be an hint to the user about that. When the user has chosen "nothing" as the individual action, this doesn't mean systemd cares. The user could get confused in both ways, because there are two independent configurations (root and user). Automated inhibit wouldn't make that less complicated.

I suggest to add a systemd option to all those action handler lists in the settings dialogs.

For instance, there is a hint already that not enough swap space is available for hibernation. Another hint could also warn about systemd. Improving the user interface make more sense than implementing some magical code behind the possibilites of a not so experienced user.

What do you think?

My xfce4-power-manager settings explicitly say "do nothing on lid close" -- and yet my laptop started suspending since upgrade to F18.
THIS IS A BUG, NOT A FEATURE. PLEASE FIX ASAP!

(In reply to comment #8)
> My xfce4-power-manager settings explicitly say "do nothing on lid close" --
> and yet my laptop started suspending since upgrade to F18.

This can be adjusted in /etc/systemd/logind.conf. Just set HandleLidSwitch and other the events you want to handled by systemd to "ignore".

> THIS IS A BUG, NOT A FEATURE. PLEASE FIX ASAP!

From a x-p-m point of view, support for systemd is a feature.

Created attachment 4929
Don-t-allow-systemd-to-handle-suspend-hibernate-even.patch

Here is patch for inhibiting systemd to handle power/suspend/hibernate buttons
and lid-switch while xfce4-power-manager is running. It works with both systemd and SysV init systems (if there is no systemd-logind then just do nothing).

(In reply to comment #10)
> Created attachment 4929 [details]
> Don-t-allow-systemd-to-handle-suspend-hibernate-even.patch
>
> Here is patch for inhibiting systemd to handle power/suspend/hibernate
> buttons
> and lid-switch while xfce4-power-manager is running. It works with both
> systemd and SysV init systems (if there is no systemd-logind then just do
> nothing).

Patch works fine here for me. :)

In , God12 (god12) wrote :

I think instead of unconditional inhibition user got to have a choice in GUI whether to use systemd settings (this should gray-out x-p-m settings) or override them.

description: updated
description: updated
Launchpad Janitor (janitor) wrote :

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

Changed in xfce4-power-manager (Ubuntu):
status: New → Confirmed
Jackson Doak (noskcaj) wrote :

This affects me too, on xubuntu. I think this is a duplicate though

tags: added: needs-duplicate-check
description: updated
Martin Pitt (pitti) wrote :

This is the XFCE equivalent of bug 1180513 (GNOME).

M4he (mahe) wrote :

Temporary workaround is to set:

HandleLidSwitch=ignore

in /etc/systemd/logind.conf

However I now disabled xfce4-power-manager and let logind do the sleep, because it seems to go into suspend much faster (< 1 sec) than with xfce4-power-manager (~4 secs) on my MacBook Air.

Martin Pitt (pitti) wrote :

Linking the Debian bug. This points to some patches for this.

Changed in xfce4-power-manager (Debian):
status: Unknown → New

(In reply to god12 from comment #12)
> I think instead of unconditional inhibition user got to have a choice in GUI
> whether to use systemd settings (this should gray-out x-p-m settings) or
> override them.

As far as I understand it, there's also the possibility to only delay the suspend from systemd, in order for xfpm to do something (for example locking the screen). That's what Gnome is doing right now, afaict.

summary: - Laptop sleeps when lid is closed, regardless of Power Manager Settings.
+ xfce4-power-manager does not inhibit systemd from handling buttons and
+ lid events

Confirming here on a fresh Xubuntu 13.10 AMD64 install.
Hardware is Asus n55sf laptop.

The event tested is: during active xfce session, press power button.
Expected: a popup asks what to do (suspend, logout, power off, etc.).
Observed: no question asked, immediate shutdown procedure.

12.10 had expected good behavior.
13.10 has observed bad behavior.

bryan hains (bryan-hains) wrote :

Since there is no /etc/systemd/logind.conf in lubuntu, is there an alternate workaround?
Thanks guys.

Changed in xfce4-power-manager (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
Jackson Doak (noskcaj) wrote :

Adding the PPA at https://launchpad.net/~noskcaj/+archive/power-manager-systemd should fix this. It uses the patches from openSUSE. It's still a work in progress as the current patches break autoreconf

I have installed the patched version provided by your PPA. Xfce Power Manager now prevents systemd from shutting down immediately and lets me interact with the shutdown dialog after the power button has been pressed.

Elfy (elfy) wrote :

Installed from PPA.

Pressing power button still powers down the machine.

Simon Steinbeiß (ochosi) wrote :

I also tested the PPA and can confirm that it
1) makes the lid-events behave as expected from powermanager-settings and
2) inhibits logind from taking over the power-button.

So all is configurable again via the powermanager, as it used to be.

Sergio Benjamim (sergio-br2) wrote :

It's working here too, like ochosi says.

description: updated
tags: added: trusty
removed: needs-duplicate-check
tags: added: xubuntu
Alf Haakon Lund (alf-c) wrote :

Ubuntu Studio 13.10 on Toshiba Sattellite p850.

The workaround doesn't work for me. Even editing /etc/systemd/logind.conf to have

#HandlePowerKey=ignore
#HandleSuspendKey=ignore
#HandleHibernateKey=ignore
#HandleLidSwitch=ignore

has no effect. Hitting power buttons means immediate shutdown. By the way my machine haven't got suspend or hibernate buttons, it's only the power button.

Tried to compare with same file in my working Ubuntu Studio 12.10 on the same machine, but I can't find a logind.conf at the expected location.

Is it safe to rename this file (in 13.10) and try to run without it?

Alf Haakon Lund (alf-c) wrote :

Of course I forgot I have to uncomment.

Changing #HandlePowerKey=poweroff to

    HandlePowerKey=ignore

works.

Sorry.

Torsten Bronger (bronger) wrote :

Well, the workaround in /etc/systemd/logind.conf did indeed prevent the system from going into hibernate when I close the lid. This is some improvement, but it still does not lock the screen. When I open the lid, the system is unlocked, although I said otherwise in Lubuntu's power management settings.

Jarno Suni (jarnos) wrote :

Torsten Bronger, xfce4-power-manager normally uses xflock4 to lock, but that is not available in Lubuntu, where there is lxlock, instead. If I remember right, the power manager also supports a running xscreensaver or gnome-screensaver, if xflock4 is not available. Can you test it and maybe report a separate bug report about this issue by "ubuntu-bug xfce4-power-manager"?

Torsten Bronger (bronger) wrote :

Thanks Jarno for your explanations, but I don't know how to tell the power management to call xscreensaver or gnome-screensaver. Besides, this is a regression. I used to work out-of-the-box up to Ubuntu 13.04.

Jarno Suni (jarnos) wrote :

Torsten, besides telling the power manager to "Lock screen when going for suspend/hibernate" in its settings, you have to install xscreensaver package, add "xscreensaver -nosplash" as an autostarted application in LXDE settings. (You can test, if autostart worked by running command "pidof xscreensaver" in terminal after logging in: it displays a number, if xscreensaver is running.)

If you additionally want lxlock to be able to use xscreensaver (and to fix Bug #1205384) , you could do this in terminal (as superuser):
sudo wget --output-document=/usr/local/bin/lxlock http://bug-attachment.xfce.org/attachment.cgi?id=5295 && sudo chmod a+x /usr/local/bin/lxlock
If you later want to revert back to official lxlock, just delete the downloaded file /usr/local/bin/lxlock

Jarno Suni (jarnos) on 2014-01-06
description: updated
Jarno Suni (jarnos) wrote :

Torsten, you could also view the downloaded script to get idea of alternative lockers, if you don't want to use xscreensaver. I think xfce4-power-manger works with all those alternatives, if you trick it to find xflock4, which is counterpart of lxlock in Xfce:

sudo ln -s -T /usr/local/bin/lxlock /usr/local/bin/xflock4

(Maybe you don't need to do it, if you have xfce4-session installed; then the power manager uses /usr/bin/xflock4 that comes with the package.)

Jackson Doak (noskcaj) on 2014-01-19
Changed in xfce4-power-manager (Ubuntu):
status: Triaged → In Progress
assignee: nobody → Jackson Doak (noskcaj)
Jackson Doak (noskcaj) on 2014-01-20
Changed in xfce4-power-manager (Ubuntu Saucy):
importance: Undecided → High
status: New → Triaged
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xfce4-power-manager - 1.2.0-3ubuntu2

---------------
xfce4-power-manager (1.2.0-3ubuntu2) trusty; urgency=medium

  * Add patches from debian svn branch to fix systemd. LP: #1222021
  * Force run of xdt-autogen to continue to allow ppc64el to build
 -- Jackson Doak <email address hidden> Mon, 20 Jan 2014 07:04:09 +1100

Changed in xfce4-power-manager (Ubuntu Trusty):
status: In Progress → Fix Released
Goren (g0ren) wrote :

Will it be also backported to 13.10?

Yes. Probably this weekend i'll start on the SRU. I just want to be sure
it's fully stable first

On Tue, Jan 21, 2014 at 11:17 AM, Goren <email address hidden> wrote:

> Will it be also backported to 13.10?
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1222021
>
> Title:
> xfce4-power-manager does not inhibit systemd from handling buttons and
> lid events
>
> Status in Xfce4 Power Manager:
> Unknown
> Status in “xfce4-power-manager” package in Ubuntu:
> Fix Released
> Status in “xfce4-power-manager” source package in Saucy:
> Triaged
> Status in “xfce4-power-manager” source package in Trusty:
> Fix Released
> Status in “xfce4-power-manager” package in Debian:
> New
>
> Bug description:
> Laptop sleeps when lid is closed, regardless of Power Manager
> settings. This also occurs in the Live install where Sleep is not even
> an option for lid closure actions. Confirmed in Ubuntu Studio 13.10
> Beta 1 x64 and Xubuntu 13.10 Beta 1. Does not occur in Ubuntu Studio
> 13.04.
>
> WORKAROUND: This can be adjusted in /etc/systemd/logind.conf. Just set
> HandleLidSwitch and other the events you want handled by systemd to
> "ignore" - you have to delete # in the beginning of the respective
> lines -, save, close the file, and restart.
>
> ProblemType: Bug
> DistroRelease: Ubuntu 13.10
> Package: xfce4-power-manager 1.2.0-2ubuntu1
> ProcVersionSignature: Ubuntu 3.11.0-2.1-lowlatency 3.11.0-rc5
> Uname: Linux 3.11.0-2-lowlatency x86_64
> ApportVersion: 2.12.1-0ubuntu3
> Architecture: amd64
> CasperVersion: 1.336
> Date: Sat Sep 7 04:34:32 2013
> LiveMediaBuild: Ubuntu-Studio 13.10 "Saucy Salamander" - Alpha amd64
> (20130902)
> MarkForUpload: True
> SourcePackage: xfce4-power-manager
> UpgradeStatus: No upgrade log present (probably fresh install)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/xfce4-power-manager/+bug/1222021/+subscriptions
>

Jackson Doak (noskcaj) on 2014-01-21
Changed in xfce4-power-manager (Ubuntu Saucy):
assignee: nobody → Jackson Doak (noskcaj)
status: Triaged → In Progress
summary: - xfce4-power-manager does not inhibit systemd from handling buttons and
- lid events
+ [SRU] xfce4-power-manager does not inhibit systemd from handling buttons
+ and lid events
Jackson Doak (noskcaj) on 2014-01-21
description: updated
Jackson Doak (noskcaj) on 2014-01-22
description: updated
Changed in xfce4-power-manager:
importance: Unknown → Medium
Micah Gersten (micahg) wrote :

This is the debian dir diff from the branch that Jackson attached. Jackson gave me the DEP-3 headers for the 06_add-shutdown-reboot-functionality-for-systemd.patch after I asked for them. I'm going ahead and uploading since it builds fine.

Changed in xfce4-power-manager (Ubuntu Saucy):
assignee: Jackson Doak (noskcaj) → Micah Gersten (micahg)
Micah Gersten (micahg) on 2014-01-22
Changed in xfce4-power-manager (Ubuntu Saucy):
assignee: Micah Gersten (micahg) → nobody
status: In Progress → Triaged
status: Triaged → Fix Committed
Changed in xfce4-power-manager (Ubuntu Saucy):
importance: High → Medium

Hello Jerre, or anyone else affected,

Accepted xfce4-power-manager into saucy-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/xfce4-power-manager/1.2.0-2ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed
Dmitry Shachnev (mitya57) wrote :

No more to do for ubuntu-sponsors here, unsubscribing.

Casey Marshall (cmars) wrote :

I'm running 13.10 and familiar with the issue, though I've mostly ignored it. This package from proposed fixed it for me today. I've got suspend-on-close for battery power, lock-screen-on-close for AC. Nice work!

Casey Marshall (cmars) wrote :

Oh, and these are the package versions I upgraded to & tested:

ii xfce4-power-manager 1.2.0-2ubuntu1.1 amd64 power manager for Xfce desktop
ii xfce4-power-manager-data 1.2.0-2ubuntu1.1 all power manager for Xfce desktop, arch-indep files

tags: added: verification-done
removed: verification-needed
Jackson Doak (noskcaj) wrote :

Thanks for testing Casey. This should get move to release fairly soon.

Jeremy Tang (shockdude) wrote :

Installed xfce4-power-manager 1.2.0-2ubuntu1.1 and xfce4-power-manager 1.2.0-2ubuntu1.1 from saucy-proposed, on Xubuntu 13.10 32bit. Closing the lid now behaves correctly!

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xfce4-power-manager - 1.2.0-2ubuntu1.1

---------------
xfce4-power-manager (1.2.0-2ubuntu1.1) saucy; urgency=medium

  * Add patches from debian svn branch to fix systemd. LP: #1222021
  * Run dh-autoreconf to continue to allow arm64 to build
 -- Jackson Doak <email address hidden> Wed, 22 Jan 2014 10:34:16 +1100

Changed in xfce4-power-manager (Ubuntu Saucy):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for xfce4-power-manager has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Uwe Geuder (ubuntulp-ugeuder) wrote :

After installing update xfce4-power-manager (1.2.0-2ubuntu1.1) my screen brightness control is broken. (Well, I installed several updates, but this one seems to be the most likely culprit to me). I'll try to downgrade the package again to verify my suspicion. Right now I'm running on battery, so I don't want to try it immediately.

If turns out to be a regression, do you prefer to handle it here in the same report or in a new one? (Yes, I am aware of apport-collect)

Uwe Geuder (ubuntulp-ugeuder) wrote :

Hmm, downgraded xfce-power-manager to the previously installed version, didn't help. Same exercise for gnome-settings-manager (which updated at the same time), did not help. Well, because downgrading did not help, I upgraded both of them to the current version again. Result: everything works fine. No clue what was going on there.

Sorry about the noise.

Scaramanga (scaramanga) wrote :

I just upgraded to Xubuntu 14.04 from 13.10. This issue is still not fixed. My laptop goes into hibernation or sleep when I close the lid. In Power Manager the action for closing the lid is set to 'lock screen' both for battery and AC powering. I have restarted after changes and tried multiple times.

The workaround mentioned in the bug description still works fully.

Kevin Otte (nivex) wrote :

Scaramanga: Did you file a new bug and tag it as a regression per comment 32? I am also seeing this behavior but didn't want to duplicate the report.

This bug has been fixed in git master.

Changed in xfce4-power-manager:
status: Unknown → Fix Released
Spatialist (fsluiter) wrote :

I had the same issue:
 - close the lid of my ubuntu 14.04 laptop
 - laptop goes in suspend
 - wake up to a black screen (reboot or console and kill x to get desktop back)

 fiddled around with powertools and no luck.
 BUT:
 Light locker (screensaver) settings where also set to start a screen saver etc.
 ===Disabled light locker and now===
 Close lid->suspend->open lid->wakeup is working!

 So check if multiple screen savers/powertools are interfering...

Jeremy Gabriel (arabian-gabe) wrote :

I am running Xubuntu 14.04 and have this issue, though I'm more concerned with the fact that my computer goes to sleep after a period of inactivity despite having both A/C and battery set to "Never" in the Power Manager. The workaround I use is a script that I added to the Application Autostart list:

xset s off
xset dpms 0 0 0
xset -dpms s off

I realize there is a bit of redundancy in using those three commands but I have tried different combinations and found using all three to be the only successful method.

An interesting thing to note is that everytime I update Xubuntu base I have to remove the command from the Autostart list and then add it again (unchecking and then checking the box does not work for me).

Hope this helps,
Jeremy

David Oftedal (rounin) wrote :

I'm still seeing this bug on 14.10.

I'm trying the logind.conf workaround.

David Oftedal (rounin) wrote :

I have xfce4-power-manager 1.4.1-0ubuntu1.

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

Other bug subscribers

Related blueprints

Remote bug watches

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