You are not logged in.

#1 2014-08-13 00:40:12

MikeDacre
Member
From: San Francisco Bay Area
Registered: 2013-01-18
Posts: 51
Website

cryptsetup fails to open Udev cookie 0xd4d94f5 (semid 0) waiting for z

For some reason cryptsetup won't work for me, I am trying to encrypt a usb-3 external drive.

I am creating an encrypted block device using the defaults:

#> cryptsetup --debug luksFormat /dev/sde
# cryptsetup 1.6.5 processing "cryptsetup --debug luksFormat /dev/sde"
# Running command luksFormat.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.

WARNING!
========
This will overwrite data on /dev/sde irrevocably.

Are you sure? (Type uppercase yes): YES
# Allocating crypt device /dev/sde context.
# Trying to open and read device /dev/sde.
# Initialising device-mapper backend library.
# Timeout set to 0 miliseconds.
# Iteration time set to 1000 miliseconds.
# Interactive passphrase entry requested.
Enter passphrase: 
Verify passphrase: 
# Formatting device /dev/sde as type LUKS1.
# Crypto backend (gcrypt 1.6.1) initialized.
# Topology: IO (4096/0), offset = 0; Required alignment is 1048576 bytes.
# Checking if cipher aes-xts-plain64 is usable.
# Using userspace crypto wrapper to access keyslot area.
# Generating LUKS header version 1 using hash sha1, aes, xts-plain64, MK 32 bytes
# Crypto backend (gcrypt 1.6.1) initialized.
# KDF pbkdf2, hash sha1: 1065626 iterations per second.
# Data offset 4096, UUID 998907dc-e6b2-4157-b84d-dbf8a3dfda41, digest iterations 130000
# Updating LUKS header of size 1024 on device /dev/sde
# Key length 32, device size 7814037160 sectors, header size 2050 sectors.
# Reading LUKS header of size 1024 from device /dev/sde
# Key length 32, device size 7814037160 sectors, header size 2050 sectors.
# Adding new keyslot -1 using volume key.
# Calculating data for key slot 0
# Crypto backend (gcrypt 1.6.1) initialized.
# KDF pbkdf2, hash sha1: 1069975 iterations per second.
# Key slot 0 use 522448 password iterations.
# Using hash sha1 for AF in key slot 0, 4000 stripes
# Updating key slot 0 [0x1000] area.
# Using userspace crypto wrapper to access keyslot area.
# Key slot 0 was enabled in LUKS header.
# Updating LUKS header of size 1024 on device /dev/sde
# Key length 32, device size 7814037160 sectors, header size 2050 sectors.
# Reading LUKS header of size 1024 from device /dev/sde
# Key length 32, device size 7814037160 sectors, header size 2050 sectors.
# Releasing crypt device /dev/sde context.
# Releasing device-mapper backend.
# Unlocking memory.
Command successful.

Then, when I try to open it, this happens:

#> cryptsetup --debug --verbose luksOpen /dev/sdd test2
# cryptsetup 1.6.5 processing "cryptsetup --debug --verbose luksOpen /dev/sdd test2"
# Running command open.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating crypt device /dev/sdd context.
# Trying to open and read device /dev/sdd.
# Initialising device-mapper backend library.
# Trying to load LUKS1 crypt type from device /dev/sdd.
# Crypto backend (gcrypt 1.6.1) initialized.
# Reading LUKS header of size 1024 from device /dev/sdd
# Key length 16, device size 7814037160 sectors, header size 1029 sectors.
# Timeout set to 0 miliseconds.
# Password retry count set to 3.
# Password verification disabled.
# Iteration time set to 1000 miliseconds.
# Activating volume test2 [keyslot -1] using [none] passphrase.
# Detected kernel Linux 3.15.8-1-ARCH x86_64.
# dm version   OF   [16384] (*1)
# dm versions   OF   [16384] (*1)
# Device-mapper backend running with UDEV support enabled.
# dm status test2  OF   [16384] (*1)
# Interactive passphrase entry requested.
Enter passphrase for /dev/sdd: 
# Trying to open key slot 0 [ACTIVE_LAST].
# Reading key slot 0 area.
# Using userspace crypto wrapper to access keyslot area.
Key slot 0 unlocked.
# Calculated device size is 7814035112 sectors (RW), offset 2048.
# Detected kernel Linux 3.15.8-1-ARCH x86_64.
# dm versions   OF   [16384] (*1)
# Device-mapper backend running with UDEV support enabled.
# DM-UUID is CRYPT-LUKS1-abd9ea25d4e647608ee9f41015240b53-test2
# Udev cookie 0xd4d94f5 (semid 0) created
# Udev cookie 0xd4d94f5 (semid 0) incremented to 1
# Udev cookie 0xd4d94f5 (semid 0) incremented to 2
# Udev cookie 0xd4d94f5 (semid 0) assigned to CREATE task(0) with flags         (0x0)
# Detected kernel Linux 3.15.8-1-ARCH x86_64.
# dm versions   OF   [16384] (*1)
# Device-mapper backend running with UDEV support enabled.
# dm create test2 CRYPT-LUKS1-abd9ea25d4e647608ee9f41015240b53-test2 OF   [16384] (*1)
# dm reload test2  OF   [16384] (*1)
# dm resume test2  OF   [16384] (*1)
# test2: Stacking NODE_ADD (254,0) 0:0 0600 [verify_udev]
# test2: Stacking NODE_READ_AHEAD 256 (flags=1)
# Udev cookie 0xd4d94f5 (semid 0) decremented to 1
# Udev cookie 0xd4d94f5 (semid 0) waiting for zero

I ran this with

udevadm --monitor

running in the background:

UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[205.609832] add      /module/dm_mod (module)
KERNEL[205.609884] add      /kernel/slab/:t-0002632 (slab)
KERNEL[205.610014] add      /kernel/slab/:t-0003312 (slab)
KERNEL[205.610118] add      /devices/virtual/misc/device-mapper (misc)
UDEV  [205.610810] add      /module/dm_mod (module)
UDEV  [205.611253] add      /kernel/slab/:t-0002632 (slab)
UDEV  [205.611681] add      /kernel/slab/:t-0003312 (slab)
UDEV  [205.612281] add      /devices/virtual/misc/device-mapper (misc)
KERNEL[211.964174] add      /module/af_alg (module)
UDEV  [211.964503] add      /module/af_alg (module)
KERNEL[211.965557] add      /module/algif_skcipher (module)
UDEV  [211.965732] add      /module/algif_skcipher (module)
KERNEL[212.180828] add      /devices/virtual/bdi/254:0 (bdi)
KERNEL[212.180883] add      /devices/virtual/block/dm-0 (block)
KERNEL[212.180957] change   /devices/pci0000:00/0000:00:1c.2/0000:07:00.0/usb6/6-1/6-1:1.0/host16/target16:0:0/16:0:0:0/block/sdd (block)
UDEV  [212.181154] add      /devices/virtual/bdi/254:0 (bdi)
UDEV  [212.181435] add      /devices/virtual/block/dm-0 (block)
KERNEL[212.183751] add      /module/dm_crypt (module)
UDEV  [212.183875] add      /module/dm_crypt (module)
KERNEL[212.184126] change   /devices/virtual/block/dm-0 (block)

I case it isn't clear, cryptsetup just hangs. I can only close it with SIGKILL, and then device

/dev/sdd

and

test2

are unavialable until reboot. If I want to try again I have to unplug the drive, plug it back in, find its new device id (since the old one hasn't been released yet), and then try again with a new name, as

test2

also hasn't been released.

cyrptsetup luksDump returns this:

# cryptsetup 1.6.5 processing "cryptsetup luksDump /dev/sdd --debug"
# Running command luksDump.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating crypt device /dev/sdd context.
# Trying to open and read device /dev/sdd.
# Initialising device-mapper backend library.
# Trying to load LUKS1 crypt type from device /dev/sdd.
# Crypto backend (gcrypt 1.6.1) initialized.
# Reading LUKS header of size 1024 from device /dev/sdd
# Key length 16, device size 7814037160 sectors, header size 1029 sectors.
LUKS header information for /dev/sdd

Version:        1
Cipher name:    aes
Cipher mode:    cbc-plain
Hash spec:      sha1
Payload offset: 2048
MK bits:        128
MK digest:      0a 55 0a 28 5d 50 5f d3 c9 9b 4e 3b d0 0e e2 8b b2 fd 1a 29 
MK salt:        bb aa bf 65 fc 38 a8 c4 aa c6 3b 4b 2a 02 b1 78 
                9a 8a 9d 6f fb d5 39 24 0d 3b 48 5d 83 44 f1 4c 
MK iterations:  129625
UUID:           abd9ea25-d4e6-4760-8ee9-f41015240b53

Key Slot 0: ENABLED
        Iterations:             522448
        Salt:                   75 f6 db 6c 27 a6 15 f3 58 b4 b3 10 6a 02 fc d3 
                                03 e6 ba 3b a2 4b 4c d1 c6 af f4 11 14 0a 99 9a 
        Key material offset:    8
        AF stripes:             4000
Key Slot 1: DISABLED
Key Slot 2: DISABLED
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED
# Releasing crypt device /dev/sdd context.
# Releasing device-mapper backend.
# Unlocking memory.
Command successful.

and cryptsetup benchmark returns this:

#> cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1      1069975 iterations per second
PBKDF2-sha256     655360 iterations per second
PBKDF2-sha512     517049 iterations per second
PBKDF2-ripemd160  639375 iterations per second
PBKDF2-whirlpool  247305 iterations per second
#  Algorithm | Key |  Encryption |  Decryption
     aes-cbc   128b   649.8 MiB/s  2215.2 MiB/s
 serpent-cbc   128b    78.6 MiB/s   321.1 MiB/s
 twofish-cbc   128b   184.1 MiB/s   348.9 MiB/s
     aes-cbc   256b   477.4 MiB/s  1691.5 MiB/s
 serpent-cbc   256b    81.7 MiB/s   321.2 MiB/s
 twofish-cbc   256b   184.8 MiB/s   349.1 MiB/s
     aes-xts   256b  1913.5 MiB/s  1931.1 MiB/s
 serpent-xts   256b   329.6 MiB/s   314.6 MiB/s
 twofish-xts   256b   343.3 MiB/s   345.0 MiB/s
     aes-xts   512b  1487.0 MiB/s  1498.1 MiB/s
 serpent-xts   512b   330.6 MiB/s   313.8 MiB/s
 twofish-xts   512b   339.8 MiB/s   344.5 MiB/s
cryptsetup benchmark  4.90s user 23.90s system 99% cpu 28.852 total

It seems like something weird is going on with udev. This wouldn't surprise me as I have had issues with it just refusing to recognise usb3 drives from time to time. Any ideas?

Offline

Board footer

Powered by FluxBB