<story><title>Ask HN: Why is the Linux community struggling to implement hibernation?</title><text>Today I have found out that hibernation is by default disabled in my Ubuntu 18.04 distribution. After this, I found this 11 month old post &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;discourse.ubuntu.com&amp;#x2F;t&amp;#x2F;re-visiting-hibernate-on-ubuntu&amp;#x2F;15953&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;discourse.ubuntu.com&amp;#x2F;t&amp;#x2F;re-visiting-hibernate-on-ubun...&lt;/a&gt; where I realized that the Linux community does not seem to be able to implement a working implementation of hibernate. Is there any reason why this is a difficult problem? I would like to have an option in my OS like VM&amp;#x27;s have where everything that is currently running is saved on disk and can be resumed later without issues.</text></story><parent_chain><item><author>deckard1</author><text>It&amp;#x27;s going to depend on your hardware and probably your distro.&lt;p&gt;I have a ThinkPad running Archlinux. I have suspend-then-hibernate mode enabled, which means when I close my laptop lid it suspends for 2 hours (configurable) and then puts itself into hibernate. If I decide to open the laptop within 2 hours, it&amp;#x27;s available instantly. Otherwise, it takes maybe 20 seconds to reanimate from hibernation. People often say, why not just shutdown and reboot? The obvious answer is that I don&amp;#x27;t want to close out a dozen Chrome tabs, close all my terminals, all my files, and open everything up every time I need to walk away from the computer.&lt;p&gt;I have secure boot turned on. Hibernation is done to a swap file (I can simply delete the file if I need the space). I have LUKS encryption enabled. I&amp;#x27;m dual booting with Windows. And yes, it all does work perfectly fine.&lt;p&gt;You can have your cake and eat it too. It just takes a bit of research and a bit of time to setup.</text></item></parent_chain><comment><author>lorenzhs</author><text>Because you mentioned secure boot and encryption: Matthew Garrett wrote an interesting blog post a while ago on making hibernation work with lockdown mode, i.e. verifying that the hibernation image wasn&amp;#x27;t tampered with. Otherwise it might be possible to get around the whole secure boot chain by writing a compromised kernel to a hibernation image. It&amp;#x27;s quite interesting to think about, even if it isn&amp;#x27;t necessarily something you as a user should need to think about (distros should probably handle it): &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;mjg59.dreamwidth.org&amp;#x2F;55845.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;mjg59.dreamwidth.org&amp;#x2F;55845.html&lt;/a&gt;</text></comment>
<story><title>Ask HN: Why is the Linux community struggling to implement hibernation?</title><text>Today I have found out that hibernation is by default disabled in my Ubuntu 18.04 distribution. After this, I found this 11 month old post &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;discourse.ubuntu.com&amp;#x2F;t&amp;#x2F;re-visiting-hibernate-on-ubuntu&amp;#x2F;15953&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;discourse.ubuntu.com&amp;#x2F;t&amp;#x2F;re-visiting-hibernate-on-ubun...&lt;/a&gt; where I realized that the Linux community does not seem to be able to implement a working implementation of hibernate. Is there any reason why this is a difficult problem? I would like to have an option in my OS like VM&amp;#x27;s have where everything that is currently running is saved on disk and can be resumed later without issues.</text></story><parent_chain><item><author>deckard1</author><text>It&amp;#x27;s going to depend on your hardware and probably your distro.&lt;p&gt;I have a ThinkPad running Archlinux. I have suspend-then-hibernate mode enabled, which means when I close my laptop lid it suspends for 2 hours (configurable) and then puts itself into hibernate. If I decide to open the laptop within 2 hours, it&amp;#x27;s available instantly. Otherwise, it takes maybe 20 seconds to reanimate from hibernation. People often say, why not just shutdown and reboot? The obvious answer is that I don&amp;#x27;t want to close out a dozen Chrome tabs, close all my terminals, all my files, and open everything up every time I need to walk away from the computer.&lt;p&gt;I have secure boot turned on. Hibernation is done to a swap file (I can simply delete the file if I need the space). I have LUKS encryption enabled. I&amp;#x27;m dual booting with Windows. And yes, it all does work perfectly fine.&lt;p&gt;You can have your cake and eat it too. It just takes a bit of research and a bit of time to setup.</text></item></parent_chain><comment><author>rektide</author><text>I haven&amp;#x27;t been diligent about secure boot. I could imlrove. With regard to hibernation, I avoided hibernation for years under the assumption that it was untrustworthy. Sleep felt &amp;quot;sufficient&amp;quot;, safe.&lt;p&gt;But at some point I noticed that laptops I&amp;#x27;d left for a long time without power would wake up &amp;amp; resume. I&amp;#x27;d expected they had run out of juice while asleep &amp;amp; I&amp;#x27;d have to boot fresh.&lt;p&gt;Turns out systemd (in my Debian OSes at least) was set up to hibernate at a very low critical % of power remaining. The laptop would rouse from sleep &amp;amp; hibernate, at the last minute (and change). And it was working fine.&lt;p&gt;After seeing it happen a bunch of times I decided to try to embrace hibernation, &amp;amp; remapped my power button from sleep to hibernate. Everything worked great! Now my computers drain no battery when not active. I love it. Been this way for half a decade  now. Works great.&lt;p&gt;Bonus, one of my laptops would, when it woke up from sleep, &amp;quot;lose&amp;quot; it&amp;#x27;s wifi card. With hibernate, that laptop&amp;#x27;s wifi card shows up again, even if it had lost the card to sleep before. Hibernate, contrary to my expectations, was even safer than sleep.</text></comment>