[dm-crypt] Failed to setup dm-crypt key mapping for device cryptfile.

Yuriy M. Kaminskiy yumkam at gmail.com
Tue Mar 29 23:04:36 CEST 2016


Nicolas Bock <nicolasbock at gmail.com>
writes:

> cryptsetup fails on a new OS install for some reason, and I can't
> figure out what is missing. What I see is the following:
>
> $ dd if=/dev/zero bs=1M count=1 of=cryptfile
> $ sudo cryptsetup -v luksFormat cryptfile
>
> WARNING!
> ========
> This will overwrite data on cryptfile irrevocably.
>
> Are you sure? (Type uppercase yes): YES
> Enter passphrase:
> Verify passphrase:
> Failed to setup dm-crypt key mapping for device cryptfile.
                                       ^^^^^^^^^^
> Check that kernel supports aes-xts-plain64 cipher (check syslog for more info).
> Command failed with code 22: Failed to setup dm-crypt key mapping for
> device cryptfile.
  ^^^^^^
> Check that kernel supports aes-xts-plain64 cipher (check syslog for more info).
>
> Neither dmesg nor journalctl shows anything in the logs that seems to
> be related to this failure. As far as I can tell all cryptographic API
> modules are included in the kernel. How can I go about debugging this
> further?

I'd guess it wants block device, instead of file. man 8 losetup.
Something like this (unchecked):

  loopdev=`losetup --find --show cryptfile`
  cryptsetup -v luksFormat $loopdev
  cryptsetup luksOpen $loopdev cryptfile-container
  ...
  cryptsetup luksClose cryptfile-container
  losetup --detach $loopdev



More information about the dm-crypt mailing list