Error mounting encrypted usb key

When trying to mount an encrypted usb flash drive you get an error like this..

Error unlocking device: cryptsetup exited with exit code 239: Device udisks-luks-uuid-d7ae2258-b3ae-4ga1-bcn5-6ea39ba1d16b-uid1000 already exists.

It means you didn't unmount or safely eject it last time. To fix just do this..

sudo dmsetup remove /dev/mapper/udisks-luks-uuid-d7ae2258-b3ae-4ga1-bcn5-6ea39ba1d16b-uid1000

Note that "udisks-luks-uuid-d7ae2258-b3ae-4ga1-bcn5-6ea39ba1d16b-uid1000" is just an example, yours will be different - you can see yours in the error message or if there's only one you can just hit tab to auto-complete after "sudo dmsetup remove /dev/mapper/"

Now you can mount it as usual.


Looking for great online sysadmin training in Linux, Security & Hacking and many others?