• Welcome to Peterborough Linux User Group (Canada) Forum.
 

Hibernation and other energy modes in Linux distros

Started by Jason, December 30, 2018, 10:05:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jason

Quote from: fox on December 30, 2018, 07:25:45 AM
Interesting also is that when running in Windows, closing the lid seems to invoke a deeper sleep state (judging by energy loss), but if left that way for more than an hour, it doesn't wake up at all and has to be rebooted. I'm sure that this isn't appropriate behaviour.


If you're using the version of Windows that came with the laptop, they likely configured it for you for maximum power saving, what they call hybrid-sleep, a combination of sleep and if not used for a while, it goes into hibernation. With hibernation, you will likely have to press the power button to bring the laptop back to life which is what you're saying? That's normal for hibernation from what I understand.

I think that Intel Rapid Restart does the same thing but in hardware instead of software or maybe it just allows this functionality in the OS. Not really sure.

I'm testing this on my laptop with Manjaro. I had reset my BIOS to factory settings a while back and had Intel Rapid Start on though I never noticed a battery loss because I usually just leave my laptop on trickle charge so it's full whenever I take it anywhere. Manjaro had the options Shutdown, Hibernate, Sleep (maybe called suspend) and I think hybrid sleep which I've never seen before on a distro shutdown menu before. Anyway, while leaving Rapid Start on with 2 hours set from hibernate to sleep mode (the default), I chose to "hibernate" in Manjaro. After 8 hours, it went down about 13%. Now I've turned off Rapid Start and will see how much it loses.

Oh, and S4 is hibernation mode. Intel Rapid Start is like S3 for a while and then it switches to S4. But it seems the power modes aren't as cut-and-dried as I thought and this page says that some systems might only be able to "wake" only from S1 and not deeper states.

https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/system-sleeping-states
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

ssfc72

Maybe a new topic should be started and called, Hibernate mode in Linux distro.
Mint 20.3 on a Dell 14" Inspiron notebook, HP Pavilion X360, 11" k120ca notebook (Linux Lubuntu), Dell 13" XPS notebook computer (MXLinux)
Cellphone Samsung A50, Koodo pre paid service

fox

Quote from: Jason Wallwork on December 30, 2018, 10:05:19 AM
I'm testing this on my laptop with Manjaro. ...., while leaving Rapid Start on with 2 hours set from hibernate to sleep mode (the default), I chose to "hibernate" in Manjaro. After 8 hours, it went down about 13%. Now I've turned off Rapid Start and will see how much it loses.
....
I'll be most interested to see your result without Rapid Start. 13% after 8 hours is better than I was getting (2% drop per hour), but some of that could be a bigger battery in your laptop. But even at your rate, leaving the laptop 24 hours at a time in that state isn't really feasible; much better to just shut it down if you don't plan to come back to it in a few hours or less.

Interesting that you have a Rapid Start option on your laptop at all, since it's older than my 2015 xps 13. I never looked at what options were selected on this and I don't recall playing around with it. But energy loss in that xps is minimal when the lid is closed (hibernation presumably). I can leave it for 24 hours at a time, use it a bit, put it back to sleep, etc. and it only needs to be charged once a week.

Ubuntu 23.10 on 2019 5k iMac
Ubuntu 22.04 on Dell XPS 13

Jason

Quote from: ssfc72 on December 30, 2018, 12:13:09 PM
Maybe a new topic should be started and called, Hibernate mode in Linux distro.

Done! For anybody interested in the original discussion that sprouted off this topic, you can find it here.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

Jason

Quote from: fox on December 30, 2018, 05:30:00 PM
I'll be most interested to see your result without Rapid Start. 13% after 8 hours is better than I was getting (2% drop per hour), but some of that could be a bigger battery in your laptop. But even at your rate, leaving the laptop 24 hours at a time in that state isn't really feasible; much better to just shut it down if you don't plan to come back to it in a few hours or less.


Okay, so turned off Intel Rapid Start, booted up Manjaro and chose Hibernation from the Shutdown menu. And after 19 hours, the battery is down 18%.
So I went from ~1.5% / hour to ~1% / hour by turning off Intel Rapid Start.

A lot of that difference could be due to the Intel Rapid Start going into S3 mode (I assume) for two hours and then S4 after that in the original test. But still I didn't expect to lose ~1 % / hour, was surprised at that. I figured that hibernation mode would be the same as power off (with rapid start off). But I haven't tried it with power off yet, so that's next.

As you noted, you can't really compare % change in battery from one laptop to another. As the Microsoft doc points out, the various power modes aren't handled exactly the same way from system to system. Age of the battery, both shelf time and number of recharge cycles used also have an effect.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

fox

The lower 1%/hour rate is just at the margin of usable in constant "standby" mode. At that rate, with an hour or so of daily use, the laptop would have to be recharged every 3 days. With the same amount of use but shutting it off if not being used in the next few hours, my laptop would have to be recharged about once a week, but I wouldn't have the benefit of instant-on in Linux. If I can't figure out how to do better than that (bearing in mind that my battery is smaller than yours), I will adapt to the new situation and just shut it off when not using it.

However, I did come up with a suspend fix that I haven't tried yet:

Install sysfsutils and add the following file to your system:
Quote$ cat /etc/sysfs.d/suspend_dell_9365.conf
# Changes from https://bugzilla.kernel.org/show_bug.cgi?id=192591

# Use s2idle (not deep) for suspend.
power/mem_sleep = s2idle

# Enable key press to wakeup
devices/platform/i8042/serio0/power/wakeup = enabled

# Disable heartbeat wakeups during suspend.
module/acpi/parameters/ec_no_wakeup = Y

I haven't tried this yet, but I will. Perhaps you could try it as well and see if this makes a difference on your system.


Ubuntu 23.10 on 2019 5k iMac
Ubuntu 22.04 on Dell XPS 13

Jason

What does the suspend fix, well, fix?

I ask because I've been testing hibernate though I guess with Rapid Start enabled, it doesn't actually hibernate until the delay time on it expires.

Honestly, power-wise, it would be better if we call just shutdown our machines entirely for the sake of the environment, especially if we don't use them for a while which I guess is the point of rapid start. If you don't use your machine within the amount of time that is set, it goes into full hibernate though I think shutdown would be better if hibernate actually uses more power (I didn't think it would use any, honestly).
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

fox

I see your point, although it should be put into context. If one can hibernate for 24 hr and use less than 10% of a full battery charge, the amount of power consumed is very small compared to other measures one can take to save energy/reduce greenhouse gases. I'm not saying one shouldn't do it for that reason, but like everything else, the decision involves trading off resource use for convenience. I save orders of magnitude more energy than this by biking to work. On the other hand, if you believe the Ecological Footprint models, I have a larger footprint than the average person, even with my biking and conservation measures at home, simply by flying somewhere several times a year.
Ubuntu 23.10 on 2019 5k iMac
Ubuntu 22.04 on Dell XPS 13

ssfc72

Another aspect to consider is the charge cycle, your Li-ion battery is being subjected to.

Even though the Li-ion technology of the battery may tolerate deep cycle charging of the battery, I don't feel it is good for the battery, if it's charge is let to drop to a low percentage.
I think it is better for the Li-ion battery, if the charge of the battery is not allowed to go to a low percentage, on a repeated basis.
Mint 20.3 on a Dell 14" Inspiron notebook, HP Pavilion X360, 11" k120ca notebook (Linux Lubuntu), Dell 13" XPS notebook computer (MXLinux)
Cellphone Samsung A50, Koodo pre paid service

buster

I agree with Bill. The battery is usually tested for the number of 'recharges' it's capable of. And it is not unlimited. My devices are often plugged in and/or off.

And ultimately, the time I would spend making all my systems hibernate with low battery use could not be regained with fast boots until I am,by my calculations, 137 years old.

Growing up from childhood and becoming an adult is highly overrated.

fox

Quote from: ssfc72 on December 31, 2018, 02:33:47 PM
....
Even though the Li-ion technology of the battery may tolerate deep cycle charging of the battery, I don't feel it is good for the battery, if it's charge is let to drop to a low percentage.
....
In my case, I have warnings set for below 20% and I try to recharge before that point. I would do this regardless of whether I use prolonged hibernation or just stop the battery drain by shutting off the laptop when I'm finished with it. I think my calculations in an earlier post take that into account but if not, I would recharge by the 20% criterion, not the amount of elapsed time.
Ubuntu 23.10 on 2019 5k iMac
Ubuntu 22.04 on Dell XPS 13

fox

Quote from: buster on December 31, 2018, 04:27:38 PM
....
And ultimately, the time I would spend making all my systems hibernate with low battery use could not be regained with fast boots until I am,by my calculations, 137 years old.
You already are 137 years old, Buster!  :)

Having said that, you are probably right, but are still making the argument for hibernation. I would guess that starting Ubuntu from scratch and shutting it down take about 40 seconds in total. Closing the laptop is more or less instantaneous, and signing in when the laptop is re-opened probably takes 10 sec. I don't know what the delay would be if Rapid Start isn't enabled. If it was more than 20 sec, I would say that the time saving of hibernating the laptop (for long periods of time) would not make it worth doing.

This is an interesting thread! I got this idea of long-period hibernation of a laptop from the way phones and tablets work. I use my laptop more or less like a tablet when I'm not traveling or making presentations. I never thought about the trade-offs of laptop hibernation vs shutdown until now. Hypothetically, the same arguments apply to a tablet. Do any of you actually shut down your tablets when you aren't using them for a day or so?
Ubuntu 23.10 on 2019 5k iMac
Ubuntu 22.04 on Dell XPS 13

buster

" Do any of you actually shut down your tablets when you aren't using them for a day or so?"

Even for part of a day sometimes. Always at night. If I'm making tea or coffee in the morning I really don't care about the boot time.
Growing up from childhood and becoming an adult is highly overrated.

fox

Quote from: buster on December 31, 2018, 04:59:57 PM
" Do any of you actually shut down your tablets when you aren't using them for a day or so?"

Even for part of a day sometimes. Always at night. If I'm making tea or coffee in the morning I really don't care about the boot time.
I asked about your tablet, not your laptop. I didn't even know you had a tablet. If you literally shut down your tablet between uses (as opposed to sleeping it), you're the only person I know who does this.
Ubuntu 23.10 on 2019 5k iMac
Ubuntu 22.04 on Dell XPS 13

buster

"you're the only person I know who does this"

That makes me feel good! As you know, the genius treads a lonely trail.

Every night all the electronics at our house go off and are plugged in, including three computers, two tablets and one phone.
Growing up from childhood and becoming an adult is highly overrated.