Setting Up Hibernation on Linux SSD Netbooks Without Swap, Part 2
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
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.
- Select Yes in answer to the question, "Continue without a valid swap space?" (The configuration wizard doesn't see the swap file yet.)
- Checksum on image? Speed is more important, so again select Yes.
- For the Compress option, select Yes. There's no upside to not compressing.
- For shutdown method, select Platform.
- 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.
- 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.
- 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.
- For the option "To avoid the need for a password prompt," select Yes. Accept the default keyname.
- At the next screen, beginning "The key necessary," select Yes. Select Yes again for the "Please specify" screen.
- 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.
- 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