I need help mounting encrypted swap with systemd during boot time. The situation is as follows:

I have a Debian 9 system, in Crunchbang++ flavour. During installation, I set up swap as an encrypted partition sitting over a LVM volume.

I expected to be prompted for the passphrase during boot, where I would type in the correct one and voila! I have a mounted swap.

Except the prompt never showed up. There's instead a systemd message saying "crypt_init() failed: Block device required".

I dug around a bit, found the generated service unit file in /var/run/systemd/generator, tried the command in ExecStart, and it asked me for the passphrase and mounted alright. At this point I'm in a running system with everything except swap mounted and shell access.

So I suspect there is something wrong in the order of mounting and the opening encrypted partition. However, I'm quite an amateur in Linux and more so in systemd. This is all I can gather for now. If there's anything I've missed, please point that out, I'd be immensely thankful for that.


Nov 23 14:27:09 cbpp systemd[1]: Starting Cryptography Setup for cbpp-swap_crypt...
Nov 23 14:27:09 cbpp systemd-cryptsetup[1478]: crypt_init() failed: Block device required
Nov 23 14:27:09 cbpp systemd[1]: systemd-cryptsetup@cbpp\x2dswap_crypt.service: Main process exited, code=exited, status=1/FAILURE
Nov 23 14:27:09 cbpp systemd[1]: Failed to start Cryptography Setup for cbpp-swap_crypt.


cbpp-swap_crypt UUID=da050680-aa68-4e5b-bd89-aa9eb719dfae none luks


/dev/mapper/cbpp-swap_crypt none            swap    sw              0       0

lsblk -o +UUID when the swap is mounted:

|─cbpp-swap         254:2    0   7.5G  0 lvm              da050680-aa68-4e5b-bd89-aa9eb719dfae
│ └─cbpp-swap_crypt 254:8    0   7.5G  0 crypt            a917edd3-863f-4619-9006-9036acf5e075

swapon -s:

Filename                Type        Size      Used    Priority
/dev/dm-8               partition   7809020   0       -1
  • You mentioned the LUKS container is in an LVM volume, and your log contains the message: Block device required. Is your LVM volume group being activated prior to the attempt to mount the swap "partition"? – Emmanuel Rosa Nov 23 '17 at 17:26
  • @EmmanuelRosa It seems to be so. This was where I got lost. It looked like Debian wanted to mount the swap before LVM was activated. What do you suspect I have done wrong? Or is it a known bug? I know I may have supplied too little information. Please let me know what I have missed. Thanks : ) – Chung Lun Yuen Nov 25 '17 at 16:46

Your Answer

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

Browse other questions tagged or ask your own question.