I'm following AN12714 and the creation of the encrypted image and mounting to /mnt/encrypted goes fine.
When I reboot and try to run dmsetup again I see this
root@imx:~# dmsetup -v create encrypted --table "0 $(blockdev --getsz /dev/loop0) crypt capi:tk(cbc(aes))-plain :36:logon:logkey: 0 /dev/loop0 0 1 sector_size:512"
device-mapper: reload ioctl on encrypted failed: Required key not available Command failed.
If I load the original key it's fine
root@imx:~# cat /data/caam/randomkey | keyctl padd logon logkey: @s
308049694
root@imx:~# dmsetup -v create encrypted --table "0 $(blockdev --getsz /dev/loop0) crypt capi:tk(cbc(aes))-plain :36:logon:logkey: 0 /dev/loop0 0 1 sector_size:512"
Name: encrypted
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 0
Event number: 0
Major, minor: 252, 0
Number of targets: 1
But, I now can't mount
root@imx:~# mount /dev/mapper/encrypted /mnt/encrypted/
mount: /mnt/encrypted: wrong fs type, bad option, bad superblock on /dev/mapper/encrypted, missing codepage or helper program, or other error.
So, the first question is I guess why doesn't importKey work? But, if I could just get the mount to work I'd be happy.