Upon upgrade of package from sys-auth/elogind-252.9-r2, suspending laptop via lid close, suspend button (power) or via Suspend option in greeter doesn't completely suspend laptop. Laptop becomes un-recoverable with the screen turning off, hard disks and fan running. Forced power down is only option. Downgrading to sys-auth/elogind-252.9-r2 fixes the issue. Adding "SuspendMode=deep" to /etc/elogind/sleep.conf also seems to fix issue in sys-auth/elogind-255.5. Not sure if this is by design but have not had to add that option in past versions. If this is by design and I have or have not mitigated properly, please advise (and close). I should add that this is with kernel 6.10.7-gentoo (unstable) on an older Intel Core2 Duo machine. Thank you.
Confirmed, same problem on my Zen2 Thinkpad.
As of 255 there is also /etc/elogind/sleep.conf.d/10-elogind.conf which contains the default setting for SuspendMode. Uncommenting this and reversing the order of the entries to "SuspendMode=deep s2idle" fixes it as well - no need to modify the default sleep.conf.
Just to iterate that I fixed this by adding SuspendMode=deep to the 10-elogind.conf file and just failed to mention this correctly in initial report. I did, however, somehow NOT see the commented line with #SuspendMode=s2idle deep right above my entry. Thanks Holger for pointing that out. I even scanned that file before adding my entry and still missed it!
Easiest fix (for now) is probably to stick a sed -i 's/#SuspendMode=s2idle deep/SuspendMode=deep s2idle/g' src/sleep/10-elogind.conf into the ebuild instead of patching the default order in the code - see the linked upstream bug.
*** Bug 939284 has been marked as a duplicate of this bug. ***
It seems to be due to this commit by Sven Eden: https://github.com/elogind/elogind/commit/7707a30dfb2496a4c9c5939f0dd8bb39baebfecd I'm not sure, but before this, I'm guessing it used whatever variant the kernel defaults to. This is normally "deep" unless that is unsupported by the system, in which case it is "s2idle". This default can be changed with the mem_sleep_default kernel parameter. https://docs.kernel.org/admin-guide/pm/sleep-states.html
By comparison, systemd literally doesn't include "s2idle" anywhere in its code. This is an elogind-specific change. Perhaps it should honour the kernel's default, but then what would be the point of this code at all? What was wrong with how it worked before?
Created attachment 902360 [details, diff] sleep-config.patch sleep-config.c test patch
Thanks James for finding that commit. I edited to sleep-config.c file and created a patch that I have also tested. My machine that was impacted seems to work properly after applying. No edits to 10-elogind.conf. I'm not suggesting this as an official fix, but it did seem to work for me. More or less messing around. I didn't edit the ebuild to apply the patch, I simply used Portage's patching system. No warranty of correctness is included with anything I just did and use is completely at the risk of individual user.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=265054dc933b168d0ac4c71961ea1d0b1170f5f1 commit 265054dc933b168d0ac4c71961ea1d0b1170f5f1 Author: Andreas Sturmlechner <asturm@gentoo.org> AuthorDate: 2024-11-14 19:38:49 +0000 Commit: Andreas Sturmlechner <asturm@gentoo.org> CommitDate: 2024-11-14 19:47:46 +0000 sys-auth/elogind: Revert s2idle default, build w/ xen Switch RemoveIPC default to "no". Bug: https://bugs.gentoo.org/939042 Closes: https://bugs.gentoo.org/939673 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org> sys-auth/elogind/elogind-255.5-r1.ebuild | 179 +++++++++++++++++++++ .../elogind-255.5-no-fchmod_and_chown-tty.patch | 29 ++++ .../elogind-255.5-part-revert-header-cleanup.patch | 41 +++++ .../files/elogind-255.5-revert-s2idle.patch | 138 ++++++++++++++++ 4 files changed, 387 insertions(+)
Removed my patch and installed/tested sys-auth/elogind-255.5-r1. The patches/revert commits have resolved this issue for me. Closing as RESOLVED for now. Thank you.