Created attachment 6681 Handle screensaver activity with it's own class So I had this idea to make screensaver support with xfpm and xfsm a bit easier and standardized. Since most of the big screensaver daemons (kde, gnome, mate, cinnamon, lightlocker, etc) expose a dbus interface I now have xfpm try to use it for locking in addition to inhibit. If the screensaver doesn't have a dbus interface, things will continue to work via the heartbeat-command (for inhibit support) and the LockCommand (for locking) the same as things currently work. Now if you run xscreensaver for example and didn't set the heartbeat or lock commands, you won't get the inhibit support, but it will try to launch xdg-screensaver, then xflock4, and finally it will attempt to call xscreensaver so things still work.
Pushed to master in: commit 9e70d2e4aa8b9287a4d06d35010a01ba3bebd857 Author: Eric Koegel <eric.koegel@gmail.com> Date: Fri May 27 15:45:13 2016 +0300 Handle screensaver activity with it's own class (Bug #12603) Move the screensaver inhibit, heartbeat, and lock code to its own set of files we can easily share with xfce4-session. Use the screensaver's dbus API if it supports it for inhibit and lock calls. Otherwise, use the heartbeat-command and LockCommand from xfpm and xfsm if available. Finally, for the lock function, fallback to trying xdg-screensaver, xflock4, and xscreensaver-command in that order. http://git.xfce.org/xfce/xfce4-power-manager/commit/?id=9e70d2e4aa8b9287a4d06d35010a01ba3bebd857
It seems that this patch breaks xfce-session-logout or so it appears .. as it only now does logout or shutdown no matter which button is pushed .. git version compiled may 26, 2016 worked properly, may 31, 2016 has this issue ..
also xfce4-power-manager also appears to have hibernation and sleep operation failures as well .. same time frame
qdbusviewer shows xfce4-powermanager as having only quit and restart active as dbus rules
direct commands to consolekit via dbusviewer give normal suspend function as do direct calls to pm-suspend calling xfce-session-logout --hibernate (or sleep) via commandline results in immediate logout .. as do using the logout menu/buttons somewhere the logic is failing any idea where this might be?
reverting to xfce4-power-manager-1.6.0 returns normal suspend and hibernate functions to power manager.. this drops this patch effectively .. qdbusviewer still only shows restart and quit functions under xfce4-power-manager but the communication with consolekit (version2) works again Also git version of xfce4-power-manager randomly stops running .. fyi
turning off the screenlocker in the session manager(git version) allows proper suspend and hibernate to function .. i'm using slock as my active screen locker with a patch to xflock4 (gentoo) to activate it .. I'll try to remove the patch and see if things work
Ah! when the screenlocker is activated for sleep xfce4-power-manager crashes on attempting to suspend/hibernate .. also xfce-session-logout via menu allows hibernate and suspend to work when screenlocker is not selected .. but
still crashes so the gentoo xflock4 patch has no-effect on the instability when the screenlocker is activated
sorry the last comment was not clear .. by crashes .. the session is ended force-ably instead of suspending or hibernating .. or so it appears .. this is in /var/log/messages kernel: traps: xfce4-session[5682] trap int3 ip:7f434d4b192b sp:7fff586b2a10 error:0 Jun 3 14:02:13 zlink1 kernel: traps: ck-remove-direc[7947] trap int3 ip:7f0ab3eb192b sp:7ffe7748d590 error:0 Jun 3 14:02:13 zlink1 polkitd[1172]: Unregistered Authentication Agent for unix-session:/org/freedesktop/ConsoleKit/Session6 (system bus name :1.73, object path /org/gnome/PolicyKit1/AuthenticationAgent, locale en_US.utf8) (disconnected from bus) j
If xfpm or xfsm is crashing because of the patch, can you get a backtrace? https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces What patch are you using for xflock4? Hopefully I can find a way to reproduce it.
Created attachment 6692 xflock4.patch adding alock support removed this temporarily from gentoo xfce4-session.ebuild
Created attachment 6693 xfce4-session-logout backtraces compiled xfce4-session, xfce4-power-manager, slock with split debug info also activated core files ran in terminal gdb -q xfce4-session-logout --suspend twice once with screenlocking off second time with screenlocking on also attaching core dump
cancel core dump attachment as it is too big 34mb correct command used was gdb -q xfce4-session-logout .. that shows the menu .. then suspend was selected .. and we crash checked core dump but we only crashed again .. not helpful will try xfpm next ..
i am not getting useful info trying to use gdb .. with xfce4-power-manager trying to run from the command line and not getting very far is there a trick to starting xfce4-power-manager under gdb with arguments .. as gdb complains when I try to add --nodaemon --nodebug
running xfce-power-manager --nodaemon --debug .. ending fragment (xfce4-power-manager:13794): xfce4-power-manager-WARNING **: Unable to set the kernel brightness switch parameter to 0. TRACE[xfpm-backlight.c:258] xfpm_backlight_brightness_on_ac_settings_changed(): Alarm on ac timeout changed 9 TRACE[xfpm-backlight.c:279] xfpm_backlight_brightness_on_battery_settings_changed(): Alarm on battery timeout changed 120 (xfce4-power-manager:13794): xfce4-power-manager-WARNING **: Failed to get keyboard max brightness level : GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.UPower.KbdBacklight' on object at path /org/freedesktop/UPower/KbdBacklight TRACE[xfpm-polkit.c:244] xfpm_polkit_free_data(): Destroying Polkit data TRACE[xfpm-manager.c:440] xfpm_manager_lid_changed_cb(): LID close event: ((XfpmLidTriggerAction) LID_TRIGGER_LOCK_SCREEN) (xfce4-power-manager:13794): xfce4-power-manager-ERROR **: Screensaver lock command not set when attempting to lock the screen. Please set the xfconf property /general/LockCommand in xfce4-session to the desired lock command Trace/breakpoint trap (core dumped) .. perhaps a clue .. slock is not being set in xfconf prior to laptop lid closure .. how is this done in xfce4-session???
ok figured it out .. using the settings editor I set the session lockcomand to slock .. then everything works normally .. now is this required now or did something get missed in the detection of the available screen lockers?
so there should be an error trap of some sort if no lockcommand is set or detected .. either in xfce4-session or/and xfce4-power-manager and the "lock before sleep" is selected in either program ..
Created attachment 6694 Fix a crash when warning about the screenlocker oh, for the core dump, just typing bt after it crashes or after loading the core file like "gdb xfce4-power-manager core" but looks like you've narrowed things down, thanks. The xfconf property is new and not required but the hope is that you can use it rather than hacking at xflock4. But if you don't set it, there's a warning to let you know that there you can use it now... which looks like I made it a g_error on accident which causes gtk to abort the program. Can you try this patch in xfce4-power-manager? I'll push the same fix to session if it works.
ok tested by removing lockcommand from xfce4-session via xfce4-settings-editor then stopping the running version of xfce4-power-manager --quit then restarting with --nodaemon --debug flags via terminal .. absence of the lock command setting no-longer crashes xfce4-power-manager and suspend works properly .. but of course no lock screen .. there is no dialog popped up about this which might be useful somewhere .. perhaps with and entry line? for and easy setting .. just a thought .. perhaps xfce4-session manager would be a better place for that? of course resetting lockcommand causes locker to work :)
oh right, so now it doesn't crash you'd be back to either needing the lockcommand or your patched xflock to call slock since it will fallback to trying xflock again (it was happening after the warning message). And yeah, next steps would be to expose or document it better.
actually xflock4 does not seem to be called so the xfce4-session lockcommand setting only works fyi so slock is not triggered
(xfce4-power-manager:6298): xfce4-power-manager-WARNING **: Failed to get keyboard max brightness level : GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.UPower.KbdBacklight' on object at path /org/freedesktop/UPower/KbdBacklight TRACE[xfpm-manager.c:440] xfpm_manager_lid_changed_cb(): LID close event: ((XfpmLidTriggerAction) LID_TRIGGER_SUSPEND) (xfce4-power-manager:6298): xfce4-power-manager-WARNING **: Screensaver lock command not set when attempting to lock the screen. Please set the xfconf property /general/LockCommand in xfce4-session to the desired lock command ERROR: Unknown command 'lock' TRACE[xfpm-manager.c:473] xfpm_manager_lid_changed_cb(): LID opened: ((XfpmLidTriggerAction) LID_TRIGGER_SUSPEND) TRACE[xfpm-dpms.c:284] xfpm_dpms_force_level(): start TRACE[xfpm-dpms.c:316] xfpm_dpms_force_level(): No need to change DPMS mode, current_level=0 requested_level=0 this is the message stuff received w/ patch in place .. which only adds alock to the list .. so xfce4-session standard has slock in the xflock4 .. script by default .. lockcommand not set .. so slock is in place but the script does not seem to run .. added an "echo $lock_cmd" just before call to slock and ran xflock4 manually: xflock4 xlock -mode blank slock same as above with modified xflock4 TRACE[xfpm-manager.c:473] xfpm_manager_lid_changed_cb(): LID opened: ((XfpmLidTriggerAction) LID_TRIGGER_SUSPEND) TRACE[xfpm-dpms.c:284] xfpm_dpms_force_level(): start TRACE[xfpm-dpms.c:316] xfpm_dpms_force_level(): No need to change DPMS mode, current_level=0 requested_level=0 TRACE[xfpm-polkit.c:244] xfpm_polkit_free_data(): Destroying Polkit data .... modified xflock4 .. here TRACE[xfpm-manager.c:440] xfpm_manager_lid_changed_cb(): LID close event: ((XfpmLidTriggerAction) LID_TRIGGER_SUSPEND) (xfce4-power-manager:6298): xfce4-power-manager-WARNING **: Screensaver lock command not set when attempting to lock the screen. Please set the xfconf property /general/LockCommand in xfce4-session to the desired lock command ERROR: Unknown command 'lock' TRACE[xfpm-manager.c:473] xfpm_manager_lid_changed_cb(): LID opened: ((XfpmLidTriggerAction) LID_TRIGGER_SUSPEND) TRACE[xfpm-dpms.c:284] xfpm_dpms_force_level(): start TRACE[xfpm-dpms.c:316] xfpm_dpms_force_level(): No need to change DPMS mode, current_level=0 requested_level=0 or do I need a different command for it to show?
Created attachment 6696 When locking fallback to xflock4 first Hey, yeah it's probably because it's trying xdg-screensaver first, can you try this patch as well? Thanks.
which source does this get applied to?
oops goes on xfce4-power-manager ... but xfce4-session .. needs something similar as well as it does not activate slock yet ..
yeah the patch works for just xfce4-power-manager ..
Pushed the following fixes to xfpm: commit 7e8574c188893eb2a73cf9d51765822089010dd5 Author: Eric Koegel <eric.koegel@gmail.com> Date: Sun Jun 5 16:10:46 2016 +0300 When locking fallback to xflock4 first (Bug #12603) While it would be nice to use the xdg-screensaver first since it is the standard, it breaks the existing workflow for users who have custom patches in xflock4 so switch back to the previous fallback order. http://git.xfce.org/xfce/xfce4-power-manager/commit/?id=7e8574c188893eb2a73cf9d51765822089010dd5 commit 24bcf752e51c2762d40a7611caff399c2f0556aa Author: Eric Koegel <eric.koegel@gmail.com> Date: Sat Jun 4 17:44:10 2016 +0300 Fix a crash when warning about the screenlocker (Bug #12603) http://git.xfce.org/xfce/xfce4-power-manager/commit/?id=24bcf752e51c2762d40a7611caff399c2f0556aa And the same to xfsm: commit affe4d948da63b9c11553d295bddf2867f797ad2 Author: Eric Koegel <eric.koegel@gmail.com> Date: Mon Jun 6 05:56:57 2016 +0300 When locking fallback to xflock4 first (Bug #12603) http://git.xfce.org/xfce/xfce4-session/commit/?id=affe4d948da63b9c11553d295bddf2867f797ad2 commit cb4dda3e6696746d5f8ceb147e0c8fc43e434d32 Author: Eric Koegel <eric.koegel@gmail.com> Date: Sat Jun 4 18:49:52 2016 +0300 Fix a crash when warning about the screenlocker (Bug #12603) http://git.xfce.org/xfce/xfce4-session/commit/?id=cb4dda3e6696746d5f8ceb147e0c8fc43e434d32
thank you for your work on this .. :) all works again ..
Just adding some notes here for anyone else that stumbles on to this bug before the fix gets pushed to Ubuntu >=18.04(I spent many hours yesterday looking back through various StackExchange and blog posts before Ifigured this out): Using a pure install of the "xfce4" and "xfce4-power-manager" packages after a clean install of Ubuntu 18.04 LTS does not lock the screen when closing a laptop lid without manually adding the following property to the local or global xfconf database(/etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml): <property name="LockCommand" type="string" value="xscreensaver-command -lock"/> This property is undiscoverable and not well documented, if at all. There was a patch to add this property back in 2015 @ https://git.xfce.org/xfce/xfce4-session/commit/settings/xfce4-session.xml?id=570093ffafa8a6226ce9dd0ee29e9e64539d4bc9, but it does not appear to be in the current Ubuntu source. Manually adding this prpoerty is accomplished by the following command: $xfconf-query -c xfce4-session -p /general/LockCommand -s 'xscreensaver-command -lock' -v -n -t string Without this parameter and a named running screen locking daemon(XScreenSaver by default), the system will Suspend---but, not be locked upon Resume when triggered by a laptop lid-switch. Please add or patch the Ubuntu version to provide this basic functionality as "systemd-logind.service" is not overriding by default: $ systemd-inhibit --list Who: NetworkManager (UID 0/root, PID 936/NetworkManager) What: sleep Why: NetworkManager needs to turn off networks Mode: delay Who: ModemManager (UID 0/root, PID 895/ModemManager) What: sleep Why: ModemManager needs to reset devices Mode: delay Who: UPower (UID 0/root, PID 1564/upowerd) What: sleep Why: Pause device polling Mode: delay Who: xfce4-power-manager (UID 1000/chris, PID 1614/xfce4-power-man) What: handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch Why: xfce4-power-manager handles these events Mode: block 4 inhibitors listed. SOURCE: https://bugs.launchpad.net/ubuntu/+source/xfce4-session/+bug/1783895