[RESPONDED] Linux deep sleep

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:


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


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!



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

@Carlos_Fernandez_San "uname -a output"
Linux my-fedora 5.14.12-300.fc35.x86_64 #1 SMP Wed Oct 13 14:16:09 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

No luck for with 5.14.12 from Ubuntu. I checked the changelog from fedora and there’s a lot of changes there so probably one of them is what I need, but who knows :slight_smile:

I’ll stick to 5.12 for now.

PSA, just because I spent way too much time finding these, the datasheet is listed here: Intel Core i51135G7 Processor 8M Cache up to 4.20 GHz Product Specifications
It supports S3, S4, and S5. S3=deep. S0=s2idle.

Linux states and files explained: System Sleep States — The Linux Kernel documentation

Both documents do a good job explaining things. In the datasheet search for “ACPI”.

FWIW I’d like to get hibernation working, but this looks like more time than I have right now.


More good stuff, I found this:

And using the instructions, the low_power_idle_system_residency_us counter is indeed increasing, and resuming from standby is dramatically better than deep. I will try this overnight and post my results.

31% loss in 4 hours. I am most disappointed. edit: this is fedora 35 beta, I will reply if it gets any better over time but I’m not feeling hopeful.

That’s odd. As I posted at the link below, I’m also on Fedora 35 beta but I’m seeing the same amount of battery loss in 11 hrs of suspend as you are in 4 hrs. What “Power Saver” profile are you using?

Looking forward to hearing your results. Because 2% in 2 hours is excellent.

Oof, looks like I’ll need to do some tweaking because the numbers are a lot worse than I’d like for battery life under suspend… These numbers are still from s2idle – I haven’t touched any suspend related configs.

My setup:

  • DIY edition
  • i7 65G version
  • 32GB DDR4 memory
  • 1TB PCIe gen3 nvme
  • 2 USB-C + 1 USB-A + 1 MicroSD cards
  • Arch (stock kernel 5.14.14)

I was at 80.2% last night.
I dropped to 48.6% from 11hrs + 17min suspend time.

That’s about 2.8% lost per hour.

Just another data point: 19% over 12 hours with deep sleep enabled

  • DIY Edition
  • i5-1135G7
  • 16GB DDR4 (single SODIMM)
  • 512GB gen3 NVME
  • 2 USB-C + 2 USB-A
  • Fedora 34 (kernel: 5.13.19-200)

That is really great. I think the amount of RAM factors in here rather significantly. I have 64GB on mine, and I’m guessing I’ll see something closer to hspak.

I suspended at 67% just now.

Is there a decent solution to battery-drain post-install on Fedora 35 yet? Deep sleep didn’t bother me initially, but the amount of time it’s been taking to resume from sleep has been unacceptable for me. I’m open to figuring out hibernation, but it doesn’t seem like it’ll solve much in terms of wake time.

How much wake time delay are we talking about here? If you’re going to save more battery during sleep, sounds like a pretty good tradeoff to me.