Mounting USB disk with LUKS encrypted partion fails with a cryptsetup "Device already exists" error
Solution 1:
Yes, this happens when luks encrypted device was not cleanly deactivated with cryptsetup close.
You can try to remove the mapping using
dmsetup remove /dev/mapper/luks-...
if you want to avoid rebooting.
Solution 2:
From my side, when it happened the dmsetup remove /dev/mapper/luks-
command didn't work due to the fact that the specified mapped disk is no more present under /dev/mapper ...
So I had to manually close the old mapping with:
cryptsetup luksClose /dev/sdxx /dev/mapper/luks-...
(where sdx correspond to the luks partition you have identified with fdisk -l
Solution 3:
This one worked for me (change sde1
with your disk label):
sudo cryptsetup luksOpen /dev/sde1 lukslvm