Bug 491480

Summary: Sleep|Suspend does not work when triggered via plasma
Product: [KDE Neon] neon Reporter: Arek Guzinski <kermit>
Component: generalAssignee: Neon Bugs <neon-bugs>
Status: RESOLVED DOWNSTREAM    
Severity: normal CC: carlosd.kde, fanzhuyifan, jr, neon-bugs, tapio.metsala
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: output of journalctl -b
output of dmesg

Description Arek Guzinski 2024-08-09 12:01:29 UTC
SUMMARY
Triggering Sleep (aka suspend to ram) is (again) not possible via plasma. 

STEPS TO REPRODUCE
1. Either press the configured shortcut for "Suspend" or press the "Sleep" button in the application menu.

OBSERVED RESULT
Network goes briefly down; nothing else happens.

EXPECTED RESULT
Computer goes to sleep.

SOFTWARE/OS VERSIONS
Operating System: KDE neon 6.0
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Kernel Version: 6.5.0-45-generic (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-6500 CPU @ 3.20GHz
Memory: 15,5 GiB of RAM
Graphics Processor: AMD Radeon RX 7900 GRE

ADDITIONAL INFORMATION
Not sure why I haven't reported this earlier. Probably because sometimes it worked.
To be clear: My experience using KDE for at least the last 5 years is that this works for a few months, then after some update it doesn't, then it does, and so on... currently it's broken again.

What always worked flawlessly is:
$ sudo echo mem > /sys/power/state
Comment 1 fanzhuyifan 2024-08-09 17:17:28 UTC
Does systemctl suspend work?

Could you enable debug messages and upload your journal logs through `journalctl -b` and kernel debug messages through dmesg? Thanks!
Comment 2 Arek Guzinski 2024-08-09 19:26:36 UTC
Created attachment 172453 [details]
output of journalctl -b

To find relevant sections, search for "Next:".
I forgot to enable debug at first, so I redid the 3 tests - the last 3 should be the interesting ones.
I didn't know what exactly to enable debug for, so I enabled everything in kdebugsettings for this - I hope it's not too much.

`systemctl suspend` does not work.

Another interesting thing I noticed: when I trigger my sleep-workaround-script via Sleep button, the first wake up fails. The PC seems to start for a second or so - then goes to sleep again. This does not happen when triggered via command line.
Comment 3 Arek Guzinski 2024-08-09 19:29:14 UTC
Created attachment 172454 [details]
output of dmesg
Comment 4 fanzhuyifan 2024-08-09 19:55:56 UTC
Given that echo mem > /sys/power/state works but systemctl suspend does not, my guess would be that maybe some systemd sleep hook is blocking sleep.
Comment 5 Arek Guzinski 2024-08-09 20:44:35 UTC
Sounds reasonable. But what could it be? 
/etc/systemd/sleep.conf has not been touched since 2022. 
/etc/systemd/system/sleep.target.wants and it's contents have a mtime in 2021.

I don't think, I manually changed anything in /etc/systemd for years. And I'm pretty sure it worked some months ago. 

So this kind of looks like a problem with systemd - but judging from it's changelog the version in neon is from November 2023. This doesn't really fit either.
Are there maybe some packages in neon that would modify the sleep hooks?

btw: pm-suspend works, too.

I also tried uncommenting the lines in /etc/systemd/sleep.conf:
AllowSuspend=yes
SuspendState=mem standby freeze

No effect, as expected.

I will try downgrading systemd tomorrow - let's see if that changes anything.
Comment 6 Tapio Metsälä 2024-09-09 21:03:41 UTC
I comment briefly that I just installed openSuse Tumbleweed and it has similar problem. At least in X11.
Comment 7 Arek Guzinski 2024-09-28 10:15:27 UTC
Small update: 
* I did not downgrade systemd because of the dependency problems this would cause.
* I searched the relevant systemd bugtrackers (github & ubuntu package) for this problem - found nothing.
Comment 8 Arek Guzinski 2024-10-13 09:38:52 UTC
After doing a clean reinstall of the newly rebased Neon, this is working fine again.

But I'm not convinced the problem is really gone until it has been working for at least a year..
Comment 9 fanzhuyifan 2025-01-08 15:23:13 UTC
Given that things work in a fresh install, this seems like a local configuration issue. So closing this for now.