Comment 22 for bug 1310058

Revision history for this message
> "Wetware Random Number Generator" (tnrng-purge-deactivatedaccount) wrote :

My final solution to this problem:

DON'T DISABLE /etc/init.d/cryptdisks-early !

1. DEACTIVATE AUTOMATIC MOUNTING OF CRYPTSWAP1:

Modify /etc/fstab changing the line:

/dev/mapper/cryptswap1 none swap sw 0 0

to

/dev/mapper/cryptswap1 none swap noauto,sw 0 0

and modify /etc/crypttab changing the line from:

cryptswap1 UUID=01234567-89ab-cdef-0123-456789abcdef /dev/urandom swap,cipher=aes-cbc-essiv:sha256

to

cryptswap1 UUID=01234567-89ab-cdef-0123-456789abcdef /dev/urandom noauto,offset=6,swap,cipher=aes-cbc-essiv:sha256

Don't forget to replace my sample UUID with the correct for your system. On my system offset=6 was sufficient, because cryptsetup already skips the two first sectors of the swap partition.

2. REBUILD YOUR SWAP PARTITION

CAUTION: you must replace /dev/sdaX with the correct swap partition for your system!

sudo mkswap --label Ubuntu\ Swap --uuid 01234567-89ab-cdef-0123-456789abcdef /dev/sdaX

Don't forget to replace my sample UUID with the correct for your system. The label is optional (I like swap partition labels :D)

3. CREATE AN UPSTART SCRIPT ( /etc/init/cryptswap1.conf )

start on started mountall
script
 /sbin/cryptdisks_start cryptswap1
 /sbin/swapon /dev/mapper/cryptswap1
end script

4. REBOOT AND VERIFY YOUR SYSTEM

$ free --human

             total used free shared buffers cached
Mem: 15.7G ...
-/+ buffers/cache: ...
Swap: 16.0G ...

$ swapon --summary
Filename Type Size Used Priority
/dev/mapper/cryptswap1 ...