Comment 7 for bug 1768038

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.