Sleep or screen lock inhibit no longer shown

Hello,

Been having problems with my PC not going to sleep, and as a pretty long time user of KDE thought I’d check the tray icon “Display Configuration” which would normally state which application is causing the “screen lock” or “sleep” inhibiting or whatever combination.

Not sure if it’s me or something I might have changed, but nothing is displaying when watching videos in Firefox/Chrome or listening to audio in the same or in Elisa. This is what I would normally see:

Screenshot_20240227_075144

But I am not getting any information about the app that is inhibiting sleep or screen lock, I’m used to seeing Steam, Firefox and Discovery just to name a few.

Currently using Manjaro Unstable which at the time of writing is using KDE 6.0.4. Can anyone else confirm this behaviour and if I should log this as a bug?

Edit
As an after thought as I imaging someone will ask, yes, Powerdevil is running

Are those apps installed from Flatpak, rather than from distro repos?

Hi @ngraham,

Thanks for getting back to me. No, I don’t even have flatpak enabled. According to pamac they’re installed from the “Official Repositories (extra)”.

It’s an odd one, I booted into a live USB and even that doesn’t seem to work, but I have a laptop which is also using Manjaro Unstable, and is on KDE 6.0.4 and that seems to be working fine? Does that suggest a hardware problem?

Hi,

Does anyone know how I might start investigating the cause of this? It’s driving me a little mad as it occasionally works fine, then stops for an unknown reason. I don’t know how the Plasmoid knows what wake locks are there nor why it wouldn’t display them as they seem to function as expected.

Is there a command I can run to list the current wake locks for example?

Thanks all,

Does something like
systemd-inhibit sleep 60
show up correctly?

Not as dedicated tool, but PowerDevil exposes the current list of active (sleep/display-off) inhibitions via D-Bus:

busctl --user call org.kde.Solid.PowerManagement.PolicyAgent /org/kde/Solid/PowerManagement/PolicyAgent org.kde.Solid.PowerManagement.PolicyAgent ListInhibitions
# returns e.g.:
# a(ss) 1 "firefox" "video-playing"

As expected. If I combine both of the suggestions together, using the systemd-inhibit and the D-Bus commands I can see everything that is causing the system to stay awake.

I have the expected “Google Chrome Video-wake lock” and the sleep 60 etc but still nothing displayed in the “Display Configuration” Plasmoid. Strange right? Any suggestions were to look now?

Edit: Something really really odd now, if I toggle the “Enable Presentation Mode” on and off, the d-bus command still lists “User enabled presentation mode” and if I keep toggling I just end up with a huge list of them. I currently have 29 “User enabled presentation mode”'s listed

Any suggestions where to look now?

Look at the Power and Battery applet. I hadn’t noticed that you’re talking about the Display Configuration applet. I have not explored the intended status of Display Configuration, now or in the past, I’ve never used it up until now. What I know is that the current work on sleep/display-off inhibitors is focused on the Power and Battery applet. I see Firefox there, and (like you) not in Display Configuration.

What’s a little odd is that the “User enabled presentation mode” inhibitor isn’t showing up in the UI even in Power and Battery. But that could just be a question of it filtering out entries from plasmashell itself.

Edit: Something really really odd now, if I toggle the “Enable Presentation Mode” on and off, the d-bus command still lists “User enabled presentation mode” and if I keep toggling I just end up with a huge list of them. I currently have 29 “User enabled presentation mode”'s listed

Ah, that’s not good. Great catch, we need to fix that.

Thanks for coming back to me @jpetso by Power and Battery I assume you mean Power Management? I have also checked this for the wake/screen locks and they’re not listed there either! If I use the toggle there for “Manually block sleep and screen locking” nothing is listed under either applet but is listed in the dbus listing (Although that toggle does seem to work as expected). I don’t know the mechanisms behind the applets, it would seem that the method for pulling the information from dbus isn’t working for some reason. The really odd part is why it doesn’t seem to work on my PC but works fine on my laptop, to me it suggests a hardware difference but that doesn’t make any sense as I would have expected this to be almost entirely software based, not sure if you can shed any light at all? Just as an example, I have enabled the AMD p-state driver in the kernel which obviously plays around with power management but I don’t see how it would cause this issue?

Update: just tested with the pstate driver in disabled, active and guided modes. No difference. Also tried kernels 6.6.31-2 (LTS), 6.9.1-2 and 6.8.10-2. I am using Manjaro unstable, but to the best of my knowledge that should just mean I have the latest KDE repos that have been accepted upstream by Arch I.E the latest available KDE Release. However as stated I have tried Neon, Kubuntu, Endeavour OS and Garuda. All on live usb’s and some actually on a different partition but all but Neon report the same problem; just a shame I can’t stand Ubuntu (sorry).

RE the Presentation Mode bug, do you want me to log it on bugs.kde?

Oh yeah, it’s got a different title when your system does not have a battery. But yes, that one.

That part is expected; as mentioned, it filters out its own toggle from the list of inhibitions that it shows to the user. As long as it still works, there’s no bug there. Also, Natalie is currently tweaking the UI and functionality for this a little more so it may look slightly different again in Plasma 6.2 :slightly_smiling_face:

Okay that’s weird. I can confirm that the mechanism is purely software-based. Hardware or kernel power management has nothing to do with it. It’s all about PowerDevil receiving inhibition requests from apps or systemd, and sending notifications out that the applet is trying to monitor, all via D-Bus.

When you say “this issue” now, you’re still referring to e.g. Firefox not being shown in the list but now judging by what’s displayed in the Power Management applet, yes? Just to clarify.

It’s possible there’s another bug somewhere that makes list updates unreliable. Not sure. If an entry is supposed to show and doesn’t, that’s a bug and we’d appreciate getting it logged on bugs.kde.org. Thanks!

Initially I thought “perhaps I can fix it right away!” but then I didn’t, and it’s probably safer to file it as opposed to me waiting too long and then getting sidetracked by something else. Much appreciated. It sounds like this one probably isn’t too hard to fix, especially since I can also reproduce it.

Oh yeah, it’s got a different title when your system does not have a battery. But yes, that one.

I forgot that I have a wireless mouse and that triggers the “Battery” part of the Power Management! Sorry about that!

When you say “this issue” now, you’re still referring to e.g. Firefox not being shown in the list but now judging by what’s displayed in the Power Management applet, yes? Just to clarify.

Yes, not limited to Firefox, but yes.

Initially I thought “perhaps I can fix it right away!” but then I didn’t, and it’s probably safer to file it as opposed to me waiting too long and then getting sidetracked by something else. Much appreciated. It sounds like this one probably isn’t too hard to fix, especially since I can also reproduce it.

I will get it logged today so the team can keep track :slight_smile:
EDIT
Bug 487706 Raised

Okay that’s weird. I can confirm that the mechanism is purely software-based. Hardware or kernel power management has nothing to do with it. It’s all about PowerDevil receiving inhibition requests from apps or systemd, and sending notifications out that the applet is trying to monitor, all via D-Bus.

Could it be that there is a bug in D-Bus/systemd that is causing the problem then? I’ve installed Neon stable/Unstable onto a different partition and everything seems to function fine on both. Obviously Neon is using, at least when I last checked, Ubuntu 22.04 and therefore is running an older version of D-Bus/systemd compared to Manjaro which is likely to have the most recent up-steam release. I’ve asked in the Manjaro forum if anyone else is having the same problem, but so far I’ve only had 2 people respond only 1 of which answered the question with nope, so no idea if it’s just me!

I got bored and installed arch with KDE DE to see if there was something in the Manjaro packaging/packages causing the problem, and my results show the same problem, making me thinking there if definitely something in systemd or d-bus differences causing the problem, I would help look for the problem but I lack any knowledge on how it hangs together and my c++ is non-existent! :smiley:

Not sure if it’s related, but my screen brightness is also a little funky in that whenever the screen gets dimmed through power management it is never restored to the previous brightness even though the slider states 100%, instead is at the 30% mark.

I think I may have stumbled upon a workaround, plasma crashed today for some unknown reason and restarted. When it had restarted the wake locks had started to show, further testing showed that if I restarted plasmashell (systemctl -user restart plasma-plasmashell.service) after a reboot, everything worked as expected. No idea why!

EDIT
Created a script to run on startup to do the above command, which seems to solve the problem for now, not ideal, but it works!

i had this problem on kubuntu 24.04…after weeks of confusion it turned out the this new firefox feature was the bad guy.

Screen_Wake_Lock_API

seems this allows web devs to disable screen dimming/locking to force users to constantly watch their spam. quite impressive feature IMHO

after disabling it in firefox (about:config) eveything went back to normal.

dom.screenwakelock.enabled: false
permissions.default.screen-wake-lock:0