Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 939042 - sys-auth/elogind-255.5 Suspend to RAM fails to work properly
Summary: sys-auth/elogind-255.5 Suspend to RAM fails to work properly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Andreas Sturmlechner
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 943566
  Show dependency tree
 
Reported: 2024-09-04 11:20 UTC by Weezer
Modified: 2024-11-15 22:34 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
sleep-config.patch (sleep-config.patch,649 bytes, patch)
2024-09-08 10:26 UTC, Weezer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Weezer 2024-09-04 11:20:28 UTC
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.
Comment 1 Holger Hoffstätte 2024-09-05 08:25:00 UTC
Confirmed, same problem on my Zen2 Thinkpad.
Comment 2 Holger Hoffstätte 2024-09-05 08:53:15 UTC
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.
Comment 3 Weezer 2024-09-05 09:48:10 UTC
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!
Comment 4 Holger Hoffstätte 2024-09-07 07:56:42 UTC
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.
Comment 5 Andreas Sturmlechner gentoo-dev 2024-09-07 12:08:16 UTC
*** Bug 939284 has been marked as a duplicate of this bug. ***
Comment 6 James Le Cuirot gentoo-dev 2024-09-07 21:18:46 UTC
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
Comment 7 James Le Cuirot gentoo-dev 2024-09-07 21:49:38 UTC
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?
Comment 8 Weezer 2024-09-08 10:26:48 UTC
Created attachment 902360 [details, diff]
sleep-config.patch

sleep-config.c test patch
Comment 9 Weezer 2024-09-08 10:35:02 UTC
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.
Comment 10 Larry the Git Cow gentoo-dev 2024-11-14 19:51:44 UTC
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(+)
Comment 11 Weezer 2024-11-15 11:03:08 UTC
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.