Skip to main content
Topic: Suspend to RAM works through /sys/power/state, but not using loginctl (Read 3692 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Suspend to RAM works through /sys/power/state, but not using loginctl

Hi,

I have a problem with a fresh install on an ASUS NUC 14. I'm trying to get suspend to RAM to work.

When I set the system to sleep by doing "echo mem > /sys/power/state" as root, suspend works. The system immediately sleeps, the power button flashes. As soon as I press a button on the keyboard, it wakes up again – everything as expected.

The problem is that suspending through KDE's Powerdevil does not work: If I do this, it takes a moment, then the power button begins to flash in a different color. Then, the system turn off completely, and then it reboots.

The same happens when I try to trigger the suspend by "loginctl suspend".

So, suspending seems to work – but not in the way Powerdevil does it. How can I debug this? Thanks for all help!

Re: Suspend to RAM works through /sys/power/state, but not using loginctl

Reply #1
Do you have the standard elogind installed and active?
Pls provide more info on the related setup.

artist

Re: Suspend to RAM works through /sys/power/state, but not using loginctl

Reply #2
Both elogind and the respective init script are installed:
Code: [Select]
# pacman -Ss elogind
system/elogind 255.17-2 [Installiert]
    The systemd project's logind, extracted to a standalone package
...
system/elogind-openrc 20210704-1 [Installiert]
    OpenRC elogind init script
...
And it's also started:
Code: [Select]
# /etc/init.d/elogind status
 * status: started
It also actually does run:
Code: [Select]
# ps -ef | grep elogind
root      1181     1  0 12:50 ?        00:00:00 supervise-daemon elogind --start /usr/lib/elogind/elogind --
root      1182  1181  0 12:50 ?        00:00:00 /usr/lib/elogind/elogind
root      4090  3890  0 12:55 pts/0    00:00:00 grep --colour=auto elogind
What info do you need? It's a fresh Plasma/KDE install using OpenRC, step by step installed according to the wiki …

Re: Suspend to RAM works through /sys/power/state, but not using loginctl

Reply #3
I just tried the Plasma/OpenRC live CD to see if it would work from there (and I just have some strange config or so). When I trigger a suspend to RAM from Plasma there ("Sleep"), the behavior is exactly the same. Does not work as it should.

I don't get why writing /sys/power/state directly works, and invoking loginctl (I suppose that's what Plasma does) not … doesn't loginctl finally do the same at some point?!

Re: Suspend to RAM works through /sys/power/state, but not using loginctl

Reply #4
Did you check the log files in /var/log for errors/clues?

And for info: writing to /sys/power/state directly has the action performed immediately, so without the required disk flushing and syncing which might result in data loss/corruption.

artist

Re: Suspend to RAM works through /sys/power/state, but not using loginctl

Reply #5
The log looks a bit odd … There's "[e-suspend] Performing sleep operation 'suspend'...", followed by some binary blob apparently, displayed as a lot of "^@"s. Then, without even a newline, the reboot starts:
Code: [Select]
Jun 17 15:52:09 [polkitd] Registered Authentication Agent for unix-process:4421:775529 (system bus name :1.67 [/usr/bin/pkttyagent --notify-fd 6 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale de_DE.UTF-8)
Jun 17 15:52:09 [kernel] [ 7756.052284] elogind[1176]: The system will suspend now!
Jun 17 15:52:09 [e-suspend] Performing sleep operation 'suspend'...                   
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Jun 17 15:53:00 [kernel] [    0.000000] Linux version 6.15.2-artix1-1 (linux@artixlinux) (gcc (GCC) 15.1.1 20250425, GNU ld (GNU Binutils) 2.44.0) #1 SMP PREEMPT_DYNAMIC Wed, 11 Jun 2025 07:37:25 +0000
Jun 17 15:53:00 [kernel] [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=4a28eedc-9ccf-4ad1-8969-4c3ab0a2c7b8 rw loglevel=3 quiet
Jun 17 15:53:00 [kernel] [    0.000000] x86/split lock detection: #AC: crashing the kernel on kernel split_locks and warning on user-space split_locks
Jun 17 15:53:00 [kernel] [    0.000000] BIOS-provided physical RAM map:
Jun 17 15:53:00 [kernel] [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable
Jun 17 15:53:00 [kernel] [    0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009efff] reserved
Whereas a "echo mem > /sys/power/state" suspend and wakeup look like this:
Code: [Select]
Jun 17 16:04:03 [kernel] [  673.840382] PM: suspend entry (s2idle)
Jun 17 16:04:03 [kernel] [  673.842697] Filesystems sync: 0.002 seconds
Jun 17 16:04:08 [kernel] [  673.855324] Freezing user space processes
Jun 17 16:04:08 [kernel] [  673.858877] Freezing user space processes completed (elapsed 0.003 seconds)
Jun 17 16:04:08 [kernel] [  673.858894] OOM killer disabled.
Jun 17 16:04:08 [kernel] [  673.858897] Freezing remaining freezable tasks
Jun 17 16:04:08 [kernel] [  673.860299] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
Jun 17 16:04:08 [kernel] [  673.860309] printk: Suspending console(s) (use no_console_suspend to debug)
Jun 17 16:04:08 [kernel] [  673.917286] serial 00:02: disabled
Jun 17 16:04:08 [kernel] [  673.920198] serial 00:01: disabled
Jun 17 16:04:08 [kernel] [  673.920375] r8169 0000:01:00.0 eth0: Link is Down
Jun 17 16:04:08 [kernel] [  674.058688] ACPI: EC: interrupt blocked
Jun 17 16:04:08 [kernel] [  679.021300] ACPI: EC: interrupt unblocked
Jun 17 16:04:08 [kernel] [  679.073553] spd5118 11-0050: Failed to write b = 0: -6
Jun 17 16:04:08 [kernel] [  679.073557] spd5118 11-0050: PM: dpm_run_callback(): spd5118_resume [spd5118] returns -6
Jun 17 16:04:08 [kernel] [  679.073568] spd5118 11-0050: PM: failed to resume async: error -6
Jun 17 16:04:08 [kernel] [  679.074061] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/tgl_guc_70.bin version 70.44.1
Jun 17 16:04:08 [kernel] [  679.074064] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc.bin version 7.9.3
Jun 17 16:04:08 [kernel] [  679.077198] i915 0000:00:02.0: [drm] GT0: HuC: authenticated for all workloads
Jun 17 16:04:08 [kernel] [  679.077845] i915 0000:00:02.0: [drm] GT0: GUC: submission enabled
Jun 17 16:04:08 [kernel] [  679.077847] i915 0000:00:02.0: [drm] GT0: GUC: SLPC enabled
Jun 17 16:04:08 [kernel] [  679.078171] i915 0000:00:02.0: [drm] GT0: GUC: RC enabled
Jun 17 16:04:08 [kernel] [  679.139655] serial 00:01: activated
Jun 17 16:04:08 [kernel] [  679.153997] serial 00:02: activated
Jun 17 16:04:08 [kernel] [  679.254729] nvme nvme0: 8/0/0 default/read/poll queues
Jun 17 16:04:08 [kernel] [  679.881962] r8169 0000:01:00.0 eth0: Link is Down
Jun 17 16:04:08 [kernel] [  679.884194] mei_hdcp 0000:00:16.0-b638ab7e-94e2-4ea2-a552-d1c54b627f04: bound 0000:00:02.0 (ops i915_hdcp_ops [i915])
Jun 17 16:04:08 [kernel] [  679.885253] mei_pxp 0000:00:16.0-fbf6fcf1-96cf-4e2e-a6a6-1bab8cbe36b1: bound 0000:00:02.0 (ops i915_pxp_tee_component_ops [i915])
Jun 17 16:04:08 [kernel] [  679.885666] OOM killer enabled.
Jun 17 16:04:08 [kernel] [  679.885672] Restarting tasks ... done.
Jun 17 16:04:08 [kernel] [  679.888088] random: crng reseeded on system resumption
Jun 17 16:04:08 [kernel] [  679.888145] PM: suspend exit

 

Re: Suspend to RAM works through /sys/power/state, but not using loginctl

Reply #7
@artoo : Setting "SuspendMode" to "s2idle deep" in /etc/elogind/sleep.conf.d/10-elogind.conf did the trick. You saved me! Thanks a lot!!!

I spent like an hour googling … I must admit that I didn't search the forum though, sorry about that.

Anyway, it does work like a charm now :-D

Re: Suspend to RAM works through /sys/power/state, but not using loginctl

Reply #8
This should be documented somewhere. I really found nothing …

We have /etc/elogind/sleep.conf and /etc/elogind/sleep.conf.d/10-elogind.conf … my first try was to check https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate – which is of course about systemd stuff.

Anyway, there's something about s2idle in there, and how to mess with /sys/power/mem_sleep and kernel parameters to change it … but I didn't really get the problem or that is was, in fact, really easy to fix …


Re: Suspend to RAM works through /sys/power/state, but not using loginctl

Reply #10
Similar issue, my system can't go to sleep. I'm using runit and zzz command. I don't have swap.