Comment 6 for bug 1301383

Revision history for this message
Albert Pool (albertpool) wrote :

A solution has been proposed at bug #1310058 in comment #3.

After patching the ecryptfs-setup-swap file as posted there, you first need to setup an unencrypted swap before you can encrypt it again.

For reference, how to create an unencrypted swap:
Please format the partition as linux-swap with GParted.
Then, edit /etc/fstab and uncomment the line about the unencrypted swap; on that line, change the UUID into the current UUID of your unencrypted swap. Mount your swap using "sudo swapon -a". Now, I suppose, you have a working unencrypted swap. You can use swapon -s to verify that your swap is enabled.

When you have an unencrypted swap enabled, you can again convert it into an encrypted one. You will first need to remove the lines about your old (not working) encrypted swap from /etc/crypttab and /etc/fstab.
Then you can convert your unencrypted swap into an encrypted one, using sudo ecryptfs-setup-swap. That will now work fine, because you have patched the file to include "offset=8" in the /etc/crypttab file.
Again, use swapon -s to verify that the swap is enabled; but now it should display /dev/mapper/cryptswap1 as device.

Another workaround, which is probably easier to apply: replace the UUID in /etc/crypttab by a /dev/sdXY name of the partition. Unlike the offset=8 patch of syscon-hh, this does not require re-creating the encrypted swap. This is how it was done on Raring and earlier releases; only since Trusty, UUID's are used here.
(For me this was not a solution: I have a hot-pluggable disk which becomes /dev/sda when it is inserted at boot time, causing my main disk to become /dev/sdb, so I need to use UUID's)

I am marking this bug as a duplicate of #1310058.