[RESPONDED] Linux deep sleep

To be more accurate, you can force the activation of S2idle deep sleep on Linux, BUT the hardware does directly support it. This means while the laptop appears to be sleeping, and ‘is’ I’ve observed it using ridiculous amounts of power. Something like 15% in a 5 hour period.

As the Mandolorian say, hibernation is the way. At least for now.

s2idle and deep are different things. s2idle is the “light” sleep, deep is the power-saving one.

How did you determine that the hardware doesn’t support deep sleep? When I enable deep sleep (which the hardware at least claims to support), resumption takes significantly longer so something is happening.

1 Like

I have it enabled on mine, but I have no way of knowing if it is in fact using deep sleep or not. Mine is not taking long to resume from sleep at all. Near instant.

Edit: I have verified using the below command that deep is reported. What I mean is that I have no way of knowing when I close the lid that deep sleep has actually been entered.

Fedora 35 is reporting “[s2idle] deep”.

2 Likes

@Kevin_Wilson In theory, echo deep | sudo tee /sys/power/mem_sleep will switch to “deep” sleep. But @2disbetter is right that the laptop is still drawing power (I haven’t tested how much of a difference it makes).

I’m not sure of the context so I just want to possibly clarify the meaning of that output. It means that s2idle is enabled, and deep is not. These two posts may be helpful:

Yes, that does work. It’s showing “s2idle [deep]” now. I haven’t checked the battery drain yet, just what the kernel reports.

2 Likes

hey there guys iḿ running the framework laptop on Ubuntu 21.04 and so far so good the only problem i’ve had is Deep Sleep: I have enabled and had to disable deep sleep about 3 times now, whenever i enable it and go to sleep the laptop just freezes and i can do nothing, i need to power off, reboot, and rollback the change, else it freezes again. any clues?

1 Like

Kernel 5.12 is what works for me, including sleep.
5.14 doesn’t work at all - it freezes and never actually goes to sleep.

yup have kernel 5.14 i’ll downgrade and give it a try, but does it consume less batery on sleep?

I haven’t done any kind of battery test to be honest - I always have it plugged in.

These numbers are very unscientific but I use Solus with the 5.14 kernel and deep sleep works for me.

The battery drain when in sleep mode however, is not very good. I did a few tests when I was asleep where I’d charge fully and put the laptop to sleep in both s2idle and deep sleep. Deep sleep drained about 35% of the battery in 7 hours where s2idle usually either died or had only 10% battery or so remaining.

s2idle also came with the issue of the system no entering the higher idle states such as c8-c10 whenever it woke up where only a reboot seems to fix it. Deep sleep didn’t have that issue.

Using Fedora 35 (beta) with mem_sleep configured with deep enabled. Battery is at 100% as of writing this. I’m going to unplug and put into sleep mode for the night. I’ll log time of day of sleep and wake along with battery percentage. I’ll post results tomorrow morning.

1 Like

What exact kernel version is it and how do you configure those things? I’ll give it another go.

My OS is Fedora 35 Beta with the 5.14 Linux kernel. This version gave me “everything works out of the gate” status. Aside from installing KDE-DE (not a gnome fan), I didn’t have to download anything else for this system to “just work.” As far as tweaking the battery, I’ve done several things so far. Just note that I haven’t measured any of the changes I’ve made so I don’t have hard results. My test tonight is really the first one I’ve done.

But back to what tweaks I’ve made. I installed TLP so I can manage power settings while on battery mostly but it allows for optimization while plugged in. You basically edit the configuration file enabling features you want and the values of those features. While on battery, anything and everywhere I could, I ensured it was in powersave and/or powersupersave modes. Ill post a cat tlp.conf of my system so you can get an idea of what I did.

The other thing I did was change my mem_sleep parameter from s2idle to deep state. I was having issues initially trying to do this until I figured out that you have to be completely in root in order for the changes to go into effect. You can’t even simply type sudo in front of the command as it will still deny permission.

Each OS might be a little different in how you implement this change but since you and I are running Fedora, I’ll cover what I did. I ran the “echo deep > /sys/power/mem_sleep” terminal command in superuser mode (remember). I ran cat on the file to double check the change and it did change. The next thing I did was change the grub.conf file so it would always be enabled on startup and forego having to repeat all these steps every time. You do this by typing mem_sleep_default=deep on the GRUB_CMDLINE_LINUX string. Make sure it’s within the quotations and at the end of the string. Lastly, you just need to rebuild the GRUB by typing sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

That should do it. Just reboot the system and double check the file with cat again to see if the changes took effect. I’ll post some screenshots tomorrow for a visual guide.

I hope this helps out.

UPDATE I had to go onto my FW to reference something so it killed my overnight test (I’ll restart). But, to give you an idea of the power savings I have now: I went from 100% full battery to 97% in just over 2.5 hours of time. A loss of 3%. I normally sleep 6-8 hours so we are roughly talking anywhere between 10-12% battery charge degradation overnight. I’ll take it. :raising_hand_man:

11 Likes

UPDATE Just woke up and checked my battery charge level. Basically in a 9 hour period, it dropped 20% with deep enabled.

3 Likes

That is fantastic. That surpasses Windows significantly. We are loosing 5% in 1-2 hours of standby, before it then auto hibernates.

I am using Windows 11, but I think I will dual boot Fedora just so I can have standby that actually will standby. I love hibernation, but I want to be the one the uses it, and not the OS. However, with standby eating 5% in 1 or 2 hours you don’t really have a choice. 8 hours would be 20% to 40% battery, BUT you can’t actually get windows to NOT use hibernation.

I’m sure a fix is coming for that so I’ll be keeping Windows 11, as everything else regarding battery life there is better when using it, especially for gaming.

I’ve found full hibernation to be much preferable to deep sleep. I have my framework running Fedora 34 and configured to transition that at +3 minutes it blanks the screen, at +10 minutes it suspends (in standard s2idle), and at +20 minutes it hibernates. This seems ideal in terms of power usage for me, as hibernation will then use 0 power, but was not straightforward to configure. I turned this setup (and some power-conserving tweaks) into a script which I placed here:

(NOTE: This script has been written against a Fedora 34 installation)

The only manual steps needed aside from this script were to disable UEFI Secure Boot and setup a swap partition of the appropriate size (RAM + 4GB) during installation. After that, you can tweak your delays in the top of that script and run the script as root. It’s a fairly simple script that just sets up the appropriate config files and rebuilds the boot image.

(If anyone knows a post-install way to resize the default filesystems, I’d be happy to include those steps in the script to further streamline this. Also, please feel free to port to other distros and submit some patches to the repo.)

Best of luck!

Dan

4 Likes

s2idle dropped me to 48% charge overnight (~10-12 hours). Switching to deep, I lost 2% over two hours when I tested it today. I’ll do an overnight soak and see how it holds up over an extended period.

1 Like

What’s the output of
uname -a
?

I’m trying to find out if there’s an exact version that will work for me. I’m not using Fedora but Ubuntu. I wouldn’t mind switching but I’m using regolith’s prepackaged i3 system and I like it a lot. It’s Ubuntu only I think, and I don’t want to go into the rabbit hole of getting it to work with Fedora :slight_smile:

BTW for now I’d be happy if sleep (any) worked (as in it, well, sleeps the computer and it stops making noise). I’m looking at my config and is s2idle. For me that’s acceptable because my laptop is always plugged in, and I love the instant power on.

But it won’t work on kernel 5.14.13