[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Encrypted swap with cryptsetup won't mount at startup



Hi,

I'm trying to encrypt my swap partition, /dev/sda7. I added the following entry in my /etc/crypttab file :

cryptswap1  UUID=25d9539e-3993-42ad-abe2-d08ee6845194   /dev/urandom    swap

("25d9539e-3993-42ad-abe2-d08ee6845194" is the UUID of /dev/sda7)

And this is my /etc/fstab file :

# <file system>                               <mp>       <type>  <options>         <dump>  <pass>

UUID=25bd7143-0e60-4808-9492-558dafbfc27e 	/          ext4    errors=remount-ro 0       1

UUID=F858-46BD                                /boot/efi  vfat    umask=0077        0       1

UUID=836a1582-e29d-47db-b2d2-aa2b2635b65e 	/home      ext4    defaults          0       2

/dev/mapper/cryptswap1                        none       swap    sw                0       0


My syslog is partly in French, so I don't know if I should post it here. I think I will attach the relevant lines.

At boot, it seems like systemd tries to mount /dev/sda7 as a non encrypted swap partition, and fails. Then it tries to mount cryptswap1 following my crypttab. I have to wait 1 min 30, and then I get a message "Job dev-mapper-cryptswap1.device/start timed out.".

It seems like there a two problems, both with systemd :
- it tries to mount sda7 as swap, even if it's not in the fstab,
- it fails to mount my encrypted swap when it reads crypttab.

Can you see any error in the entries I added in fstab and crypttab ? How can I make this encrypted swap work ?

Thanks.

Oh, and I also tried several times the "ecryptfs-setup-swap" script before trying to configure it myself, but it made systemd ask three times for a password at each boot. And the encrypted swap wasn't mounted.
août 10 11:15:06 pc-debian swapon[317]: swapon: /dev/sda7 : échec de lecture d'en-tête d'espace d'échange
août 10 11:15:06 pc-debian systemd[1]: dev-sda7.swap swap process exited, code=exited status=255
août 10 11:15:06 pc-debian systemd[1]: Failed to activate swap Swap Partition.
août 10 11:15:06 pc-debian systemd[1]: Dependency failed for Swap.
août 10 11:15:06 pc-debian systemd[1]: Unit dev-sda7.swap entered failed state.

(...)

août 10 11:16:31 pc-debian systemd[1]: Job dev-mapper-cryptswap1.device/start timed out.
août 10 11:16:31 pc-debian systemd[1]: Timed out waiting for device dev-mapper-cryptswap1.device.
août 10 11:16:31 pc-debian systemd[1]: Dependency failed for Cryptography Setup for cryptswap1.
août 10 11:16:31 pc-debian systemd[1]: Dependency failed for Encrypted Volumes.
août 10 11:16:31 pc-debian systemd[1]: Dependency failed for /dev/mapper/cryptswap1.
août 10 11:16:31 pc-debian systemd[1]: Job dev-disk-by\x2duuid-25d9539e\x2d3993\x2d42ad\x2dabe2\x2dd08ee6845194.device/start timed out.
août 10 11:16:31 pc-debian systemd[1]: Timed out waiting for device dev-disk-by\x2duuid-25d9539e\x2d3993\x2d42ad\x2dabe2\x2dd08ee6845194.device.


Reply to: