cryptsetup on a loopback device with an offset fails
This is about a Lenny install with the stock kernel and modules.
I am doing an exercise of encrypting an existing debian partition
in a raw qemu image before doing that in production environment.
I first identified the start of the partition (98703360) by doing
sfdisk -l -uS lenny.img
Then, I configured a loopback defice and mounted the partition
losetup /dev/loop0 lenny.img
mkdir lenny
mount lenny.img lenny -t ext3 -o loop=/dev/loop0,offset=98703360
After backing up, I attempted to create an encrypted partition, but
cryptsetup failed with an obscure message:
mkdir lenny-backup
time cp -ax lenny/* lenny-backup/
umount lenny
cryptsetup luksFormat --offset=98703360 /dev/loop0
>Command failed: Failed to write to key storage
AFAIU, all necessary modules were loaded.
lsmod|egrep dm_crypt\|aes
aes_i586 7744 0
aes_generic 29256 1 aes_i586
dm_crypt 11172 0
dm_mod 46184 1 dm_crypt
crypto_blkcipher 15236 3 cbc,dm_crypt,ecb
Any idea on how create an encrypted partition in a loop-mounted disk image?
Reply to: