Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

Setting Up Hibernation on Linux SSD Netbooks Without Swap, Part 2

  • Print
  • + Share This
A.Lizard completes this two-part series with a discussion of how to configure uswsusp, booting, power management, and suspend-hybrid operation, so that you can send your netbook computer safely off to dreamland when you close the lid.
Like this article? We recommend

Part 1 of this series discussed the following topics:

  • How the hibernation, suspend, and suspend-hybrid states work
  • The differences between how these states work in a regular hard drive and in a solid-state drive (SSD) environment
  • Why a userspace swap file rather than a partition is desirable
  • How to size and set up a userspace swap file and install the uswsusp userspace suspend/hibernation package

Configuring uswsusp

The next step in setting up hibernate/suspend is to run the uswsusp configuration wizard. Open the wizard with the following command (see Figure 1):

$ sudo dpkg-reconfigure uswsusp

Figure 1 Press Tab to get around these configuration screens; remember that Shift-Tab goes back to the previous setting.

In most cases, you'll accept the default settings in this wizard, so keep tabbing to select Yes except as noted.

  1. Select Yes in answer to the question, "Continue without a valid swap space?" (The configuration wizard doesn't see the swap file yet.)
  2. Checksum on image? Speed is more important, so again select Yes.
  3. For the Compress option, select Yes. There's no upside to not compressing.
  4. For shutdown method, select Platform.
  5. For swap space, select /dev/sda2 or the partition where your swap file is located. The program finds the start of the swap space by counting byte addresses from the start of the partition. That number is called resume-offset. Select the swap file path and hibernate/resume will fail.
  6. For Encrypt Snapshot, select Yes. This is the equivalent of setting your computer to lock the screen when you return from suspend, so you must enter your password to resume.
  7. Set "Show splash screen" to No. The splash screen will conceal the password prompt displayed when resuming from hibernation, making resuming impossible. Even installing the recommended "usplashy" userspace splash screen breaks kubuntu-desktop. Live with seeing the actual boot sequence onscreen instead.
  8. For the option "To avoid the need for a password prompt," select Yes. Accept the default keyname.
  9. At the next screen, beginning "The key necessary," select Yes. Select Yes again for the "Please specify" screen.
  10. The next screen will ask you for a passphrase. Simply use your regular password; using a different password or passphrase gives you no extra security. Once you've done this, the wizard will generate a key for you. This process will take a few minutes.
  11. After you finish the wizard, it will generate another initrd file. Let that happen, and you've completed the wizard.

Now /etc/uswsusp.conf should look a lot like this:

# /etc/uswsusp.conf(8) -- Configuration file for s2disk/s2both
resume device = /dev/sda2
compress = y
early writeout = y
image size = 479611043
RSA key file = /etc/uswsusp.key
shutdown method = platform
resume offset = 301907
encrypt = y
  • + Share This
  • 🔖 Save To Your Account