> With regards to transporting your laptop, you must first turn the laptop OFF
This has been a problem for already quite long. I remember my very old laptop overheating if being put in the backpack in Standby mode.
Nowadays I in fact don't just turn laptops Off the default way. I go and disable the "fast start up" (Control Panel - Power Options - Choose what the power buttons do) to make sure the computer gets turnt of for real rather than using yet another flavour of hibernation. And it still starts very fast (a couple of seconds longer perhaps) so I see no reason for these "fast start up" and "modern stand-by" modes to even exist now as we have fast SSDs and everything.
Besides starting up fast, another important value standby modes add is freeing you from having to open, position and initialize (open the documents/locations in them) all your apps manually every time. But this seems trivial to be reached by adding functions to just save the list of opened apps, their windows positions and the actual documents which were opened in them. This will require some coordinated effort from both the OS and the apps developers though.
This is so infuriating, because this problem has already been solved once. It's called "Hibernation", and was added in Windows 95. This should write your MEM image to disk, power the laptop completely off and allow later restoring where you left when powering your laptop back on. But laptop manufacturers (including Apple) thought it somehow smart to remove true hibernation, and replace it with some botched "deep sleep" that is not actually working, as it does not actually turn the computer OFF. This is SO infuriating - who thought it smart to REGRESS on a solution that has worked so well for DECADES?
For people who had working hibernation, it may seem so.
For support staff, and for hardware & OS vendors, dealing with customers complaining about hibernation or S3 sleep not working those states were so infuriating and definitely NOT a solved problem.
Example failure modes:
— Doesn't wake when told.
— Immediately wakes instead of staying in low power state.
— Performs a cold boot when trying to wake.
— OS disables desired state with no explanation.
— OS disables desired state which has worked perfectly on that machine for month/years, and OS claims it has been disabled because it is not compatible.
Then they should've worked on fixing those problems, instead of adding even more new ones.
(I admit I haven't used systems with broken hibernates, or at least not any where a little it of troubleshooting could get it working, so that may skew my perception of it.)
Hibernation is not slow on modern PCs (XPS-15 9500 here), the problem is that Windows 10 can wake the PC from Hibernation at any time, and there's no option in BIOS to prevent that.
I chased all the sources using Windows Event-log and "powercfg /lastwake" and then disable each, but it took DAYS to find them all and make sure it now stays in hibernation.
I had this problem with mt desktop PC, which would randomly wake up from hibernation in the middle of the night. My computer was in my bedroom, so this was very much a problem since the bright screen would always wake me up. I couldn't even shut off the screen since it didn't have a power button (Apple Thunderbolt display).
My solution was to reach around to the back of the tower and cycle the PSU power switch after hibernating the PC, every time.
I have a Dell laptop I bought within the last couple of months. Hibernate is not in the start menu, and the option to add it to the start menu has been disabled.
It's still possible to assign "hibernate" as the action taken in response to various power-related actions such as closing the lid or pressing the power button. This makes no sense; I'm not sure what's going on.
You can enable the start menu hibernate button in advanced power settings:
System -> Power & sleep -> Additional power settings -> Choose what the power buttons do -> Change settings that are currently unavailable -> Check Hibernate.
And then get lucky that your laptop wakes up again (mine dies 1 out of 10 times)
Maybe you have Group Policy settings? Sometimes "Windows tweaker" type apps install these. Also, mine has a link "Change settings that are currently unavailable" which shows a UAC prompt and then enables all checkboxes.
Fedora doesn't even create swap partitions anymore, so you have to enable that first to enable hibernation, enabling it requires you to create a swap-partition, change things in systemd and meddle with the grub-configuration: https://www.ctrl.blog/entry/fedora-hibernate.html
if you use secure boot, you cannot use hibernation under fedora (or any Linux, afaik) since there is no way to "seal" the hibernation image from modification by an attacker who could mount the swap on another OS where they have root. this is regardless of disk encryption.
Secure boot is not that useful anyway. I'm kind of security freak, but I decided that security boot is not worth it. My disk is encrypted to protect from stolen laptop. My BIOS and grub have password to protect from someone using keyboard. Scenario with someone meddling with my boot partition and replacing my kernel with modified one is just not realistic for my life. So just disable it and enjoy proper hibernation, that's my opinion.
I don't know precisely how secure boot works under fedora, but you can have FDE with swap just fine in Linux. A swap partition can live inside a LVM logical volume.
For secure boot I would guess you could have the EFI partition signed/validated with the TPM.
In my case, I use SecureBoot to check the boot image's signature (contains the kernel + initrd + boot params). Then it starts everything from an LVM that lives on top of LUKS. I always have to type in the password (never bothered to get the TPM working), but I don't see why the TPM wouldn't be able to do it.
From the system boot point of view, it just starts an OS. The OS will then proceed to load some data in RAM. It's its business whether this is "fresh" data for a new boot, or "old" data from the last boot.
"Cannot" this is not true. It might not satisfy some sort of branding requirement but at the end of the day all a secure boot implementation does under the hood is to verify the kernel against the signing keys stored in the firmware before handing off control to it. The kernel can do whatever it pleases after that including granting you root access, joining a botnet, or, indeed, loading a hibernation image.
As for security, the hibernation image is at risk unless you use full disk encryption. But then (last time I checked) so is the typical Linux distro because ultimately you (the end user) have complete control over the OS. That means that at some point the kernel has to load and run privileged code that was never signed by some central authority. The only alternative to this would be sending all drivers to be signed by someone else, even those you built yourself from source.
tl;dr You can in fact use hibernation if you set it up, even with secure boot. Doing so is not a security issue. Lack of full disk encryption is always a security issue if physical access is an attack vector you are concerned about.
Huh TIL. Apparently the mainline kernel got a lockdown feature in version 5.4 that prohibits this. Ubuntu started shipping with a version of the patches in 2018. So I guess you'll have to disable that "helpful" feature first if you want to restore functionality.
TBF hibernation has never been entirely reliable under Linux due to hardware vendors being difficult (IIUC). Getting it working for me has typically involved trying to make sense of arcane kernel log messages. I never managed to on my current laptop.
I don't really understand why is it the case. I could understand that sleep is a complex mode, when hardware have to properly sleep and restore. But hibernate is just dumping RAM to disk. It should not require anything special from underlying hardware.
Because reinitialising all the hardware and bringing it back to the same state is hard, and sometimes impossible with buggy hardware or whose full spec cannot be known..
If you create a swap partition manually during installation and there's no secure boot, Fedora will put the "resume=" parameter into your grub config automatically.
You still need to create `/etc/dracut.conf.d/resume.conf` with `add_dracutmodules+=" resume "` line and regenerate initramfs with `dracut -f`. Then it should work.
I don’t really think that hubernating is worth it when you have gobs of RAM and a lot of data and state in it. The sheer time it’s going to take each time even with an NVMe drive, blergh.
Now that batteries are decent and S3 on Linux is good, I don’t bother with anything else. I reboot/power off my machines on a regular basis to make sure the things I need persisted are, in fact, persisted and everything will be brought up again.
So I was quite surprised to find resume= pointing to my swap partition in my /proc/cmdline after a default install.
It isn't. It can add just some seconds (probably less than 5 on fast SSDs, even less if you don't have too much RAM). If people can't wait this little they need to have their lives / jobs / mental health fixed rather than add more orders of complexity (with according increase in problems) into the computers.
On my work laptop (modern HP Elitebook), sleep doesn't work at all (laptop just turns on again after going to sleep), so I'm using hibernate exclusively. Waking up from hibernate takes longer than one minute.
On the other hand, my private laptop (Huawei Matebook) wakes up from sleep in less than 10 seconds.
On my MateBook 13 (2020) the Fn and Shift Lock lights are turned on, while the laptop is still powerd on, but not under OS control anymore:
Sleep takes 6 seconds down and 2 seconds up.
Hibernation is 9 seconds down and 20isch seconds up.
Shutdown is 20isch down and Boot is 22isch to desktop (fastboot=off).
I am quite confused. I thought Windows 10 “fast boot” was hibernation and default “shutdown” behavior. I thought Windows 10 startup times were faster because of hibernation shortcutting the real boot sequence.
Windows 8 and later enable “fast boot” by default which, on shutdown, logs the user out of the current session and then hibernates the logged out state of the OS by writing the RAM contents to disk.
“Full” hibernation is still there, it’s just disabled by default in the UI but not on the OS level.
There’s also this “hybrid sleep” concept introduced since Vista where an OS would go from Sleep state to Hibernate automatically after 180 minutes of Sleep (IIRC, also can be overridden by the OEM) to save the laptop battery further since after the laptop hibernates it’s effectively off.
It’s really confusing and a hell to troubleshoot if something goes wrong. I think Microsoft was trying to apply smart decisions on the OS level _for_ the user but there’s no real indication of what’s actually happening with the system. The naming doesn’t help either, especially after “Modern Sleep” has been introduced.
EDIT: I decided to check myself because I wasn’t sure and it turns out I was indeed wrong. “Hybrid Sleep” is actually about a device going to Sleep and Hibernate simultaneously - it’s so that you can still resume from the hibernated image on the disk in case battery dies while in Sleep. At the same time, you can resume from Sleep right away even before parallel hibernation is finished. I think the intention is that you kinda get the best of both worlds here.
The behavior of going to sleep to hibernate after some time which I’ve described originally is actually something that was there since at least Windows XP.
If your drive is actually capable of sustained 3 GB/s write it would be ~11.5 seconds. However typical NVMe drives are closer to ~2 GB/s sustained which would be more like 17 seconds. (Note GB 8 * 10^9 bits and GiB 8 * 1024^3 bits.)
I guess most people have 16 GiB RAM or less though. I'm not sure why an ~10 second wait is too long given that the user intentionally selected hibernate instead of sleep.
you have 32 GiB of RAM, gibibytes, meaning 32 * 1024^3. does your drive write at 3 GB/s (gigabytes) or Gb/s (gigabits)? if little b bits, it'll be more like 80 sec
if this comment is serious i strongly suggest you inform yourself about nvme drives. they're absolutely worth their money.
i haven't encountered anyone in years that didn't have at least one in their pc/laptop, but if you dont: i strongly suggest you buy one. because writing 30 Gbyte sequentially generally does takes about 10 seconds.
When I got my work laptop, first thing I did is erased its NVMe SSD by writing garbage. It was fast first 30 seconds. In the end sustained write speed was around 60 MB/s. My old HDD works faster. It's fast enough in day-to-day usage, though.
I'll be honest. i haven't encountered a single workload in which i had to write over 90 GByte over 30 seconds (3gbyte sustained for 30 seconds), so you could be correct. Even benchmarks are generally done within 10-15 seconds and my IO is usually constrained by network or CPU at that point.
not sure how that would in any way impact a hibernate routine which would very rarely have to store more then 64gb though.
I have a 64 GB Mac with SSD and managed to trick it to use true hibernation (Apple does not want you to know it but you can still achieve true hibernation by enabling disk encryption (FileVault™) and forcing key material erasure from MEM on standby with `sudo pmset -a DestroyFVKeyOnStandBy 1`). I just timed it and bootup from hibernation to UI took 25 seconds, out of which maybe 5 seconds were taken by inputtting the encryption password.
Certainly not a show-stopper, if this means not accidentally killing my €2k+ laptop because it decides to randomly wake up in my bag.
Sorry.. I meant exactly that 25 seconds to boot up from hibernation is definitely not an issue. Why would it be? I store the laptop hibernated. I need to dehibernate exactly once a day. I work 8 hours a day, meaning less then a promille of my working day is spent waiting for my laptop to dehibernate. It's a non-issue.
Time to hibernate linearly depends on amount of RAM you have, and whether you have HDD or SSD. On my 16GB T450 (SSD) with Win10 it takes several seconds.
My Toshiba Libretto seems to have it built into the BIOS. The computer displays a full-screen animation of the Laptop dumping its system memory to disk, and after a few seconds it powers down. Its all very seamless and jank free.
Anyone who is concerned about this should already be using full-disk encryption, which means the memory contents are actually better protected during hibernation than in a live state.
This is one thing that usually Linux gets mostly right .. only if the proprietary GPU drivers played along. Meanwhile, Microsoft and Apple certainly could implement this properly but instead decide to release a new half-assed half-hibernation after another.
AFAIK this is only an issue if you think UEFI Secure Boot and TPM are a good idea. The traditional way to implement full-disk encryption on Linux is by disabling UEFI validation and deriving the key from a passphrase rather than storing it in the TPM.
Personally I'd rather keep secure boot and just disable the kernel lockdown feature. You still gain a significant amount of security while maintaining functionality that way.
Hibernate works fine on my windows laptop, but it was not the default setting for lid closed. Mine has a performance switch built in. Close it while in high performance mode and the fan would continue to run at full blast. Stupid.
Standby actually works 100% properly on my M1 and Intel MacBooks. Flush men to disk is not something I want or need. I quite like the instant availability and have come to expect it of products.
I killed a macbook air exactly like this. It just decided not to shutdown like usual.
Usually I'd put it on sleep mode, or just close the lid and it is fine, but it only took one time for it not to work properly to find the insides of my backpack like a sauna.
The dumb thing is you can't choose to do sleep vs hibernate; you have a system global setting which decides what "sleep" means. (AFAIU You need to have two shell scripts sleep.sh and hibernate.sh to change the hibernate mode if you want to be in control on what's gonna happen)
It was probably the 2017 model, it had a fan. But it was in the tight pouch within the backpack that was supposed to protect laptops from bumps, so it didn't have much room to breath.
Same thing happened to me with my Surface Book. I found it the next day with fans at max and burning hot. Still survived. Why aren't laptops shutting down when the CPU gets unbearably hot?
"Unbearably hot" for meatbags and "unbearably hot" for CPUs are different things; meatbags start having troubles at 50°C, while internal components are fine until 90-120°C.
Traditional hard disks are the biggest exception, but I'm fairly certain that's not a worry for a Surface.
Even when there's not much fresh air supply, it can circulate the existing air over a larger volume and transfer heat faster into whatever material surrounds it. Doesn't help much, but might be the difference between "it's burning my fingers but still works" and "it died".
Your last point is why I use hibernate. The actual boot time is barely noticeable on new laptops but even if I remember what I was doing when I hibernated it, which is rare, it still takes a while to get all my terminal windows back and everything where it was.
> Besides starting up fast, another important value standby modes add is freeing you from having to open, position and initialize (open the documents/locations in them) all your apps manually every time.
> Besides starting up fast, another important value standby modes add is freeing you from having to open, position and initialize (open the documents/locations in them) all your apps manually every time. But this seems trivial to be reached by adding functions to just save the list of opened apps, their windows positions and the actual documents which were opened in them. This will require some coordinated effort from both the OS and the apps developers though.
I just gave up on OS and app developers and implemented a half-assed solution myself using scripts. It works mainly because my setup is fairly fixed so I just fire everything up and fix any differences manually if needed.
NeWS used to have a way to record an event stream and play it back later, so you could record a start-up event stream to play from ~/.startup.ps when you ran the NeWS server, that would pop up menus and open windows, start apps, position them on the screen, type stuff into them, click on buttons, etc.
You had to be careful and not record setting up your desktop too fast, but then it worked pretty well! I would open up terminals on a bunch of different servers, start emacs in shell windows, set up my initial emacs shell window, etc. I'd just go take a dump and get some coffee while NeWS warmed up.
That was the best you could do in 1986, since none of the Unix programs or gui apps at that time had any idea about how to save and restore their state, and there wasn't a standard desktop framework (except what NeWS provided, which was hardly a standard).
I'm disappointed that 35 years later all window systems don't come with a standard built-in event recording and playback (and even editing) feature you can use to set up your desktop or execute repetitive tasks. Like visual Emacs keyboard macros.
Computers are complicated, some things are probably released with a tight schedule, things are not formally verified, and therefore have bugs. Hardware or software. It's sad but we have to deal with it.
Sleep has been working well on Linux on the machines I've been using for the past years (especially after removing a defective RAM stick from one of them - and the computer is built in such a way I could do it myself easily!). But yes, once or twice, the computer won't go to sleep because I'm running updates (that I launched manually, mind you), or some other shit.
I've taken the habit of checking that the computer actually went to sleep before putting it in a bag and you should, too, for the one time your Mac won't go to sleep because who knows why.
I've been using macs for the past 10 years, and I've never had this problem. I've never even thought about it! I close the lid, I open it, it just works.
Maybe it's just my (2013 Pro and M1 Air), or maybe in the meantime the quality dipped... All in all, as I often say, the best advertisement for Apple is all the other computers.
> I've taken the habit of checking that the computer actually went to sleep before putting it in a bag and you should, too, for the one time your Mac won't go to sleep because who knows why.
How would you even do that? If I open the lid (even just a bit), it turns back on immediately. Also, why do you think it would overheat if it accidentally didn't go to sleep? It's not like it's using fans while being turned on.
Good for you. You probably happen to use your Macs in a way you don't hit those bugs, and didn't have to deal with faulty hardware. I'm sure things are flawless most of the time too.
My computers also go to sleep reliably. They are professional hardware, of good quality, and from different brands. I'm sure other models of other brands or of the same brands have quirks, or that there are people who have problems with the same hardware/software as mine because they use it differently.
Maybe it's not that much a Mac vs the rest of the world thing. Evidence is that people have problems with any kind of hardware and brands, this is indisputable.
> How would you even do that?
There is usually some led visible somewhere, or a small noise, when the thing failed to fall asleep. You know your computer.
Closing the lid has never worked for me on a Windows laptop, even the most expensiveness HP Elitebooks or Dell’a Latitude Pro or whatever. On my MacBook Air, it has never been a problem for 7 years.
It is one of the main reasons I moved to Apple, it is just so much more convenient not having to worry about it.
I've owned an XPS 15 and a 2015 MBP. Had this issue with sleep as well as the funky multi-monitor with distinct DPIs issues off the bat with the XPS, never had any of these problems with the MBP.
I'm interested in examples you may have, as someone who once flirted with formal methods.
The most practical use of formal method I witnessed is model checking (with TLA+), but that does not check the actual implementation.
There's also CompCert, a formally verified C compiler written in Coq, but even then, some parts are not verified so the final product may still have bugs.
Tomp was likely talking about the Mac “reopen running apps after reboot” which works very well in terms of putting your state back the way it was. Terminals aren’t fully restored (what would it mean to/how could you restore an ssh connection anyway?), but most apps for most people are.
>Terminals aren’t fully restored (what would it mean to/how could you restore an ssh connection anyway?), but most apps for most people are.
See my post about NeWS ~/.startup.ps event recording and playback above. You could record keyboard events to set up your terminal windows and emacs buffers and shells, and mouse events to open and position windows, pop up and select from menus, press buttons and drag sliders, etc.
Back in the 80's we used unencrypted rlogin with .rhosts files to avoid typing passwords, but now you can restore encrypted shell connections using ssh keys.
The nice thing is that it was WYDIWYG (What You Did Is What You Get), no writing scripts in various shell and emacs scripting languages, just record and playback, like keyboard macros for the window system.
This has been a problem for already quite long. I remember my very old laptop overheating if being put in the backpack in Standby mode.
Nowadays I in fact don't just turn laptops Off the default way. I go and disable the "fast start up" (Control Panel - Power Options - Choose what the power buttons do) to make sure the computer gets turnt of for real rather than using yet another flavour of hibernation. And it still starts very fast (a couple of seconds longer perhaps) so I see no reason for these "fast start up" and "modern stand-by" modes to even exist now as we have fast SSDs and everything.
Besides starting up fast, another important value standby modes add is freeing you from having to open, position and initialize (open the documents/locations in them) all your apps manually every time. But this seems trivial to be reached by adding functions to just save the list of opened apps, their windows positions and the actual documents which were opened in them. This will require some coordinated effort from both the OS and the apps developers though.