Inactivity sleep mode on battery fails

Bug #1768038 reported by Tim Passingham
50
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Xfce4 Power Manager
Confirmed
Medium
xfce4-power-manager (Ubuntu)
Triaged
Undecided
Unassigned
xubuntu-default-settings (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I did a clean install of xubuntu bionic (formal release) on my laptop. Both / and /home were formatted first.

In all prior versions I could auto-suspend my laptop after x minutes using power manager when on battery. In 18.04 it fails with:

GDBus.Error:freedesktop.Dbus.Error AccessDenied

I tried with the lock option, and the screen was locked, but the suspend still failed.

I looked for more error information in syslog but didn't find anything.

If I can provide more information, please tell me what, and how.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: xfce4-power-manager 1.6.1-0ubuntu1
ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
Uname: Linux 4.15.0-20-generic x86_64
NonfreeKernelModules: talpa_vfshook talpa_pedconnector talpa_pedevice talpa_vcdevice talpa_core talpa_linux talpa_syscallhook
ApportVersion: 2.20.9-0ubuntu7
Architecture: amd64
CurrentDesktop: XFCE
Date: Mon Apr 30 15:04:36 2018
InstallationDate: Installed on 2018-04-27 (3 days ago)
InstallationMedia: Xubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
SourcePackage: xfce4-power-manager
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
In , Si Dedman (si-dedman) wrote :

Hi. With Xubuntu 15.10 (was same w/ 15.04) when suspend is initiated through inactivity, it fails with the quoted text: "GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied".

I've tried this [https://askubuntu.com/questions/627356/xubuntu-15-04-cannot-suspend-when-inactive] fix but it didn't help.
I suspect that this [https://bugs.launchpad.net/ubuntu/+source/xfce4-power-manager/+bug/1441460] is close but irrelevant?

Seems to fail the same when powered or on battery - I haven't noticed a difference in any case.

Any thoughts / guesses appreciated. When I come back to it and wiggle the mouse, hit the keyboard, or sometimes hit the power button, it comes back to the session login screen then returns with that failure warning. So I suspect it has been sitting there unsuspended but with the screen off.

edit: just noticed I'm using v1.4.4-4ubuntu (per software manager); given we're not on 1.5.2 is there a reason why this hasn't been upgraded as part of xubuntu 15.10? Cheers.

Revision history for this message
In , Si Dedman (si-dedman) wrote :

This is still an issue in v.1.6.0

Revision history for this message
In , Drrnrss-e (drrnrss-e) wrote :

I had this exact error in Xubuntu 16.04 and fixed it with this solution:

http://askubuntu.com/a/851760/83302

Revision history for this message
In , Fernandsaussure (fernandsaussure) wrote :

The fix in the link (http://askubuntu.com/a/851760/83302) worked for me as well on Xubuntu 16.04. Incidentally, someone on the Ubuntu-devel-discuss mailing list reported what I think is the same bug and workaround and suggested a more permanent fix: https://lists.ubuntu.com/archives/ubuntu-devel-discuss/2016-July/016779.html.

Revision history for this message
In , Erik (erik65536) wrote :

The error message "GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied" is unrelated to inactivity sleep not working. It is caused by a separate bug.

Bug: NetworkManager.Sleep access denied

The access denied error is caused by xfce4-power-manager attempting to call org.freedesktop.NetworkManager.Sleep, but access is denied by Network Manager's polkit policy. This bug could be fixed by creating a polkit rule to allow xfce4-power-manager to call the Sleep DBus message. However, a better fix would be to not call org.freedesktop.NetworkManager.Sleep at all, at least when using logind for suspend, because Network Manager automatically sleeps by using a logind suspend inhibit delay. I reported this bug on the Ubuntu bug tracker https://bugs.launchpad.net/ubuntu/+source/xfce4-power-manager/+bug/1713224.

Bug: Inactivity sleep mode on battery when hibernate is disabled

Not suspending when on battery is a separate bug. It is a duplicate of Bug 12497. It is caused by a combination of things:

* The default sleep action on AC is suspend. The default sleep action on battery is hibernate. (see xfpm_xfconf_class_init() function in xfpm-xfconf.c)
* Hibernate is disabled by default on some systems.
* In xfce4-power-manager-settings, there is a GComboBox to select the sleep mode on battery. This combo box displays only one item, suspend, because hibernate is disabled. The "inactivity-sleep-mode-on-battery" setting is only updated after the GComboBox changed signal fires. The changed signal never fires if there is only one item in the combo box, so selecting suspend does not change the sleep mode from hibernate.

To reiterate, xfce4-power-manager attempts to hibernate on an inactivity timeout even when hibernate is disabled, and you cannot switch to suspend using the settings GUI. If hibernate was enabled and suspend disabled, then a similar bug would happen during inactivity timeouts on AC.

There are a number of potential solutions to this bug.

1. In xfce4-power-manager intelligently select a default value for "inactivity-sleep-mode-on-battery" and "inactivity-sleep-mode-on-ac" when these settings are not explicitly set. The value should be based on can_suspend, auth_suspend, can_hibernate, and auth_hibernate.

2. In xfce4-power-manager, after an inactivity timeout, override "inactivity-sleep-mode-on-battery" and "inactivity-sleep-mode-on-ac" when the preferred sleep mode is not available.

3. In xfce4-power-manager-settings, change the functions xfpm_settings_on_ac() and xfpm_settings_on_battery() in xfpm-settings.c:
    gtk_combo_box_set_active (GTK_COMBO_BOX (inact_action), 0); // Change this line
    gtk_combo_box_set_active (GTK_COMBO_BOX (inact_action), -1); // To this
This will make it so if the current sleep mode is not available, the sleep mode combo box will not have an active item. When selecting the only item, the combo box changed signal will fire and the setting will be updated.

Revision history for this message
Tim Passingham (tim-8aw3u04umo) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in xfce4-power-manager (Ubuntu):
status: New → Confirmed
Changed in xfce4-power-manager:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
Tim Passingham (tim-8aw3u04umo) wrote : Re: xubuntu, clean bionic, power manager suspend fails

This bug is still present in Cosmic xubuntu, installed on 20th October.

Revision history for this message
Tim Passingham (tim-8aw3u04umo) wrote :

For laptop users, the ability to suspend after an idle period is, I would have thought, quite important.

Revision history for this message
Theo Linkspfeifer (lastonestanding) wrote :

Tim, does the workaround from your comment still work?

https://bugzilla.xfce.org/show_bug.cgi?id=12497#c1

That line could be added to the config file which is provided by Xubuntu:

https://git.launchpad.net/xubuntu-default-settings/tree/etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml

summary: - xubuntu, clean bionic, power manager suspend fails
+ Inactivity sleep mode on battery fails
Revision history for this message
Tim Passingham (tim-8aw3u04umo) wrote :

No, the old workaround doesn't work. I've failed to find any solution.

Revision history for this message
Theo Linkspfeifer (lastonestanding) wrote :

Running the power manager in debug mode could give us a hint:

$ xfce4-power-manager -q && xfce4-power-manager --no-daemon --debug

Revision history for this message
Tim Passingham (tim-8aw3u04umo) wrote :

I did this. I got the same error notification. This is the last bit of the debug output (I then killed it). It means nothing to me, but maybe it does to someone else.

TRACE[xfpm-manager.c:491] xfpm_manager_alarm_timeout_cb(): Alarm inactivity timeout id 2
TRACE[xfpm-backlight.c:132] xfpm_backlight_dim_brightness(): Current brightness level before dimming : 186, new 51
TRACE[xfpm-backlight.c:210] xfpm_backlight_reset_cb(): Alarm reset, setting level to 186
TRACE[xfpm-manager.c:491] xfpm_manager_alarm_timeout_cb(): Alarm inactivity timeout id 2
TRACE[xfpm-backlight.c:132] xfpm_backlight_dim_brightness(): Current brightness level before dimming : 186, new 51
TRACE[xfpm-backlight.c:210] xfpm_backlight_reset_cb(): Alarm reset, setting level to 186
TRACE[xfpm-manager.c:491] xfpm_manager_alarm_timeout_cb(): Alarm inactivity timeout id 2
TRACE[xfpm-backlight.c:132] xfpm_backlight_dim_brightness(): Current brightness level before dimming : 186, new 51
TRACE[xfpm-manager.c:491] xfpm_manager_alarm_timeout_cb(): Alarm inactivity timeout id 4

** (xfce4-power-manager:2379): WARNING **: 13:57:39.345: No outputs have backlight property

(xfce4-power-manager:2379): GLib-CRITICAL **: 13:57:39.917: g_variant_unref: assertion 'value != NULL' failed
TRACE[xfpm-backlight.c:210] xfpm_backlight_reset_cb(): Alarm reset, setting level to 186
^[[C^CTRACE[xfpm-main.c:68] xfpm_quit_signal(): sig 2
TRACE[xfpm-manager.c:939] xfpm_manager_stop(): Stopping
TRACE[xfpm-manager.c:266] xfpm_manager_quit(): Exiting
xfce4-power-manager-Message: 14:07:36.026: Restored brightness switch value to: 1

(xfce4-power-manager:2379): Gtk-WARNING **: 14:07:36.027: A floating object was finalized. This means that someone
called g_object_unref() on an object that had only a floating
reference; the initial floating reference is not owned by anyone
and must be removed with g_object_ref_sink().

(xfce4-power-manager:2379): GLib-CRITICAL **: 14:07:36.028: Source ID 146 was not found when attempting to remove it

Revision history for this message
Theo Linkspfeifer (lastonestanding) wrote :

Some configuration related output is printed in the beginning, so please attach the whole terminal output.

It would help to have the syslog also (journalctl -b --no-pager).

Revision history for this message
Tim Passingham (tim-8aw3u04umo) wrote :

This is the journalctl as requested

Revision history for this message
Tim Passingham (tim-8aw3u04umo) wrote :

And this is the full power-manager output

Revision history for this message
Theo Linkspfeifer (lastonestanding) wrote :

My guess would be that xfce4-power-manager still tries to hibernate the system, but that operation is not permitted. What do the following two commands return?

$ xfce4-power-manager --dump
$ xfconf-query -c xfce4-power-manager -lv

no longer affects: xubuntu-default-settings (Ubuntu)
Revision history for this message
Tim Passingham (tim-8aw3u04umo) wrote :

Here they are:

...:~$ xfce4-power-manager --dump
---------------------------------------------------
       Xfce power manager version 1.6.1
With policykit support
With network manager support
---------------------------------------------------
Can suspend: True
Can hibernate: False
Authorised to suspend: True
Authorised to hibernate: False
Authorised to shutdown: True
Has battery: True
Has brightness panel: True
Has power button: True
Has hibernate button: True
Has sleep button: True
Has LID: True
...:~$ xfconf-query -c xfce4-power-manager -lv
/xfce4-power-manager/blank-on-ac 15
/xfce4-power-manager/blank-on-battery 8
/xfce4-power-manager/brightness-switch 0
/xfce4-power-manager/brightness-switch-restore-on-exit 1
/xfce4-power-manager/critical-power-action 4
/xfce4-power-manager/critical-power-level 7
/xfce4-power-manager/dpms-enabled true
/xfce4-power-manager/dpms-on-ac-off 60
/xfce4-power-manager/dpms-on-ac-sleep 20
/xfce4-power-manager/dpms-on-battery-off 15
/xfce4-power-manager/dpms-on-battery-sleep 10
/xfce4-power-manager/inactivity-on-ac 14
/xfce4-power-manager/inactivity-on-battery 16
/xfce4-power-manager/lid-action-on-ac 0
/xfce4-power-manager/lid-action-on-battery 1
/xfce4-power-manager/lock-screen-suspend-hibernate false
/xfce4-power-manager/logind-handle-lid-switch false
/xfce4-power-manager/power-button-action 3
/xfce4-power-manager/show-panel-label 0

Revision history for this message
Theo Linkspfeifer (lastonestanding) wrote :

Did you remove the following entry?

/xfce4-power-manager/inactivity-sleep-mode-on-battery 1

Revision history for this message
Tim Passingham (tim-8aw3u04umo) wrote :

No! xubuntu/xfce4 deleted it all by itself when I logged off and then back on again (I did it twice to make sure).

I was editing the version in mu home directory .config/xfce4/xfconf/xfce-perchannel.xml. Should I be editing a system version?

Revision history for this message
Theo Linkspfeifer (lastonestanding) wrote :

You have to edit this file while not being logged into the Xfce session.

Alternatively, use the Xfce Settings Editor or run this command:

$ xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/inactivity-sleep-mode-on-battery -n -t int -s 1

Revision history for this message
Tim Passingham (tim-8aw3u04umo) wrote :

Thanks very much. That worked. Sorry I was so dim editing it in place.

Now I'll have to sort out why some things don't come back (mainly the network) on resuming - but that's a separate issue.

If someone somewhere can see their way to adding this to the standard set-up this bug report can be closed.

Revision history for this message
Theo Linkspfeifer (lastonestanding) wrote :

So, it would be best to add this entry to the Xubuntu default settings (comment #10) until the actual issue is resolved (comment #7, second part).

Revision history for this message
Tom Hutchison (hutchy68) wrote :

Try running this command>>>

$ xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/inactivity-sleep-mode-on-battery -n -t int -s 1

Then run>>>

$ xfconf-query -c xfce4-power-manager -lv

Make sure you see>>>

... /xfce4-power-manager/inactivity-sleep-mode-on-battery 1

Listed in the output

Worked for me on a fresh install of Xubuntu 18.04 and it has been tested on other laptops. Also solved 16.04 issue too.

It seems as if this statement above in one of the replies... "In xfce4-power-manager-settings, there is a GComboBox to select the sleep mode on battery. This combo box displays only one item, suspend, because hibernate is disabled. The "inactivity-sleep-mode-on-battery" setting is only updated after the GComboBox changed signal fires. The changed signal never fires if there is only one item in the combo box, so selecting suspend does not change the sleep mode from hibernate." ...is a good explanation. I tried changing the xml file in config, but that failed. Reverted back, executed the command line commands and xml file showed the proper config, magically it started working after a reboot.

I also ended up having to run>>>

$ xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/inactivity-sleep-mode-on-ac -n -t int -s 1

Which solved the issue of suspend on ac too.

Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in xubuntu-default-settings (Ubuntu):
status: New → Confirmed
Revision history for this message
Sean Davis (bluesabre) wrote :
Changed in xubuntu-default-settings (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xubuntu-default-settings - 19.04

---------------
xubuntu-default-settings (19.04) disco; urgency=medium

  * Add Terminal (F4) and Find (Primary+Shift+F) shortcuts to Thunar (LP: #1793395)
    - etc/xdg/xdg-xubuntu/Thunar/accels.scm
    - etc/xdg/xdg-xubuntu/Thunar/uca.xml.in
  * debian/xubuntu-default-settings.gsettings-override:
    - Set GNOME/GTK 3 dconf keys for fonts (LP: #1769774)
  * etc/xdg/xdg-xubuntu/autostart/xfce4-tips-autostart.desktop
    - Removed, obsolete (LP: #1805005)
  * etc/xdg/xdg-xubuntu/Thunar/uca.xml.in:
    - Enable startup-notify in Thunar's uca.xml (LP: #1794118)
  * etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml:
    - Add shortcut for xfce4-screenshooter region capture (Shift+Print) (LP: #1812234)
  * etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml:
    - Set default inactivity mode to Suspend on AC and battery (LP: #1768038)
  * etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfprint.xml
    - Removed, obsolete (LP: #1805007)
  * usr/share/xubuntu/applications/defaults.list:
    - Replace invalid macroEnabled mimetypes (LP: #1802582)
    - Remove invalid x-scheme-handler/file handler (LP: #1778069)

 -- Sean Davis <email address hidden> Mon, 28 Jan 2019 22:44:14 -0500

Changed in xubuntu-default-settings (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
nils_se (nils.se) wrote :

This worked like a charm for me:

https://www.reddit.com/r/xubuntu/comments/8w23gu/how_to_fix_the_suspend_on_inactivity/

Sorry, if already known, haven't read all links. It solved my "permission denied" problem. Maybe you can extract a fix out of this workaround. I would help, but my knowledge is pretty limited.

Sean Davis (bluesabre)
Changed in xfce4-power-manager (Ubuntu):
status: Confirmed → Triaged
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.