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!
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-456789abcd ef /dev/urandom swap,cipher= aes-cbc- essiv:sha256
to
cryptswap1 UUID=01234567- 89ab-cdef- 0123-456789abcd ef /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-456789abcd ef /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 cryptdisks_ start cryptswap1 cryptswap1
script
/sbin/
/sbin/swapon /dev/mapper/
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 cryptswap1 ...
Filename Type Size Used Priority
/dev/mapper/