Ubuntu – 14.10 – Swap not available

14.10dmcryptencryptionswap

My swap doesn't seem to be working. I tried to fix it but nothing I tried worked.
Here is some relevant information to troubleshoot the problem:
During install I chose to encrypt my home folder. Seems cryptswap is being used.
When I open the gnome-system-monitor it says "Swap is not available".
Here is some edited terminal output:

sudo swapon -s
(Nothing)

sudo swapon -a
swapon: stat failed /dev/mapper/cryptswap1: No such file or directory

cat /etc/fstab
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=3dbb0bca-df4c-426d-a672-2e31e6683646 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
#UUID=ef29aae9-af0e-403c-b702-334acb1d5879 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

cat /etc/crypttab
cryptswap1 UUID=ef29aae9-af0e-403c-b702-334acb1d5879 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

sudo lsblk -o NAME,FSTYPE,UUID
NAME   FSTYPE UUID
sda           
├─sda1 ext4   3dbb0bca-df4c-426d-a672-2e31e6683646
└─sda5

GParted:
enter image description here

Any help is appreciated =)

Best Answer

The link necordian provided has steps that do resolve this problem (I tested on a system with RAID and encrypted home directory/swap) except 1 step is missing you need to reboot before swap becomes available. Here is what I did to get my encrypted swap partition working.

Need UUID and Device name for the swap partition to fix this on RAID system with encrypted home directory/swap:

Find Device ID using "Disks" utility:

Click the ubuntu logo in the unity toolbar and then type Disks to open disk utility.

Select the SWAP partition and the device name should be listed below.

(usually /dev/dm-# for RAID or /dev/sda# for non RAID)

On my PC with RAID it was /dev/dm-6.

Get UUID from crypttab:

cat /etc/crypttab

My /etc/crypttab:

cryptswap1 UUID=5381faa1-369c-4504-9d8d-acfc7cb69e71 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

Then run the following with your swap UUID and device name:

sudo mkswap -U 5381faa1-369c-4504-9d8d-acfc7cb69e71 /dev/dm-6

Add the following text ,1024 to the swap line in /etc/crypttab directly after swap,cipher=aes-cbc-essiv:sha256 do not leave any spaces.

sudo nano /etc/crypttab

/etc/crypttab should now look similar to this:

cryptswap1 UUID=5381faa1-369c-4504-9d8d-acfc7cb69e71 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,1024

Run the following command:

sudo update-initramfs -u

Reboot and your swap should now work (well it worked for me).

Try rebooting a few times to make sure it's all good.