Hybrid S2Idle/Deep Sleep?

I’ve been reading up on different ways Linux systems can sleep. Something I’ve come across is Hybrid sleep, where the system suspends to memory for a certain amount of time (e.g 120 minutes) before going into hibernation.

My system has LUKS encryption enabled, and I have to imagine setting up a swap partition for hibernation with that will be a headache.

So, I had this idea: what if we could use s2idle to temporarily suspend the device and go into deep sleep later, like with hybrid sleep and hibernation? This would be easier for Linux users to configure and would greatly improve idle power drain over longer periods of time.

For me, this would be perfect. Sometimes I close my laptop because I’m walking into another room or putting it in my bag to go to class. The lid would be closed for a few minutes, if not an hour, at most. s2idle is perfect for those situations since it won’t be draining battery idling for too long, and I’d want it to wake up quickly.

But if I leave it overnight on my desk, or I go out for the day, deep sleep is perfect for avoiding the huge idle power drain, and I’d be okay with it taking a little longer to wake up in those circumstances.

The only issue is, I can’t seem to find anything about this online. This worries me a bit because maybe there’s some technical limitation that makes this impractical?

Please let me know your thoughts on this and if you think this is a good idea.

I know it is quite possible to have S2Idle then HIbernate both in Windows and Linux. It does not seem possible to have S2Idle then Sleep. It is either S3 sleep or S2Idle.

It’s really not so bad to get suspend-to-disk working with a LUKS setup. On my NixOS install, it was really just cryptsetup, make partitions on the encrypted disk including one for swap, swapon, do the install.

That will vary by distro and setup of course, but you can expect a shallow rabbit hole. It’s an expected use-case.

That makes sense.

That’s good to hear, I’ll look into this then.

Have you had any issues after waking the laptop (e.g. freezing)?

No issues with hibernate and LUKS. I once had a similar setup with ZFS, and it turns out that’s a very bad idea.

It may depend a bit on your hardware, but in many configurations the difference between s2idle and deep isn’t that big, once you’ve taken care of some big power hogs (it looks like NVMe made most of the difference). So it’s not so clear to me you’d gain much. With hibernate as second stage, however, you drop your drain to near zero so that the RTC battery is now the main limiting factor.

I’m happy to hear that!

Ahhh, this makes so much more sense now. Okay, I’m going to set up hibernation, this seems like a very good way to avoid the overnight power drain issues.

Quick update: Hibernation works flawlessly!

I used this guide if anyone was wondering: Fedora 35 hibernation with swapfile, only for hibernation and resume · GitHub

There’s a comment towards the bottom that describes how to resolve a framework-specific freezing issue too!