Bug 492945

Summary: Power Management is not available when autologin enabled
Product: [Plasma] Powerdevil Reporter: Dandraghas <dandraghas>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: natalie_clarius, nate, wlmqljj
Priority: NOR Keywords: regression
Version: 6.1.4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Dandraghas 2024-09-10 14:29:27 UTC
SUMMARY
When autologin enabled in sddm, power managment says that it can't find power-profiles-daemon even though it installed, enabled and running. Everything works fine without autologin.

STEPS TO REPRODUCE
1. Install power-profiles-daemon
2. Enable autologin in sddm
3. Click on "power managment" in system tray

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.8-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i3-10100F CPU @ 3.60GHz
Memory: 15.5 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
Comment 1 Bug Janitor Service 2024-09-13 18:04:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/425
Comment 2 Li Jiajun 2024-09-18 02:10:31 UTC
I have this problem too, It is caused by https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/commit/8277adb7cd89293fd4d32407eee1596ffbf6acce
This commit is supposed to prevent potential race conditions, so maybe a better solution is needed rather than reverting that?
Comment 3 Nate Graham 2024-09-18 18:11:08 UTC

*** This bug has been marked as a duplicate of bug 492859 ***
Comment 4 Jakob Petsovits 2024-09-19 18:13:15 UTC
Git commit 8e698dbcdc9ce95095ea2739713fde05ca4822f5 by Jakob Petsovits.
Committed on 19/09/2024 at 18:06.
Pushed by jpetso into branch 'master'.

applets/batterymonitor: React to D-Bus service (un)register events

Previously, the "Power and Battery" applet only checked for the
presence of PowerDevil's D-Bus services once when it starts up.
This appears to (mostly?) work for applets embedded in a panel,
but does not work for applets on the desktop itself.
Likely there's a timing issue and applets on the desktop start
sooner than PowerDevil will advertise its services.

A better way to work is for the applet to monitor the bus for when
the relevant services appear or disappear. When observing a service
registered or unregistered event, the applet gets set up accordingly.

This fixes the race condition for two out of three applet parts
(power profiles, inhibitions) but does not fix battery status;
the data for that is coming from `BatteryControlModel`
in plasma-workspace. A similar fix will have to be implemented there.
Related: bug 488915, bug 489003, bug 492859

M  +88   -12   applets/batterymonitor/plugin/powermanagementcontrol.cpp
M  +10   -2    applets/batterymonitor/plugin/powermanagementcontrol.h
M  +77   -1    applets/batterymonitor/plugin/powerprofilescontrol.cpp
M  +10   -1    applets/batterymonitor/plugin/powerprofilescontrol.h

https://invent.kde.org/plasma/powerdevil/-/commit/8e698dbcdc9ce95095ea2739713fde05ca4822f5
Comment 5 Bug Janitor Service 2024-09-19 19:26:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4729
Comment 6 Jakob Petsovits 2024-09-20 12:48:31 UTC
Git commit 0979a34248efa8eac087e418a4cf4419549ece0c by Jakob Petsovits.
Committed on 20/09/2024 at 12:26.
Pushed by jpetso into branch 'master'.

components/batterycontrol: React to D-Bus service (un)register events

Previously, the "Power and Battery" applet only checked for the
presence of PowerDevil's D-Bus services once when it starts up.
This appears to (mostly?) work for applets embedded in a panel,
but does not work for applets on the desktop itself.
Likely there's a timing issue and applets on the desktop start
sooner than PowerDevil will advertise its services.

A better way to work is for the applet to monitor the bus for when
the relevant services appear or disappear. When observing a service
registered or unregistered event, the applet gets set up accordingly.

This fixes the race condition for one out of three applet parts
(battery state) but does not fix power profiles & inhibitions;
these were fixed separately in the powerdevil repository
via commit 8e698dbc.
Related: bug 488915, bug 489003, bug 492859

M  +82   -15   components/batterycontrol/batterycontrol.cpp
M  +6    -1    components/batterycontrol/batterycontrol.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/0979a34248efa8eac087e418a4cf4419549ece0c
Comment 7 Bug Janitor Service 2024-09-23 21:46:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/428
Comment 8 Jakob Petsovits 2024-09-23 21:48:52 UTC
Git commit 5e8cd380806da20d0b12bf97a3629ac70aa2b77c by Jakob Petsovits.
Committed on 23/09/2024 at 21:41.
Pushed by jpetso into branch 'Plasma/6.2'.

applets/batterymonitor: React to D-Bus service (un)register events

Previously, the "Power and Battery" applet only checked for the
presence of PowerDevil's D-Bus services once when it starts up.
This appears to (mostly?) work for applets embedded in a panel,
but does not work for applets on the desktop itself.
Likely there's a timing issue and applets on the desktop start
sooner than PowerDevil will advertise its services.

A better way to work is for the applet to monitor the bus for when
the relevant services appear or disappear. When observing a service
registered or unregistered event, the applet gets set up accordingly.

This fixes the race condition for two out of three applet parts
(power profiles, inhibitions) but does not fix battery status;
the data for that is coming from `BatteryControlModel`
in plasma-workspace. A similar fix will have to be implemented there.
Related: bug 488915, bug 489003, bug 492859

M  +88   -12   applets/batterymonitor/plugin/powermanagementcontrol.cpp
M  +10   -2    applets/batterymonitor/plugin/powermanagementcontrol.h
M  +77   -1    applets/batterymonitor/plugin/powerprofilescontrol.cpp
M  +10   -1    applets/batterymonitor/plugin/powerprofilescontrol.h

https://invent.kde.org/plasma/powerdevil/-/commit/5e8cd380806da20d0b12bf97a3629ac70aa2b77c
Comment 9 Bug Janitor Service 2024-09-23 21:53:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4740
Comment 10 Jakob Petsovits 2024-09-23 22:11:07 UTC
Git commit 43ca4f3bf083651c2ac8b803596e3827ed8d5e76 by Jakob Petsovits.
Committed on 23/09/2024 at 21:48.
Pushed by jpetso into branch 'Plasma/6.2'.

components/batterycontrol: React to D-Bus service (un)register events

Previously, the "Power and Battery" applet only checked for the
presence of PowerDevil's D-Bus services once when it starts up.
This appears to (mostly?) work for applets embedded in a panel,
but does not work for applets on the desktop itself.
Likely there's a timing issue and applets on the desktop start
sooner than PowerDevil will advertise its services.

A better way to work is for the applet to monitor the bus for when
the relevant services appear or disappear. When observing a service
registered or unregistered event, the applet gets set up accordingly.

This fixes the race condition for one out of three applet parts
(battery state) but does not fix power profiles & inhibitions;
these were fixed separately in the powerdevil repository
via commit 8e698dbc (master branch) / commit 5e8cd380 (Plasma/6.2).
Related: bug 488915, bug 489003, bug 492859

M  +82   -15   components/batterycontrol/batterycontrol.cpp
M  +6    -1    components/batterycontrol/batterycontrol.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/43ca4f3bf083651c2ac8b803596e3827ed8d5e76