13.04 :: setting up hibernate + encryped swap under full disk encryption

24
2014-04
  • ATXubuntu

    So I recently installed 13.04 and chose full disk encryption (I didn't bother to encrypt home too - seemed pointless), and I'm wanting to encrypt my swap drive, and also enable hibernate so I can be as secure as possible. I haven't been able to find much information that pertains to my exact set of circumstances, and although I found this webpage (https://help.ubuntu.com/community/EnableHibernateWithEncryptedSwap), it says it has only been tested with 12.04.

    In any case, I went ahead and tried that and once I got to step 6 under "How to setup hibernation", I got an error stating that:

    swapon: /dev/mapper/ubuntu--vg-swap_1: read swap header failed: Invalid argument
    

    I don't know if I've FUBARED it or if a few commands can fix it, it doesn't really matter because I did all of this on a fresh install and there is no files I'm worried about losing.

    Can anyone help me get this working?

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    hibernate - Computer not hibernating despite free swap
  • Rick_2047

    I am on Acer 5742G. Here are some specs

    Processor : Intel Core i5-460M Mobile Processor (3MB Intel Smart Cache, 2.53GHz)

    Chipset : Mobile Intel HM55 Express

    Memory : Up to 3GB DDR3 SDRAM

    Storage : Up to 500GB SATA hard drive, 5400RPM

    Video : NVIDIA GeForce 420M graphics

    I have 3.3GB of Swap partition and 2.3GB of ram. But whenever I try to hibernate it says "not enough free swap".

    Here is the output of free command

                   total       used       free     shared    buffers     cached
    
     Mem:          2319       1304      
    
     1014          0        453        544
    
     -/+ buffers/cache:        306       2012 
    
     Swap:         3344          0     3344
    

    So you see there is lots of free swap space. Then why is it not hibernating?


  • Related Answers
  • Magnus

    Weirdly enough I found that Wubi hibernates just fine, it's just not called "hibernate" in the settings, it's variously called "Sleep" or "Suspend to RAM".

    When I go to Settings > System Settings > Advanced > Power Management > Edit Profiles and edit the currently selected power profile (in my case "Powersave"), on the line that says: "When the system is idle for more than"... when I select "suspend to disk" (which matches my definition of hibernation) I get the exact problem you've described above. I also tried increasing swap to something huge and it still didn't work.

    But here's the odd thing: I just changed that setting to "suspend to RAM", and now it in fact hibernates just fine, in other words the screen goes blank and the hard disk stops spinning, and the light on my computer blinks, so that only the power button will wake it up again. Regardless of what it's called, that matches my definition of hibernation.

    Similarly, if I go to the shutdown menu and choose "hibernate", I again get the free swap space problem described above, but if I choose "sleep" then it goes into a state that perfectly matches my definition of hibernation.

    So short answer: just use "sleep" or "suspend to RAM" and pretend it's called "hibernate". You won't know the difference.