I've got an external USB drive with an encrypted LUKS partition. I generally have no problems mounting the device; I click it from the xfce4 desktop and get a dialog where I enter the password.

When I try to mount the drive now, I type in the password and get the error:

Error unlocking /dev/sdc1: Command-line `cryptsetup luksOpen "/dev/sdc1" "luks-..."' exited with non-zero exit status 5: Device luks-... already exists

What do I need to do in order to mount the drive? Is it somehow corrupted? How can the device already exist if it's not mounted (and wasn't plugged in until a short time ago)?

  • 1
    is the name of the luks device in /dev/mapper/ ?
    – cegfault
    Jan 15, 2017 at 1:32
  • Rebooting works, of course, but it'd be nice to know if there's a way to un-munge the situation. I suspect the external device may not have been cleanly unmounted at a suspend operation or something.
    – Pointy
    Jan 15, 2017 at 2:16
  • @cegfault Well that's a good question; I suspect so, but I don't know for sure. I have since rebooted. I didn't know to check that; I apologize. If it happens again and I check that, what does the answer (there or not there) mean?
    – Pointy
    Jan 15, 2017 at 2:18

3 Answers 3


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.

  • OK thank you! I will try that the next time it happens. (In fact maybe I'll make it happen on purpose.)
    – Pointy
    Jan 15, 2017 at 23:43
  • 2
    you can also do dmsetup remove_all May 17, 2017 at 3:13
  • 12
    but this answer didn't even work for me - I just get device-mapper: remove ioctl on [device] failed: Device or resource busy May 17, 2017 at 3:29
  • 4
    @Hitechcomputergeek I got the same and had to close an old terminal I had left open to the drive. Nov 21, 2017 at 4:42
  • 2
    @Hitechcomputergeek See askubuntu.com/questions/429612/… for how to find and close all the resources that are using the device.
    – jII
    Jul 22, 2019 at 20:51

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

  • I manually deleted the file trying to tackle the issue in the question, it resulted in this situation. Also I deleted some other files, so fdisk no longer displayed "hanged" disk. But dmsetup remove_all helped (it was suggested by Hitechcomputergeek as comment to accepted answer). Apr 7 at 14:56

This one worked for me (change sde1 with your disk label):

sudo cryptsetup luksOpen /dev/sde1 lukslvm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.