View Issue Details

IDProjectCategoryView StatusLast Update
0008385Kali LinuxGeneral Bugpublic2024-06-14 15:14
ReporterArszilla Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionopen 
Product Version2023.2 
Summary0008385: Kali i3 & xfce4-power-manager
Description

2hexed on Discord have brought this issue up to me, where upon closing the lid of their laptop (on Kali i3), xfce4-power-manager would create a popup error box saying "None of the screen lock tools ran successfully, the screen will not be locked".

I was able to replicate the issue on my Lenovo L540 using an fresh ISO image from https://cdn.arszilla.download/kali/kali-i3-amd64.iso

Upon some research, I've ran into this post: https://forum.xfce.org/viewtopic.php?id=14993 , I've asked him to run the following commands:

  • xfce4-power-manager-q && xfce4-power-manager --debug
  • cat $(which xflock4) | grep -A12 LOCK_CMD
  • xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/logind-handle-lid-switch -n -t bool -s true

I've attached the output of the first 2 commands below. The first output file is similar to what I've got on my L540.

Upon running the last command above, it seems like it had fixed his issue, however I am trying to find the root cause of this issue to apply a fix (whether to the xfce4-power-manager package or i3-dotfiles). However, I could use some assistance on debugging this issue as its a bit out of my depth.

Steps To Reproduce
  1. Download the ISO from https://cdn.arszilla.download/kali/kali-i3-amd64.iso
  2. Prepare the ISO using Balena Etcher
  3. Install it on a laptop and reboot
  4. After installation, close the laptop lid
  5. Should have reproduced the error
Attached Files
xfconf-query.txt (576 bytes)   
LOCK_CMD=$(xfconf-query -c xfce4-session -p /general/LockCommand)

if [ -n "$LOCK_CMD" ]; then
    /bin/sh -c "$LOCK_CMD" && exit
    exit_code=$?
    >&2 printf "'%s' exited with status %d\n" "$LOCK_CMD" $exit_code
    exit $exit_code
fi

# Try our screensaver first
xfce4-screensaver-command --lock </dev/null 2>/dev/null && exit

# This list should be kept in sync with XfceScreensaver (libxfce4ui)
xdg-screensaver lock </dev/null 2>/dev/null && exit
for lock_cmd in \
    xscreensaver-command \
    light-locker-command \
    gnome-screensaver-command \
xfconf-query.txt (576 bytes)   
xfce4-power-manager debug.txt (9,104 bytes)   
TRACE[xfpm-main.c:210] xfpm_start(): Starting the power manager

(xfce4-power-manager:3572): xfce4-power-manager-WARNING **: 12:14:32.667: Unable to connect to session manager : Failed to connect to the session manager: SESSION_MANAGER environment variable not defined
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for general-notification
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for critical-power-level
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for show-brightness-popup
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for handle-brightness-keys
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for brightness-step-count
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for brightness-exponential
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for critical-power-action
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for hibernate-button-action
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for sleep-button-action
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for battery-button-action
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for lid-action-on-ac
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for lid-action-on-battery
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for brightness-level-on-ac
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for brightness-level-on-battery
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for brightness-slider-min-level
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for dpms-enabled
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for dpms-on-ac-sleep
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for dpms-on-ac-off
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for dpms-on-battery-sleep
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for dpms-on-battery-off
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for dpms-sleep-mode
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for inactivity-on-ac
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for inactivity-on-battery
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for inactivity-sleep-mode-on-ac
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for inactivity-sleep-mode-on-battery
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for brightness-on-ac
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for brightness-on-battery
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for network-manager-sleep
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for logind-handle-power-key
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for logind-handle-suspend-key
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for logind-handle-hibernate-key
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for logind-handle-lid-switch
TRACE[xfpm-xfconf.c:165] xfpm_xfconf_load(): Using default configuration for heartbeat-command
TRACE[xfpm-polkit.c:289] xfpm_polkit_init_data(): Using unix session polkit subject
TRACE[xfpm-polkit.c:345] xfpm_polkit_check_auth_intern(): polkit request: (('unix-process', {'pid': <uint32 3572>, 'start-time': <uint64 247436>}), 'org.freedesktop.login1.power-off', @a{ss} {}, uint32 0, '')
TRACE[xfpm-polkit.c:366] xfpm_polkit_check_auth_intern(): Action=org.freedesktop.login1.power-off is authorized=TRUE
TRACE[xfpm-polkit.c:345] xfpm_polkit_check_auth_intern(): polkit request: (('unix-process', {'pid': <uint32 3572>, 'start-time': <uint64 247436>}), 'org.freedesktop.login1.reboot', @a{ss} {}, uint32 0, '')
TRACE[xfpm-polkit.c:366] xfpm_polkit_check_auth_intern(): Action=org.freedesktop.login1.reboot is authorized=TRUE
TRACE[xfpm-polkit.c:345] xfpm_polkit_check_auth_intern(): polkit request: (('unix-process', {'pid': <uint32 3572>, 'start-time': <uint64 247436>}), 'org.freedesktop.login1.suspend', @a{ss} {}, uint32 0, '')
TRACE[xfpm-polkit.c:366] xfpm_polkit_check_auth_intern(): Action=org.freedesktop.login1.suspend is authorized=TRUE
TRACE[xfpm-polkit.c:345] xfpm_polkit_check_auth_intern(): polkit request: (('unix-process', {'pid': <uint32 3572>, 'start-time': <uint64 247436>}), 'org.freedesktop.login1.hibernate', @a{ss} {}, uint32 0, '')
TRACE[xfpm-polkit.c:366] xfpm_polkit_check_auth_intern(): Action=org.freedesktop.login1.hibernate is authorized=TRUE
TRACE[xfpm-power.c:929] xfpm_power_get_power_devices(): Power device detected at : /org/freedesktop/UPower/devices/line_power_AC
TRACE[xfpm-power.c:888] xfpm_power_add_device(): 'line-power' device added
TRACE[xfpm-power.c:929] xfpm_power_get_power_devices(): Power device detected at : /org/freedesktop/UPower/devices/battery_BAT0
TRACE[xfpm-power.c:888] xfpm_power_add_device(): 'battery' device added
TRACE[xfpm-power.c:897] xfpm_power_add_device(): Battery device type 'battery' detected at: /org/freedesktop/UPower/devices/battery_BAT0
TRACE[xfpm-button.c:180] xfpm_button_xevent_key(): Grabbed key 124 : ((XfpmButtonKey) BUTTON_POWER_OFF)

(xfce4-power-manager:3572): xfce4-power-manager-WARNING **: 12:14:32.978: could not map keysym 1008ffa8 to keycode

TRACE[xfpm-button.c:180] xfpm_button_xevent_key(): Grabbed key 213 : ((XfpmButtonKey) BUTTON_HIBERNATE)
TRACE[xfpm-button.c:180] xfpm_button_xevent_key(): Grabbed key 150 : ((XfpmButtonKey) BUTTON_SLEEP)
TRACE[xfpm-button.c:180] xfpm_button_xevent_key(): Grabbed key 233 : ((XfpmButtonKey) BUTTON_MON_BRIGHTNESS_UP)
TRACE[xfpm-button.c:180] xfpm_button_xevent_key(): Grabbed key 232 : ((XfpmButtonKey) BUTTON_MON_BRIGHTNESS_DOWN)
TRACE[xfpm-button.c:180] xfpm_button_xevent_key(): Grabbed key 244 : ((XfpmButtonKey) BUTTON_BATTERY)
TRACE[xfpm-button.c:180] xfpm_button_xevent_key(): Grabbed key 238 : ((XfpmButtonKey) BUTTON_KBD_BRIGHTNESS_UP)
TRACE[xfpm-button.c:180] xfpm_button_xevent_key(): Grabbed key 237 : ((XfpmButtonKey) BUTTON_KBD_BRIGHTNESS_DOWN)
TRACE[xfpm-power.c:209] xfpm_power_check_polkit_auth(): using logind suspend backend
TRACE[xfpm-polkit.c:345] xfpm_polkit_check_auth_intern(): polkit request: (('unix-process', {'pid': <uint32 3572>, 'start-time': <uint64 247436>}), 'org.freedesktop.login1.suspend', @a{ss} {}, uint32 0, '')
TRACE[xfpm-polkit.c:366] xfpm_polkit_check_auth_intern(): Action=org.freedesktop.login1.suspend is authorized=TRUE
TRACE[xfpm-polkit.c:345] xfpm_polkit_check_auth_intern(): polkit request: (('unix-process', {'pid': <uint32 3572>, 'start-time': <uint64 247436>}), 'org.freedesktop.login1.hibernate', @a{ss} {}, uint32 0, '')
TRACE[xfpm-polkit.c:366] xfpm_polkit_check_auth_intern(): Action=org.freedesktop.login1.hibernate is authorized=TRUE
TRACE[xfpm-power.c:1449] xfpm_update_blank_time(): Prev Timeout: 600 / New Timeout: 600
TRACE[xfpm-manager.c:650] xfpm_manager_inhibit_sleep_systemd(): Inhibiting systemd sleep: handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch

** (xfce4-power-manager:3572): WARNING **: 12:14:33.100: could not get output property

(xfce4-power-manager:3572): xfce4-power-manager-WARNING **: 12:14:33.111: It seems the kernel brightness switch handling value was not restored properly on exit last time, xfce4-power-manager will try to restore it this time.
xfce4-power-manager-Message: 12:14:33.177: Set kernel brightness switch to 0
TRACE[xfpm-backlight.c:269] xfpm_backlight_brightness_on_ac_settings_changed(): Alarm on ac timeout changed 9
TRACE[xfpm-backlight.c:290] xfpm_backlight_brightness_on_battery_settings_changed(): Alarm on battery timeout changed 120

(xfce4-power-manager:3572): xfce4-power-manager-WARNING **: 12:14:33.187: Failed to get keyboard max brightness level : GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Object does not exist at path “/org/freedesktop/UPower/KbdBacklight”

(xfce4-power-manager:3572): xfconf-WARNING **: 12:14:33.188: Failed to set property "xfce4-power-manager::/xfce4-power-manager/brightness-switch": Operation was cancelled
xfce4-power-manager-Message: 12:14:33.260: Set kernel brightness switch to 0
TRACE[xfpm-polkit.c:237] xfpm_polkit_free_data(): Destroying Polkit data
TRACE[xfpm-manager.c:491] xfpm_manager_alarm_timeout_cb(): Alarm inactivity timeout id 2
TRACE[xfpm-manager.c:441] xfpm_manager_lid_changed_cb(): LID close event: ((XfpmLidTriggerAction) LID_TRIGGER_LOCK_SCREEN)
TRACE[xfpm-manager.c:473] xfpm_manager_lid_changed_cb(): LID opened: ((XfpmLidTriggerAction) LID_TRIGGER_LOCK_SCREEN)
TRACE[xfpm-dpms.c:285] xfpm_dpms_force_level(): start
TRACE[xfpm-dpms.c:319] xfpm_dpms_force_level(): No need to change DPMS mode, current_level=0 requested_level=
xfce4-power-manager debug.txt (9,104 bytes)   
xfce-power-manager-error.png (8,883 bytes)   
xfce-power-manager-error.png (8,883 bytes)   

Activities

Arszilla

Arszilla

2023-08-01 14:31

reporter   ~0018270

In some further tests, I was unable to replicate this issue in Kali XFCE. However, I noticed this issue is present on my Dell XPS that has the same Kali i3 installation for 6+ months. It did not have this issue before, so I am a bit lost on how this issue came to be, but my theory is with the 2023-06-22 update (4.18.2.1). I tried downgrading to 4.18.1.1, but no luck/change in behavior...

arnaudr

arnaudr

2023-08-08 09:33

manager   ~0018286

If you can reproduce the issue, you should check what fails exactly. Looking at the code of xfce screensaver, we can see that the function that fails is xfce_screensaver_lock. This function is defined here: https://gitlab.xfce.org/xfce/libxfce4ui/-/blob/master/libxfce4ui/xfce-screensaver.c#L560

Looking at this function you can see that the logic is 3 steps:

  1. First, try to run a user-defined command, if any
  2. Otherwise, check if there's a well-known screensaver present on dbus, use it if any
  3. Finally, try some well-known commands, one after the other, and stop if ever one succeeds

For the i3 desktop, the screen locker is betterlock, right? Maybe you need to instruct xfce4-screensaver to use betterlock, maybe it's possible to do so in the xfce4 screensaver preferences?

Arszilla

Arszilla

2023-08-11 09:07

reporter   ~0018301

So testing xfce4-screensaver, the error has disappeared. However, as soon as the lid is closed, Kali resorts to locking and displaying lightdm, instead of betterlockscreen (which uses i3lock-color). I am trying to figure out how can I invoke that, instead of whatever xfce4-screensaver and xfce4-power-manager is invoking, but no luck. Any ideas?

Arszilla

Arszilla

2023-10-25 20:01

reporter   ~0018558

Last edited: 2023-10-25 20:01

Small excerpt from https://gitlab.com/Arszilla/kali-i3/-/issues/10 :

Some more details, as I managed to squeeze in some time and diagnose the bug a bit further.

  • The bug/issue occurs as LockCommand is orphaned/undefined in $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml, since Kali i3 does not use XFCE4, but only its power-manager, as I couldn't find a better alternative back when.
  • This can be fixed by executing xfconf-query --create -c xfce4-session -p /general/LockCommand -t string -s &quot;/usr/bin/betterlockscreen -l&quot; and xfconf-query --create -c xfce4-session -p /shutdown/LockScreen -t bool -s true or by creating xfce4-session.xml with the following content:
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>

&lt;channel name=&quot;xfce4-session&quot; version=&quot;1.0&quot;>
  &lt;property name=&quot;general&quot; type=&quot;empty&quot;>
    &lt;property name=&quot;FailsafeSessionName&quot; type=&quot;empty&quot;/>
    &lt;property name=&quot;LockCommand&quot; type=&quot;string&quot; value=&quot;/usr/bin/betterlockscreen -l&quot;/>
  &lt;/property>
  &lt;property name=&quot;shutdown&quot; type=&quot;empty&quot;>
    &lt;property name=&quot;LockScreen&quot; type=&quot;bool&quot; value=&quot;true&quot;/>
  &lt;/property>
&lt;/channel>

When the system is rebooted and Laptop Lid action is set to Lock Screen, this works flawlessly and fixes the issue. However, one thing I've seen in my testing is that if the action is set to Suspend, the system does suspend, but it does not lock the screen prior (or after, even though this would be a shit action to do) to suspending the laptop. This happens regardless if Lock screen when system is going to sleep in Security is enabled.

I'll be taking a further look and hope to diagnose this, maybe when I can wipe the laptop or get another laptop to test on, as I'd like to do my diagnosis on a clean system to ensure that there is no bloat, no-nonsense, etc.

As a result https://bugs.kali.org/view.php?id=8513 has been opened.

Arszilla

Arszilla

2023-11-20 09:31

reporter   ~0018635

The changes have been reflected to i3-dotfiles and as a result, I am currently building a new ISO with the changes applied. I will try to test it ASAP but no ETA on it.

Additionally, https://gitlab.com/kalilinux/build-scripts/live-build-config/-/merge_requests/31 has been opened to reflect the changes required to the hook as per the dotfiles update.

g0tmi1k

g0tmi1k

2024-06-14 15:14

administrator   ~0019390

This report has been filed against an old version of Kali. We will be closing this ticket due to inactivity.

Please could you see if you are able to replicate this issue with the latest version of Kali Linux (https://www.kali.org/get-kali/)?

If you are still facing the same problem, feel free to re-open the ticket. If you choose to do this, could you provide more information to the issue you are facing, and also give information about your setup?
For more information, please read: https://www.kali.org/docs/community/submitting-issues-kali-bug-tracker/

Issue History

Date Modified Username Field Change
2023-07-10 20:23 Arszilla New Issue
2023-07-10 20:23 Arszilla File Added: xfconf-query.txt
2023-07-10 20:23 Arszilla File Added: xfce4-power-manager debug.txt
2023-07-10 20:23 Arszilla File Added: xfce-power-manager-error.png
2023-08-01 14:31 Arszilla Note Added: 0018270
2023-08-08 09:33 arnaudr Note Added: 0018286
2023-08-11 09:07 Arszilla Note Added: 0018301
2023-10-25 20:01 Arszilla Note Added: 0018558
2023-10-25 20:01 Arszilla Note Edited: 0018558
2023-11-20 09:31 Arszilla Note Added: 0018635
2024-06-14 15:14 g0tmi1k Note Added: 0019390
2024-06-14 15:14 g0tmi1k Status new => closed