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

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
├─sda1 ext4   3dbb0bca-df4c-426d-a672-2e31e6683646

GParted: enter image description here

Any help is appreciated =)

  • Can you post the contents of /etc/crypttab, and the output of sudo lsblk -o NAME,FSTYPE,UUID?
    – muru
    Nov 15, 2014 at 11:58
  • I have 8GB of ram, but yesterday I was debugging and had many tabs open in chrome and my system suddenly completely froze. I couldn't close any programs or check my ram, I had to hard reboot. I think I might have run out of ram. It happened twice.
    – meta221
    Nov 15, 2014 at 16:34
  • Did you try the anser below? Did it work? If so, please mark it as the correct answer. Dec 8, 2014 at 9:05
  • 1
    I think that this is related to this bug: bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/953875
    – Ciechomke
    Mar 16, 2015 at 19:27
  • @edwardtorvalds: I strongly disagree. Depending on the work load and the available physical main memory, swap space may very well be necessary. I have 8 GiB or RAM, which is not enough to compile large applications with profile-guided link-time optimization or some of the scientific computing tasks I tend to run into. Having my desktop environment run sluggishly for a few minutes is acceptable; having the kernel kill arbitrary processes (and most likely those that I really want to keep running) to free some main memory isn't. Mar 18, 2015 at 1:37

3 Answers 3


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.

  • This also works for 14.04. Thank you for the very easy to follow walk-through.
    – ohnoplus
    Oct 18, 2016 at 23:19
  • can somebody explain what the ,1024 in /etc/crypttab does?
    – Laurenz
    Sep 28, 2017 at 19:42

It looks like the UUID for your swap partition isn't being reported. I don't know if that's supposed to be normal for encrypted swap, but you could try specifying the partition using other methods in crypttab, such as:

cryptswap1 /dev/sda5 /dev/urandom swap,cipher=aes-cbc-essiv:sha256
  • I had the same issue and this answer fixed it. Dec 8, 2014 at 9:04
  • Hm, now after two successful boots, I have another issue with the swap partition. Dec 8, 2014 at 14:49

I traced /dev/mapper/cryptswap1 down to /dev/dm-1 so this worked for me:

sudo mkswap /dev/dm-1
sudo swapon -a

This enabled the swap that was already there. I am using Ubuntu 14.10 64-bit.

  • "sudo mkswap /dev/dm-1" gave me an error: "/dev/dm-1: No such file or directory". How did you trace cryptswap?
    – meta221
    Dec 16, 2014 at 20:57
  • You can use ls -l /dev/mapper/cryptswap1 and /dev/dm-1 is a raid drive so I am not very surprised it could not be found.
    – Requist
    Dec 16, 2014 at 21:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .