10

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 ?

3
  • Try lsof -n | grep /dev/hdd. Check to see if anything actually has it open. If so, stop the other thing. BTW are you sure you have that device name correct? /dev/hdd/luksCrypted is an unusual name.
    – Zoredache
    Dec 11, 2014 at 20:32
  • Nothing there..
    – davidgo
    Dec 12, 2014 at 0:57
  • 1
    I've found useful tips at stackoverflow.com/questions/5881134/… - particularly with regard to using dmsetup info and related commands.
    – davidgo
    Dec 23, 2016 at 20:13

2 Answers 2

7

dmsetup remove_all worked for me, from the linked stackoverflow question.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .