The way to do it is the following, commands or files are in bold:
- sudo swapoff -a (turns off swap)
- comment existing swap configuration in /etc/crypttab
ex.
cryptswap1 /dev/sdb8 /dev/urandom swap,cipher=aes-cbc-essiv:sha256 - comment existing swap configuration in /etc/fstab
ex.
/dev/mapper/cryptswap1 none swap sw 0 0 - re-format swap partition with gparted as linux-swap
- sudo mkswap /dev/sdXX (create new swap, XX depends on your system and is the partition you formatted earlier, in my case it was sdb8)
- mark somewhere the UUID value that the previous command returns
ex.
Setting up swapspace version 1, size = 4208636 KiB
no label, UUID=06a9be15-d05b-466d-bfe3-a086bb9cdba0 - update /etc/initramfs-tools/conf.d/resume with the new UUID
ex.
RESUME=UUID=06a9be15-d05b-466d-bfe3-a086bb9cdba0 - sudo update-initramfs -u (update initramfs)
- sudo swapon /dev/sdXX (enable swap, XX depends on your setup)
- sudo ecryptfs-setup-swap (encrypt swap)
now you can check that swap is on by using the commands
free -m
total used free shared buffers cached
Mem: 11950 6662 5287 0 126 4002
-/+ buffers/cache: 2533 9416
Swap: 4109 0 4109
or
swapon -s
Filename Type Size Used Priority
/dev/mapper/cryptswap1 partition 4208636 0 -1
Hey men... thank you so much.. It has been so useful... you saved my life...
RispondiEliminaCongratulations it's a great tutorial.. !!
you are welcome ;)
Eliminagparted runs mkswap when you format linux-swap partition. You can also do swapon by gparted.
RispondiEliminaI did the above, but I still have the error message for a short time during boot.
thanks
RispondiEliminaI had the same issue. Eventually it turned out that the device in /etc/crypttab was wrong.
RispondiEliminaThe system was installed from a USB pen-drive, so during installation the pen-drive was /dev/sda and the hard disc was /dev/sdb. The swap partition was hence written into /etc/crypttab as /dev/sdb6.
After booting from the harddrive this became /dev/sda6 and the mapper could not find it any more.
To fix this just correct the line in /etc/crypttab to the correct /dev/sd?? or the UUID of the swap partition.
Thanks, Great tutorial, worked perfectly
RispondiEliminaHi! First thanks for your tutorial, it is very clear. However I am stuck at the step: "re-format swap partition with gparted as linux-swap". I get an error when gparted run mkswap -L "" /dev/sda7 : /dev/sda7: Device or resource busy.
RispondiEliminaThen I tried:
lsof | grep /dev/sda7
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /home/noomi/.gvfs
Output information may be incomplete.
Before that I must say I followed a tutorial to remove /home encryption. I checked if the file /home/.encryptfs was erased but il wasn't, and I was still getting the message at boot. So I simply deleted .encryptfs...
Here are some commands results:
sudo blkid
/dev/sda1: LABEL="SYSTEM" UUID="C2CE9DB7CE9DA467" TYPE="ntfs"
/dev/sda2: UUID="DC769A88769A62D6" TYPE="ntfs"
/dev/sda4: LABEL="SAMSUNG_REC" UUID="2EFE43CDFE438BD1" TYPE="ntfs"
/dev/sda5: UUID="08DEFE7FDEFE647A" TYPE="ntfs"
/dev/sda6: UUID="d61bdf5e-8819-4771-a8dc-245c96d1cb39" TYPE="ext4"
/dev/mapper/cryptswap1: UUID="3e86a0e8-d386-4748-a299-a54be304c4d7" TYPE="swap"
And:
cat /etc/crypttab
#cryptswap1 /dev/sda7 /dev/urandom swap,cipher=aes-cbc-essiv:sha256
What should I do?
Ok so just in case it might help someone, before using gparted just reboot. As you've commented the lines to use the swap in /etc/fstab, your swap partition will no longer be in use at reboot and you'll be able to edit it with gparted. Also, this link takes this step into account: http://altinukshini.wordpress.com/2012/10/15/devmappercryptswap1-is-not-ready-yet-or-not-present/
RispondiEliminaCheers!
Hi
RispondiEliminaFirst of all. Great article, easy enough for a noob like me to understand. I was able to step through and enable swap and encryption up to the point where I can see 'swapon -s' return expected results. However, I seem to be running into the issue that the system goes back to reporting "The disk drive for /dev/mapper/cryptswap1 is not ready yet or not present" upon reboot. i.e. to say somehow the swap settings seem to get lost on reboot. Is there like a final step that I might be missing?
Worked for me to get the swap working but every time I rebooted I got the "The disk drive for /dev/mapper/cryptswap1 is not ready yet or not present" message.
RispondiEliminaI fixed this by pasting the UUID returned from the mkswap step into the /etc/fstab file thus:
.
.
# swap was on /dev/sda6 during installation
UUID=89977e86-a252-4a1b-9b0c-15ce3f7ab25c none swap sw 0 0
/dev/mapper/cryptswap1 none swap sw 0 0
Previously the UUID=.... swap line was commented out and had a different UUID present.
Hope that helps, Nick.
Thank you so much
RispondiEliminabut unfortunately it did't work for me.
I found this solution and it worked for me, it still give this message while booting but the swap space now available.
sudo -s
umount /dev/sda5 #Replace this by the swap partition used in your system!
mkswap /dev/sda5 # Use the UUID from the output in the following line!
echo "RESUME=UUID=143c43d8-0a77-4d62-a7ae-f53a8e0229a9" > /etc/initramfs-tools/conf.d/resume
echo "cryptswap1 /dev/sda5 /dev/urandom swap,cipher=aes-cbc-essiv:sha256" > /etc/crypttab
update-initramfs -u
exit
source: http://ubuntuforums.org/showthread.php?t=2224129&p=13027409#post13027409
Thank you!
RispondiEliminaHello. Thanks for the guide.
RispondiEliminaHowever I still face the same problem.
As I apply these steps, everything works fine. The swap is on and when i reboot i get no error message.
The second time I reboot the message returns and there is no swap mounted...
What can i do?
Ι have repeated the whole process about 4 or 5 times.
Thanks in advance.
Thanks! Your guide helped me fix an "A start job is running for dev-disk-by..." message that was delaying the boot by 1min 30s.
RispondiEliminaI don't really need encrypted swap, so I skipped the last step and re-configured swap manually.
1. Get the swap partition UUID: blkid
2. Re-enable swap in /etc/fstab:
UUID=01234567-9abc-def0-1234-56789abcdef0 none swap sw 0 0