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?
Best Answer
This is not happening in the reboot. After you finish your setup (running
ecryptfs-setup-swap
), go back togparted
and reload the table & open a terminal and run:sudo fdisk -l /dev/sda
. You gonna find that partition still havingId 83
Linux Swap and became in Unknown format.Why is that?! It became an encrypted partition already.
In
/etc/fstab
:New mapped one inserted:
This is fine.
In
/etc/crypttab
:A new line added to map the swap:
But there is something wrong here, Does an encrypted partition have a UUID (non-encrypted)?!!!
So set the dev path directly as this example:
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.