I tried every trick in the book and I still can not encrypt the swap file. I always get the error:

cannot open /dev/mapper/cryptswap1: No such file or directory

So far, I tried creating the CLEANEST swap file, that runs in blkid and is noted with UUID in /etc/fstab. crypttab has just the header and no cryptswap1. I'd check that UUID works by turning swap on and off, then I try to encrypt and I get the error mentioned above.

I tried editing /etc/crypttab to include UUID of previous swap. I also made sure that /etc/fstab is properly defined in /dev/mapper/cryptswap1. Running swapoff, then swapon and I get, again, the same error.

I try restarting the service as suggested in previous posts by first turning swap off then restart /etc/init.d/cryptdisks start and try to start again. No luck again.

When restarting the boot lasts longer than usual but the swap is off, and, AGAIN, no file is created.


There is not much use of encrypted swap anyways, if you plan to really use it. If not and it is just for safety reason then try doing sudo cryptdisks_start cryptswap1 after you make the clean swapfile setup. Remember the swapfile needs to be there too! UUID and such is not really important and usually just confuses the system when you reset swapfile.

If it fails, try rerunning the sudo ecryptfs-setup-swap, resetting swapfile again, then again sudo cryptdisks_start cryptswap1. Sometimes it fixes the issue.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.