Bug 456966

Summary: Powerdevil times out on launch on AMD Rembrandt
Product: [Plasma] plasmashell Reporter: David Mak <david.18.19.21>
Component: Power management & brightnessAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: breitenstein.alexander, david, dev, natalie_clarius, nate, nicolas.fella, stianix, xaver.hugl
Priority: NOR    
Version First Reported In: 5.23.3   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Powerdevil Logs from Journalctl, last 10 boots.
journalctl --user logs from a boot where Powerdevil fails to launch
journalctl -p4 of failed login after boot
journalctl -p4 of successful login after boot
systemctl --user status plasma-powerdevil.service on failed boot
journalctl -p 4 powerdevil failed login attempt

Description David Mak 2022-07-21 02:40:19 UTC
SUMMARY

Sometimes when logging into a user, instead of displaying the splash screen followed by the desktop, the screen will have no output for ~15 seconds before displaying the splash screen and desktop (with only the wallpaper). The default panel and any shortcuts will not work on the desktop.

Whenever this happens, systemctl logs seem to indicate that Powerdevil's job timed out. This issue does not occur on an AMD Ryzen 7 PRO 4750U laptop (Renoir).

STEPS TO REPRODUCE

1. Login into any user.

OBSERVED RESULT

Screen turns off for ~10-15 seconds, then splash screen shows for 3 seconds, then only the wallpaper is shown (no configured panel will show, and no keyboard shortcut works). Only occurs occasionally.

EXPECTED RESULT

Splash screen should show, followed by the usual desktop environment with panels.

SOFTWARE/OS VERSIONS
Linux: 5.18.12-arch1-1
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION

`systemctl --user` logs:
```
Jul 21 10:14:02 david-laptop systemd[742]: Starting Powerdevil...
Jul 21 10:14:08 david-laptop systemd[742]: plasma-powerdevil.service: start operation timed out. Terminating.
Jul 21 10:14:08 david-laptop systemd[742]: plasma-powerdevil.service: Failed with result 'timeout'.
Jul 21 10:14:08 david-laptop systemd[742]: Failed to start Powerdevil.
Jul 21 10:14:08 david-laptop systemd[742]: plasma-powerdevil.service: Scheduled restart job, restart counter is at 1.
Jul 21 10:14:08 david-laptop systemd[742]: Stopped Powerdevil.
Jul 21 10:14:08 david-laptop systemd[742]: Starting Powerdevil...
Jul 21 10:14:08 david-laptop org_kde_powerdevil[1135]: org.kde.powerdevil: org.kde.powerdevil.discretegpuhelper.hasdualgpu failed
Jul 21 10:14:13 david-laptop systemd[742]: plasma-powerdevil.service: start operation timed out. Terminating.
Jul 21 10:14:13 david-laptop systemd[742]: plasma-powerdevil.service: Failed with result 'timeout'.
Jul 21 10:14:13 david-laptop systemd[742]: Failed to start Powerdevil.
```

This issue only started occurring since I upgraded from a AMD Renoir (Ryzen 7 PRO 4750U) laptop to a AMD Rembrandt (Ryzen 7 PRO 6850U) laptop.
Comment 1 Nate Graham 2022-07-21 16:07:45 UTC
Seems quite relevant:

> Jul 21 10:14:08 david-laptop org_kde_powerdevil[1135]: org.kde.powerdevil: org.kde.powerdevil.discretegpuhelper.hasdualgpu failed

Is this a dual-GPU system?
Comment 2 Nicolas Fella 2022-07-21 19:56:57 UTC
(In reply to Nate Graham from comment #1)
> Seems quite relevant:
> 
> > Jul 21 10:14:08 david-laptop org_kde_powerdevil[1135]: org.kde.powerdevil: org.kde.powerdevil.discretegpuhelper.hasdualgpu failed
> 
> Is this a dual-GPU system?

It might not be relevant. All the discretegpuhelper does is test whether a specific file exists
Comment 3 Nicolas Fella 2022-07-21 19:58:20 UTC
Can you run "systemctl --user status plasma-powerdevil.service" when it failed and show the output?
Comment 4 David Mak 2022-07-22 02:22:58 UTC
(In reply to Nate Graham from comment #1)
> Seems quite relevant:
> 
> > Jul 21 10:14:08 david-laptop org_kde_powerdevil[1135]: org.kde.powerdevil: org.kde.powerdevil.discretegpuhelper.hasdualgpu failed
> 
> Is this a dual-GPU system?

It's not. It's an APU (Ryzen 7 PRO 6850U with Radeon 680M) with no discrete GPU.
Comment 5 David Mak 2022-07-22 02:23:57 UTC
Created attachment 150801 [details]
Powerdevil Logs from Journalctl, last 10 boots.

(In reply to Nicolas Fella from comment #3)
> Can you run "systemctl --user status plasma-powerdevil.service" when it
> failed and show the output?

Since I am not able to reproduce it every time, here is the `journactl --user -u plasma-powerdevil` for the last 10 boots.
Comment 6 djagoo 2022-10-14 10:31:50 UTC
Same problem here with AMD Ryzen 6850 (Thinkpad Z13). Every second boot/login the screen turn black and login hangs because of plasma-powerdevil hanging.

Log shows the same message: org.kde.powerdevil: org.kde.powerdevil.discretegpuhelper.hasdualgpu failed
Comment 7 Nate Graham 2022-10-14 18:12:55 UTC
I see a lot of "The Wayland connection broke. Did the Wayland compositor die?"

Are you seeing other crashes on boot?
Comment 8 Bug Janitor Service 2022-10-29 05:02:37 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 9 djagoo 2022-10-29 05:07:37 UTC
It didn't happen again since I reported that I am affected too. Seems like an update which was done around this time fixed it for me.
Comment 10 David Mak 2022-10-30 13:38:31 UTC
I can attach a few more logs tomorrow when I get back to my laptop, since this issue has persisted for me.
Comment 11 David Url 2022-10-30 22:27:40 UTC
I experience the same issue on my Lenovo T14 gen3:
Kernel: x86_64 Linux 6.0.5-arch1-1
DE: KDE 5.99.0 / Plasma 5.26.2
CPU: AMD Ryzen 7 PRO 6850U

While the behaviour seems to be the same, i dont get any hasdualgpu or wayland errors in the logs:
```
Okt 30 23:18:59 dT14 systemd[803]: Starting Powerdevil...
Okt 30 23:19:04 dT14 systemd[803]: plasma-powerdevil.service: start operation timed out. Terminating.
Okt 30 23:19:04 dT14 systemd[803]: plasma-powerdevil.service: Failed with result 'timeout'.
Okt 30 23:19:04 dT14 systemd[803]: Failed to start Powerdevil.
Okt 30 23:19:04 dT14 systemd[803]: plasma-powerdevil.service: Scheduled restart job, restart counter is at 1.
Okt 30 23:19:04 dT14 systemd[803]: Stopped Powerdevil.
Okt 30 23:19:04 dT14 systemd[803]: Starting Powerdevil...
Okt 30 23:19:09 dT14 systemd[803]: plasma-powerdevil.service: start operation timed out. Terminating.
Okt 30 23:19:09 dT14 systemd[803]: plasma-powerdevil.service: Failed with result 'timeout'.
Okt 30 23:19:09 dT14 systemd[803]: Failed to start Powerdevil.
```

It looks a bit like a race condition between some services to me. While i can open a shell and run some commands, everything is incredibly slow, and most systemctl commands never return. Also shutdown or reboot just hang endlessly.
Comment 12 David Mak 2022-11-03 04:25:35 UTC
Created attachment 153423 [details]
journalctl --user logs from a boot where Powerdevil fails to launch
Comment 13 David Url 2022-11-10 21:12:35 UTC
Created attachment 153650 [details]
journalctl -p4 of failed login after boot
Comment 14 David Url 2022-11-10 21:13:33 UTC
Created attachment 153651 [details]
journalctl -p4 of successful login after boot
Comment 15 Nate Graham 2022-11-14 18:47:11 UTC
> Nov 08 21:06:18 dT14 systemd[794]: plasma-powerdevil.service: start operation timed out. Terminating.
> Nov 08 21:06:18 dT14 systemd[794]: plasma-powerdevil.service: Failed with result 'timeout'.

David, can you please paste the output of `systemctl status --user plasma-powerdevil.service` after a boot where it's failed?
Comment 16 David Url 2022-11-14 20:49:21 UTC
Created attachment 153747 [details]
systemctl --user status plasma-powerdevil.service on failed boot

The status always looks the same, as the service tries to restart after it receives the timeout.
Is there some kind of debug logging I can enable to show whats going on before the service times out?
Comment 17 Nate Graham 2022-11-15 17:52:33 UTC
Huh, weird.
Comment 18 Alexander Breitenstein 2022-11-26 18:56:24 UTC
Created attachment 154052 [details]
journalctl -p 4 powerdevil failed login attempt

I've the same issue, same hardware.

The screen stays black for me seemingly forever and fairly consistent on each boot.
The only way I can avoid this problem, so weird it seems, is to open a tty2 after the GUI login in screen is visible, login via tty2 and execute any command with sudo. 
Afterwards, the GUI login and KDE works flawlessly.
---
Lenovo T14
CPU: AMD Ryzen 7 PRO 6850U with Radeon Graphics (16) @ 2.700GHz 
GPU: AMD ATI Radeon 680M 

Kernel: Linux t14 6.0.8-1-MANJARO #1 SMP PREEMPT_DYNAMIC Thu Nov 10 20:52:34 UTC 2022 x86_64 GNU/Linux
plasmashell 5.26.3
Qt: 5.15.7
KDE Frameworks: 5.99.0
Comment 19 Stian Anker 2022-12-01 12:28:35 UTC
Using iwd as the Wi-Fi backend works for me, so this might not be a problem with Powerdevil. Can anyone else confirm?

https://wiki.archlinux.org/title/NetworkManager#Using_iwd_as_the_Wi-Fi_backend
Comment 20 Alexander Breitenstein 2022-12-01 13:27:00 UTC
> Using iwd as the Wi-Fi backend works for me, so this might not be a problem with Powerdevil. Can anyone else confirm?
> https://wiki.archlinux.org/title/NetworkManager#Using_iwd_as_the_Wi-Fi_backend

Sadly this didn't fix ist for me. Still black screens for 3/4 boots.
Comment 21 David Url 2022-12-03 19:26:36 UTC
I used strace to gain some insights on what may be going wrong, and it showet that powerdevil gets stuck in a FUTEX_WAIT_BITSET_PRIVATE call. Compared with a trace of a succesfull launch, the stuck futex wait call is shortly before a bunch of statx calls to kde config files (e.g. /home/david/.config/kdeglobals).
I only glanced over the codebase and it seems like the stuck futex could be part of some dbus calls.

Im not familiar with the kde or dbus codebase, so i dont really know how to continue to debug the issue from here. Any ideas on how to inspect the dbus calls that i suspect to go wrong?
Comment 22 David Url 2023-01-15 17:11:14 UTC
For me, switching to iwd seems to have fixed the issue. I have not seen the error since then.
Comment 23 Nate Graham 2025-06-16 19:20:51 UTC
Hi David Mak,
Thanks for the bug report, and I'm sorry we weren't able to figure out the issue yet. A lot has changed since the issue was reported; can I ask you to check and see if it still happens in Plasma 6.3.5 or later? Thanks a lot!
Comment 24 David Mak 2025-06-18 12:32:41 UTC
This hasn't happened for quite a while now, probably even before Plasma 6.0 (since it's been a while now).

Sorry for not updating on this issue earlier, and I appreciate the time you've spent on this issue.
Comment 25 Nate Graham 2025-06-18 13:47:54 UTC
Great, thanks!