You are not logged in.

#1 2022-11-17 20:06:59

feluxe
Member
Registered: 2017-12-21
Posts: 14

suspend and hibernate work but suspend-then-hibernate not

Hi there,

I'm trying to configure suspend-then-hibernate for a ThinkPad x280 (intel).

systemctl suspend and systemctl hibernate already work. But for some strange reason systemctl suspend-then-hibernate doesn't...

When I call systemctl suspend-then-hibernate the machine goes into suspend mode and that's it... it doesn't switch from suspend mode into hibernation mode after HibernateDelaySec=30. It stays in suspend mode until I push the power button, then the machine resumes working as expected.

I didn't notice anything suspicious from journalctl. I think it's just missing the part where hibernation kicks in and I have no clue why.

I have this in sleep.conf

[Sleep]
AllowSuspend=yes
AllowHibernation=yes
AllowSuspendThenHibernate=yes
AllowHybridSleep=yes
SuspendMode=suspend
SuspendState=mem standby freeze
HibernateMode=platform shutdown
HibernateState=disk
HybridSleepMode=suspend platform shutdown
HybridSleepState=disk
HibernateDelaySec=30

And this in logind.conf

[Login]
HandleLidSwitch=suspend-then-hibernate
HandleLidSwitchExternalPower=suspend-then-hibernate
HandleLidSwitchDocked=suspend-then-hibernate

I use a swapfile which exists in an encrypted root partition. For that I have this in /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet nowatchdog resume=UUID=470e5624-94cf-4865-8efe-35d549284adc resume_offset=45783050"
GRUB_CMDLINE_LINUX="cryptdevice=UUID=d7e7d236-2ec0-405a-b876-87fa7b3238d5:cryptroot"

I have this in  /etc/mkinitcpio.conf:

MODULES=(i915 intel_agp vfat ext4)
HOOKS=(base udev autodetect modconf block encrypt resume filesystems keyboard fsck)

I searched the web the last couple days for hours and hours, without luck. Does anyone know where I can go from here? I really am stuck here...

Last edited by feluxe (2022-11-17 20:28:55)

Offline

#2 2022-11-17 21:08:24

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,152

Re: suspend and hibernate work but suspend-then-hibernate not

I don't think HibernateDelaySec does what you think.

man systemd-sleep.conf wrote:

       HibernateDelaySec=
           The amount of time the system spends in suspend mode before the RTC alarm wakes the system, before the battery discharge rate can be estimated and used instead to
           calculate the suspension interval.  systemd-suspend-then-hibernate.service(8). Defaults to 2h.

If you look in the journal, you should see it wake after HibernateDelaySec and then go back to sleep.

However, I also suspect you may have set HibernateDelaySec to 30 seconds rather than 30 minutes. At least, judging by the name. The default is set as

#HibernateDelaySec=120min

which specifies the units, so I'd guess you might need

#HibernateDelaySec=30min

or a rather larger number if you keep it unitless.

However, as I say, my reading of the manual page is that the delay is only until the system can better estimate the time it can stay safely suspended before finally hibernating.

Edit: This seems at odds with the wiki.

Last edited by cfr (2022-11-17 21:16:16)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#3 2022-11-17 21:48:35

feluxe
Member
Registered: 2017-12-21
Posts: 14

Re: suspend and hibernate work but suspend-then-hibernate not

Thanks for your reply!

I use HibernateDelaySec=30 for debugging purposes, so that I only have to wait 30 seconds for each config adjustment that I try.

I have another laptop with arch on it, where the settings in sleep.conf are the same. On that laptop hibernation-then-supend works just fine. If you run systemctl suspend-then-hibernat the machine goes into suspend mode, it then wakes up after 30 seconds and goes into hibernation mode. If you set HibernateDelaySec to 1min, it will wake up after 1 minute and then go into hibernation mode, if you set the value to 30min, it will wake up after 30min and go into hibernation mode  and so on.

When I get it to work I will set HibernateDelaySec back to 120min on both laptops.

Offline

#4 2022-11-17 23:04:47

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,152

Re: suspend and hibernate work but suspend-then-hibernate not

Fair enough. After I'd posted, I found the wiki said something different (hence the edit). So the man page's explanation seems really misleading. Apologies for the confusion.

Anyway, I would post a complete journal which includes a failed suspend-then-hibernate, with --no-pager so it doesn't get truncated. I doubt I will be much help, but the experts will want to see the journal.

Edit: Oh, and say if you're dual-booting with Windows and, if so, if you've made sure Fast Start is disabled.

Edit 2: https://github.com/systemd/systemd/issues/25269. It seems this is changed by design and the current official position is that the behaviour you're seeing is fully expected, documented and standard. (According to systemd, of course.) The discussion is mixed up with comments about Manjaro KDE, but the links to systemd documentation might be useful.

This means the wiki was right, but the man page now is and the wiki probably needs updating.

Edit 3: But right at the end of the thread, there seems to be an agreement to provide a distinct option, so you should be able to reinstate the behaviour whenever that gets done.

Last edited by cfr (2022-11-18 01:29:28)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2022-11-18 21:55:49

feluxe
Member
Registered: 2017-12-21
Posts: 14

Re: suspend and hibernate work but suspend-then-hibernate not

Wow, thank you so much for the info! <3  This makes my day, seriously! I was desperately stuck with this.

Edit 2: https://github.com/systemd/systemd/issues/25269. It seems this is changed ....

This is a really bad breaking change, which will effect a lot of people. It cost me a lot time and caused me some pain. sad

But right at the end of the thread, there seems to be an agreement to provide a distinct option, so you should be able to reinstate the behaviour whenever that gets done.

This is the way. I hope they'll revert this soon and add distinct options for the other stuff.

I'll set everything from `suspend-then-hibernate` to `hibernate` for now and wait until the issue is fixed.

Thanks again for your help! smile

Last edited by feluxe (2022-11-18 21:57:18)

Offline

Board footer

Powered by FluxBB