3

I see a question about this on Windows.

Also here:

" When you put the computer into a hybrid sleep state, it writes out all its RAM to the hard drive (just like a hibernate), and then goes into a low power state that keeps RAM refreshed (just like sleep)."

As far as I understand it joins the advantages of hibernation (saves RAM data on disk and can restore it even in case of power cut) and of sleep/suspend (fast return to full operation).

Is it the same in Linux?


UPDATE after comment:

When I say Hybrid-Sleep I am referring to a circumstance where I wanted to make my elementary OS Loki, Ubuntu 16.04-based system to sleep/suspend instead of shutting down in case of battery critical level. More here. As that setting is administered by a tool called Upower (and not by gsettings as some time before) the only options available were Shut-down, Hibernate and HybridSleep. The latter was not available until I have created a swap space (see answer under link above). Now it works and looks very similar to sleep, while the need for a swap space makes it similar to hibernation.

On the other hand: Before setting the swap space the commands systemctl hybrid-sleep and systemctl hibernate gave an error message. Now, systemctl hybrid-sleep puts the computer to sleep (which I trusted is hybrid sleep), but systemctl hibernate shuts down the system completely instead of hibernating it, that is: when I start it back the system is logged off and all open programs are closed (no RAM data saved/restored). This makes me think that maybe hibernation and swapping RAM data to hard disk don't work on my hardware and, although swap space is needed to use the option 'HybridSleep' in Upower settings, what happens on my system is not really Hybrid-Sleep, but just Sleep.

  • What hybrid sleep on Linux are you referring to? Please provide more context. – Daniel B Sep 16 '16 at 8:04
  • @DanielB - see update related to your comment – user162573 Sep 16 '16 at 8:16
  • I have the same desire: hybrid sleep. I want the computer to save memory to disk (as in hibernate), but then sleep (suspend to ram). If the power stays constant, it restores from ram, else restores from disk. This has the speed of suspend to ram in most cases, but protects against power failure. – Bryce Sep 4 '17 at 0:12
2

Yes, hybrid sleep should be the same between windows and linux. Both should write state to disk allowing for a resume from disk after a total power-off, but then suspend to ram allowing for a very fast resume if the battery (or line power) are maintained.

You have updated your question with more information and it seems to me either your diagnosis is correct - your machine doesn't support hibernate well - or you haven´t successfully configured hibernate.

First, make sure hibernate actually works - here´s a guide I followed and I hibernate successfully now: https://askubuntu.com/a/821122/858118

In particular even after enabling swap and updating grub hibernate still didn't work the first time because I didn't realize it will only work after the kernel has booted cleanly once with the resume swap partition set. One full reboot cycle after configuration, and hibernate was functioning.

Assuming you have hibernate functioning (sudo systemctl hibernate works), then you should be able to test hybrid-sleep manually with something like sudo systemctl hybrid-sleep and hybrid-sleep should work also.

Finally, you will want to configure which actions (lid close? power button? critical battery level?) trigger hybrid-sleep, and a good resource for that is here: https://askubuntu.com/a/781957/858118

I've provided Ubuntu links but the underlying kernel+grub interaction, systemd and upower interaction etc should apply to any distro I think.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy