I have installed Kubuntu 14.04 with an encrypted home directory. Although I had swap set up during the install, the swap space was not there after installing. This has happened to many people, there seems to be a bug somewhere. I googled and found a solution to this here.

I followed the steps there, leaving out the ones that had to do with resume, because that is disabled on my install anyway. So I essentially did:

sudo swapoff -a (turns off swap)
comment existing swap configuration in /etc/crypttab
comment existing swap configuration in /etc/fstab
re-format swap partition with gparted as linux-swap
sudo mkswap /dev/sdXX 
sudo swapon /dev/sdXX 
sudo ecryptfs-setup-swap 

Then I had a working swap and was happy, until I rebooted my laptop and was back to square one. Looking at the partition with gparted, it says file system unknown for the (former) swap partition, and needless to say I don't have any swap space available.

So, now my question is: Why did the file system formatting (as linux-swap) not survive the reboot? Is there anything I can do about that?

If I do blkid, the swap partition does not show up at all, so my problem seems to be different from this question.

Edit: Still working on it, so I did the above procedure again, after which /etc/crypttab looks like this:

cryptswap1 UUID=xxxx /dev/urandom swap,cipher=aes-cbc-essiv:sha256

plus some lines that are commented out. And /etc/fstab contains this line:

/dev/mapper/cryptswap1 none swap sw 0 0

Both new lines however look exactly the same (apart from the UUID) as what was generated the last two times. So I don't have great hopes that it will stay when I reboot. Gparted now shows the partition I am using as linux-swap. (Before rebooting) Also blkid gives this line:

/dev/sda7: UUID="xxxx" TYPE="swap" 

I tested the swap and it works, i.e. I started a program that used a lot of memory and checked how much was loaded into swap in the system monitor.

Edit2: Turns out that 3 is not the magic number that fixes this issue. The content of the two files is unchanged, blkid does not show the line with /dev/sda7 anymore and gparted shows the swap partition as "unknown".

Any suggestions the output of what I could look at or what else I could try are really welcome. My workaround at the moment is to just not reboot, but sometimes when there is an update, my laptop really wants to reboot.

Edit3: Is there really nothing else one could try to fix this? Any commands I could try? Any output I could look at?

2 Answers 2


This is not happening in the reboot. After you finish your setup (running ecryptfs-setup-swap), go back to gparted and reload the table & open a terminal and run: sudo fdisk -l /dev/sda. You gonna find that partition still having Id 83 Linux Swap and became in Unknown format.

Why is that?! It became an encrypted partition already.

In /etc/fstab:

  • Old swap partition was commented.
  • New mapped one inserted:

    /dev/mapper/cryptswap1 none swap sw 0 0

This is fine.

In /etc/crypttab:

  • A new line added to map the swap:

    cryptswap1 UUID=xxxx /dev/urandom swap,cipher=aes-cbc-essiv:sha256

But there is something wrong here, Does an encrypted partition have a UUID (non-encrypted)?!!!

  1. So set the dev path directly as this example:

    cryptswap1 /dev/sdXX /dev/urandom swap,cipher=aes-cbc-essiv:sha256
  2. Reboot then the Swap will be on.

BTW, This should be reported as a bug. ecryptfs-setup-swap should use device path instead of uuid.

Update: I could find same answered question which include the bug report too.

It contains the canonical answer by adding an offset= in the crypttab options.

  • Sorry it took me so long to get to this, I'm a bit paranoid about backups, so I wanted to make a backup first... I tried what you suggested, rebooted once, no swap, rebooted again, swap worked, turned off, booted again, no swap, rebooted again, no swap... very weird, the last two times there was also a message during boot about /dev/mapper/cryptswap not being ready
    – fifaltra
    Commented Dec 9, 2015 at 1:46
  • sadly, this does not work for me, the swap still vanishes after some reboots. the offset method also doesn't work
    – fifaltra
    Commented Dec 9, 2015 at 2:08
  • and with offset method I mean what is described in the answer to the linked question and what is described in the bug report...
    – fifaltra
    Commented Dec 9, 2015 at 2:51
  • @fifaltra, Possibly, a separate bug, but i will try if can reproduce it or find a work around.
    – user.dz
    Commented Dec 9, 2015 at 9:11
  • @fifaltra , as a workaround sudo /etc/init.d/cryptdisks restart works for me after boot (I got 1 no swap in 10 reboots I did).
    – user.dz
    Commented Dec 9, 2015 at 9:30

You could try this from the terminal:

 sudo -i
 umount -a
 gedit /etc/fstab

and then type this in at the bottom:

 uuid   name   mount  type
 xxxxx  swap   /       sw   sw   errors=noremount   0

and then type this in the terminal:

 mount -a

and then use gpart, and set the swap drive swap /. and it might work fine this way.

You must log in to answer this question.

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