I took a snapshot of a (live) luks encrypted block device, copied it to another system and am now trying to open it, but am unable to do so. Any help with solving this problem would be much appreciated.
The copied image is currently sitting on its own LVM partition
When I attempt to open the device with the command, and after entering the password
cryptsetup -v luksOpen /dev/hdd/luksCrypted blockname
I receive the response back "Cannot use device /dev/hdd/unenc_mail_dev which is in use (already mapped or mounted). Command failed with code 16: Cannot use device /dev/hdd/unenc_mail_dev which is in use (already mapped or mounted). "
I suspect there is something on the luks Device which says its mounted because it was a snapshot, but don't know what or how to clear it. I've tried looking for traces of this as a mounted filesystem by doing a df, losetup -a and grepping "luksCrypted" in the output of lsof with no luck.
When I run either of "crytpsetup status /dev/hdd/luksCrypted" or "cryptsetup status blockname" I get a response /dev/mapper/[luksCrypted|mailblock] is inactive.
Any ideas how I can open the volume ?
dmsetup remove_all
worked for me, from the linked stackoverflow question.This is one of the top hits searching on this error so I thought I’d add a few bits.
I got this error trying to open a luks after cloning. I guess along with the uuid you need to change partition naming after a clone if you want to use the disks on the same system.
Not sure that helps at all with the OP specific question, but at least it’s a case where this is known to be an issue and might give somebody else searching this an idea.
Be real, be sober.