Can we not try to force s2idle? It uses way too much power. I've not yet seen a laptop which is capable of staying "sleeping" in s2idle as long as in s3 sleep. Correct me if I'm wrong though.
I also don't really get why: s3 is more than fast enough to be awake when my laptop is open and I'm ready to login, the only "need to be faster" way I can see is when you do not lock you laptop and go straight to desktop but that has ... issues.
Microsoft tried very hard to make desktop chips behave like mobile phones. I can see why, especially with SSDs, there's absolutely no reason why we should shut down a computer but keep our phones on 24/7 with instant wake.
The problem is that a lot of laptop manufacturers, driver authors, UEFI firmware vendors, and you name it, don't exactly have power savings as a first priority. On some select devices, s2idle works great and it's just like sleep but faster. On many other devices, there are bugs and issues that just break shit.
At this point, I have more faith in a brand new Linux install going to sleep successfully than a Windows install staying the fuck off. It's quite annoying, especially since I know every modern CPU has full support for this and the issues just lie in software elsewhere on the board.
If you've got an SSD, the easiest fix is to switch to S4/hibernation/suspend to disk. You can remap the power button/laptop close handler. You may need to enter your drive encryption key again when you resume (which is probably more secure anyway) but your sleep will work reliably and it'll consume no power at all, unlike S3 sleep.
I have an employer issued Windows laptop. I have it connected to a charger on my desk almost all day. It is very often the case, that I close the lid and after some time it gets hot and the fan gets very loud. I always wonder: "what the fuck is this stupid machine doing?", it can't be an update, because Windows is incapable of doing unattended updates without a restart. After I open the lid the next day nothing seems to have happened. Same with my wife's work laptop. Her laptop is even worse, because sometimes it will play the sound of an incoming e-mail in the middle of the night.
Hibernating when you have 32 G of requires more than that for swap. That's not negligible on a 512 G SSD.
And copying 32 G is not instantaneous neither. I bet a fresh boot is faster, defeating a big part of the purpose of suspend for me (part of it is finding my workspace where I left it, sure, but also being able to quickly wake up the laptop).
systemd supports "suspend-then-hibernate" which I think works now.
That said, systemd fucked the hell out of this feature and then the devs started gaslighting people about it[0][1]. That was on top of the fact that their "fix" broke the setting entirely and when you suspended your laptop it would never resume, guaranteeing a reboot and lost data (which ironically was their premise for "fixing" it in the first place). They really tried to get people to believe that a nearly dead battery 8 hours from now was preferable to hibernating after X minutes and resuming with a nearly full battery. On a motherfucking laptop.
Sigh. Just when I was starting to accept systemd they go and do that shit. Words cannot express how pissed I still am from that github thread and them breaking my laptop from a basic ass fucking system fucking mother fucking fucking upgrade. Fuck systemd.
Wow, I was going to say that I'm tired of this systemd trashing. systemd is a very nice piece of software and does not deserve all the hate it gets.
However, this one is pretty bad indeed. Also, respecting this one setting they had does not seem very complex, I'm not convinced by their way of rejecting the request to restore it.
Seems like the OS should be able to store only the active working memory and silently discard stuff like disk cache when hibernating, so the hibernate would only be slow if you really had the machine seriously loaded up with work. Maybe if you're doing heavy duty video editing? Or VMs I guess.
I wish I had more trust in laptops to properly handle putting itself into S2 when I close the lid, and then after 30 minutes (or if the battery gets low) go down into S3. But I've seen far too many laptops just fail to properly suspend for whatever reason.
On my aging Windows ThinkPad with 32GB of RAM, my hiberfil.sys is ~12GB, so you would be correct. As for S2 moving to S3, this is similar to how I’ve been using the system for years; close the lid and I get S2 or S3 (haven’t looked to see which one)—if the battery charge hits a certain level, the system moves to S4/hibernates.
> And copying 32 G is not instantaneous neither. I bet a fresh boot is faster, defeating a big part of the purpose of suspend for me (part of it is finding my workspace where I left it, sure, but also being able to quickly wake up the laptop).
How much you need to copy should depend on how much you have open, which should relate pretty strongly to how annoying a reboot is.
They also tried to screw over Linux when standardizing it:
> In 1999, then Microsoft CEO Bill Gates stated in an e-mail that Linux would benefit from ACPI without them having to do work and suggested to make it Windows-only.
My Windows laptop from work loves to have the mouse, keyboard and/or wifi fail to wake up properly if it gets disconnected from its badly-designed power cord, despite constantly making me install the latest drivers.
I remember working on sleep/wake and resume bugs and they can be hairy, especially when a device powers off. Some devices have firmware initialization, hidden state and it's corner cases all the way down.
Apple has always very tightly controlled what components go on their mobo's, and wrote their OS and application stack with that specific hardware in mind.
I've had a 2017 MBP: it goes to sleep, continues to check email etc, and wakes up the next day with an almost full battery. I don't have any M1 Macbooks but I can imagine they could stay awake and have 90% battery left the next day.
Macs also continue responding to pings and accepting SSH connections on wired Ethernet while sleeping. I've had less luck with inbound SSH over Tailscale, but I can use any other device on the network as a jumphost.
Can I get my S4 back? I've never had issues with it, as opposed to constant S2/3 issues, and the startup is still faster than having to look for a cable because S2/S3 managed to drain all the battery.
What is the current situation with sleep states? I've been seeing lots of conversations the last two years and I just don't have a big level picture of why it's such an issue now.
I only use S4 (hibernate) because I can ignore my laptop for weeks at a time, unplugged, and jump right back in to where I left off. Microsoft seems to have changed some things in Windows to hide the hibernate option for some reason I can't figure out.
Hibernate isn't great if you have lots of RAM. Windows won't allow you put the hiberfil.sys anywhere other than C:\. I was confused as to why my C: SSD appeared full until I figured it was because of hibernation (I have 128GB RAM).
It's a shame hyberfil.sys can't be moved, but as I understand it, the reason behind it is that the kernel only has an extremely rudimentary NTFS driver at the point it resumes so I don't think it'll change soon.
That said, with modern SSD prices I think the size it takes up is quite reasonable these days. For a while, when people were running 64GiB SSDs, the situation was a lot worse.
People also use hibernation on desktops, servers and VMs (traditionally when normal suspend has problems, but maybe nowadays when s2idle has insomnia problems).
Depends on the vintage. Up to about 2015 a 128 GB workstation config typically had a <= 512 GB boot SSD and some spinning disk as well.
In servers it's actually quite nice in homelab style setups where you might want to preserve your working session states, or just doing it on a nightly schedule without worrying about losing work.
For VMs it's of course useful to persist vm state to disk and suspend for lots of reasons (don't keep the RAM reseved, or free up VFIO passhthrough hardware for instance). But people often use hypervisor based snapshot for this. One advantage guest OS supported hibernation has it that your guest is aware of its own power state changes and can run your configured power management event hooks on suspend and wake. In the VFIO reddit it seems to be common for people who do windows vm gaming with gpu passthrough to prefer guest hibernate to hyprevisor side snapshots as well, not sure what are the main advantage there.
> In servers it's actually quite nice in homelab style setups where you might want to preserve your working session states, or just doing it on a nightly schedule without worrying about losing work.
At this point it's a server in the name only. Even Supermicro takes ages to boot up, HPE and DELL can take up to 5-10 minutes to boot depending on the config.
Sure, there are some situations where it can be used for server, but hibernate is a middle ground between a full boot and STR and loses on the most important metric - the actual boot time.
> For VMs it's of course useful to persist vm state to disk and suspend for lots of reasons
But again it's quite niche. You trade the RAM for the disk space and if you are short on RAM then something gone wrong with planning the resources in the first place. Sure, in some situations (homelab again, *sigh*) it can be useful, but again it's not the popular option. With VDI you still get the bootstorm and lose the caching of the golden image.
> Depends on the vintage. Up to about 2015 a 128 GB workstation config typically had a <= 512 GB boot SSD and some spinning disk as well.
And again this is not 2015 anymore and surely you can have a $50 M.2 (or even SATA) 1Tb QLC SSD for the system drive (and your fancy whatever Tbs SSD for the actual workload).
> not sure what are the main advantage there.
The main difference is what the hardware is initialized again (instead of relying on the hypervisor to restore everything) so I bet it's some GPU shenanigas.
I would like to clarify: sure, in some cases hibernating works^W is useful, but my initial point was about 'unbalanced' configurations and having 128Gb RAM with a boot drive < 512Gb AND requiring hibernate is what would constitute as unbalanced for me.
PS for the sake of it, checked my notebook:
TM420 C:\Users\amc>dir c:\hiberfil.sys /ahs
Volume in drive C is Windows
Volume Serial Number is DEAD-BEEF
Directory of c:\
07.05.2023 03:03 4,901,584,896 hiberfil.sys
1 File(s) 4,901,584,896 bytes
0 Dir(s) 62,332,203,008 bytes free
Even if it was a full file for 12Gbs of RAM (damn those soldered modules) I would be fine with my 256Gb SSD.
> but both Linux and Windows support suspending to disk out of the box.
At least with Linux, out of the box all you'll have is the message "Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7" in your logs.
(The trick is to either disable Secure Boot, or AFAIK make use of an encrypted swap partition; IIRC, there's a bug which makes it not recognize a swap volume within LVM within LUKS as encrypted swap, so it has to be directly on a disk partition.)
I've run both a Secure Boot/encrypted boot partition NixOS and plain LVM on LUKS archlinux on my Framework and neither had any issues or bugs with hibernating. Just add a resume hook to mkinitcpio and a kernel parameter to the UUID of the swap vol and it works fine.
I literally have no issue if, for example, Microsoft wanted to stop supporting S3. But instead, they demanded manufacturers remove the option from bioses?!
People say Microsoft isn't the same as 20 years ago, that they are not pure evil, but this is proof...
Yup. One of the most complex bug I ever fixed was caused by a race condition. It took me 2 weeks to investigate and fix it. The final result was a couple of lines (like 5).
Had dealt with a similar issue, as well as an issue where all configuration variables was loaded from a database into an in-memory table, and that table was queried with a sql-like structure like a thousand times over a single web request stack (login request was like 25-30s). I swapped it out with a hash table, and that knocked the login request to under 10s, and 9.5s of that was an external system outside my control.
On the race condition, that was actually pretty easy to diagnose and solve, replaced the static property with a local getter/setter using the request context to store the value (asp.net 2.0).
How much have you been paid for it? $4k?
I'd be brutally laughed at in this "awesome" country for that.
Some just cannot understand it. How do you get them actually pay for that time? Thats a mystery for me.
I just upgraded my Linux kernel and had major suspend issues due to the XHCI driver. I ended up having to disable the ability for XHCI to wake my machine.
On fedora cinnamon, I was getting random freezes on resume, and momentary freezes on resume on Linux Mint. Disabling the ability for XHCI to wake my machine fixed it.
This sleep() looks like bad code designed to work around a race condition. Perhaps it's related to the issue I had.
This issue was the worst Linux issue I've had in ~10+ years.
Thankfully, I have a repo of all the little configs and scripts I have used.
You can do cat /proc/acpi/wakeup to see what is allowed to wake your machine.
Echoing the device ID into /proc/acpi/wakeup will toggle it between disabled and enabled.
So to disable XHCI wakeup, I had to do:
sudo echo XHC0 > /proc/acpi/wakeup
Now that will reset on every boot, so I wrote a systemd service to do it on startup, and instead of just disabling 'XCH0', I found another user online that had written a shell script to disable everything's ability to wake the machine.
Note that with this installed, I'm pretty sure the only way to wake your machine is to press the power button. I prefer that but you might not. You may want to disable _just_ the XHCI devices, not _all_ of em. Up to you. Feel free to ask more questions.
You'll probably spend more time setting up bleeding edge kernel PPAs and what-have-you than this will save you. If "when will I get?" is ever a question for you, then an Ubuntu-based distro is probably the wrong choice: Ubuntu is about stability, not features.
Depends on if you're running LTS or an in-between release... the release right before an LTS can be really active in the first 3 months or so. At least that's been my experience. That said, some updates will be frozen entirely at the release before LTS.
In either case, I wouldn't expect it before 12-18 months... The RDNA 1 drivers seemed to take 8 months to see something stable drop in an LTS, the release before LTS was running an older kernel and had to add a custom PPA for more bleeding edge kernels (breaking a bunch of other stuff, but at least I could see the screen, when an update didn't kill it).
While this is true, they do occasionally backport some stuff from newer kernels (usually for security reasons). This looks like a reasonably easy-to-backport patch, assuming the code hasn't been refactored since Ubuntu pinned their kernel version for a release of choice.
Probably 12-18 months. Next major LTS or the release before is where most jumps happen. If it's less than 6 months until the next LTS, then wouldn't expect it until the interim release after the next LTS... at least that's been my general experience. Then another month or two from the downstream PopOS release.
If you wanted to compile your own kernel, that's an option. You can use the `make oldconfig` target to import the kernel config from your OS; you'd lose any distribution patches that were made, but generally speaking it would be fine in every way I can think of.
Is it worth going to all the trouble of doing this to save slightly over 1/10th of a second on wake from sleep? Probably not. Is it fun to experiment with? That's up to you to decide.
How often does your distro update the kernel?
Does your distro ship stable or an LTS kernel?
Will this patch even get backported into LTS kernels?
How often does your distro cut new disto releases?
tl;dr: I think pop is a Ubuntu flavor, so ~6 months and/or it's already available today if you're not afraid to compile your own kernel.
I actually pulled the reverse of this at my last job.
Surprisingly, a lot of aerospace engineers are not super computer-literate. We used a clunky maneuver planning software for the geostationary sats that spit out our plans in an ASCII printout, which we then had to copy/paste out and manipulate using several consecutive shell scripts. I got annoyed doing it and so I rewrote the whole deal in Python, and just had it locate the file that had the printout.
When I first ran it, it had turned a 3-4 hour affair into about 10 minutes (depending on network connectivity). I showed it to my boss, and he was asking why it said "working...done" instantly. He said it looked like it wasn't doing anything.
So I added an aesthetic wait variable to the config and made it 1.25 seconds. So the user got to see "Working..." and then "done" would pop out, making it seem more like it was actually doing things to the layperson.
Last I heard they were still using that script for maneuver planning to this day.
I mean, honestly having the pause, or some other conformation that work was completed is useful. If you ever had a system 'fail successfully', finishing to fast does become a concern.
Having meaningful output is useful, artificial pauzes like this are only for dramatic effect. I rather have a linear, timestamped log, so I can confirm my suspicions, than a progress bar with artificial delays, that suggest progress.
But that's the techy point of view. Most non-techies will probably prefer feel over functionality. I think most people do. If something is instant, it feels too good to be true. If something takes ages, you'll get bored or frustrated. While things that take a proportional amount of time feel satisfying.
Oh for sure. The giant ASCII satellite name every time you run it is definitely juice, too. Even changes colors on my birthday, so i get a yearly happy birthday text from my old coworkers haha
When I was a child writing games with QBasic, my simple text adventures would load up instantly. Though all the professional made games I played had loading screens. So I added a progressbar with some for loops to make my game more professional. 500 iterations was about 1 second I remeber (on my specific 386 that is).
you joke, but it's the most powerful promotion technique. create something insanely efficient but still provides business value, and then spend 2-3 years "increasing efficiency" and publicizing it, then get promoted because you're so great at efficiency, repeat. "I saved $20,000 with this one neat trick!" (neat trick: turn off the servers you don't need)
No, that's kind of the trick of it. To be able to do this, the thing you create has to be, on a base level, insanely efficient compared to what came before. You're frontloading years of optimizations in one big leap.
On top of that solid basis, you can introduce artificial inefficiencies, and then gradually remove them.
But you can't do the trick at all, if your rewrite doesn't start off being an orders-of-magnitude efficiency improvement.
Can we not try to force s2idle? It uses way too much power. I've not yet seen a laptop which is capable of staying "sleeping" in s2idle as long as in s3 sleep. Correct me if I'm wrong though.
I also don't really get why: s3 is more than fast enough to be awake when my laptop is open and I'm ready to login, the only "need to be faster" way I can see is when you do not lock you laptop and go straight to desktop but that has ... issues.