Sample Header Ad - 728x90

Why does this udev rule cause cryptsetup to freeze?

1 vote
1 answer
306 views
I have this rule which runs a script to send me an email whenever a drive drops out of the system: SUBSYSTEM=="block", ACTION=="remove", ENV{DEVTYPE}=="disk",\ RUN="/usr/sbin/disk-monitor.sh $env{DEVNAME}" This is the script: #!/bin/bash echo "Dropout detected $(date)" | mail -s "WARNING: Drive $1 has dropped out!" logger@gentooserver It causes certain cryptsetup commands to freeze like "cryptsetup close" and "integritysetup format". Why does this happen? cryptsetup --debug close offline1 # cryptsetup 2.4.3 processing "cryptsetup --debug close offline1" # Running command close. # Locking memory. # Installing SIGINT/SIGTERM handler. # Unblocking interruption on signal. # Allocating crypt device context by device offline1. # Initialising device-mapper backend library. # dm version [ opencount flush ] (*1) # dm versions [ opencount flush ] (*1) # Detected dm-ioctl version 4.47.0. # Detected dm-crypt version 1.24.0. # Detected dm-integrity version 1.10.0. # Device-mapper backend running with UDEV support enabled. # dm status offline1 [ opencount noflush ] (*1) # Releasing device-mapper backend. # Trying to open and read device /dev/sdk1 with direct-io. # Allocating context for crypt device /dev/sdk1. # Trying to open and read device /dev/sdk1 with direct-io. # Initialising device-mapper backend library. # dm versions [ opencount flush ] (*1) # dm table offline1 [ opencount flush securedata ] (*1) # Trying to open and read device /dev/sdk1 with direct-io. # dm versions [ opencount flush ] (*1) # dm deps offline1 [ opencount flush ] (*1) # Crypto backend (OpenSSL 1.1.1t 7 Feb 2023) initialized in cryptsetup library version 2.4.3. # Detected kernel Linux 6.1.12-gentoo-x86_64 x86_64. # Reloading LUKS2 header (repair disabled). # Acquiring read lock for device /dev/sdk1. # Opening lock resource file /run/cryptsetup/L_8:161 # Verifying lock handle for /dev/sdk1. # Device /dev/sdk1 READ lock taken. # Trying to read primary LUKS2 header at offset 0x0. # Opening locked device /dev/sdk1 # Verifying locked device handle (bdev) # LUKS2 header version 2 of size 16384 bytes, checksum sha256. # Checksum:a4bc53825c88a45b53709738107a718a9c4f896dfef90951cfd9d9cfe68dd259 (on-disk) # Checksum:a4bc53825c88a45b53709738107a718a9c4f896dfef90951cfd9d9cfe68dd259 (in-memory) # Trying to read secondary LUKS2 header at offset 0x4000. # Reusing open ro fd on device /dev/sdk1 # LUKS2 header version 2 of size 16384 bytes, checksum sha256. # Checksum:ca42f7c96748267f126f3ab48536dee1a05525aa1db10a1feb85a5a60e3338e8 (on-disk) # Checksum:ca42f7c96748267f126f3ab48536dee1a05525aa1db10a1feb85a5a60e3338e8 (in-memory) # Device size 4000785964544, offset 16777216. # Device /dev/sdk1 READ lock released. # PBKDF argon2id, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_threads 4. # Deactivating volume offline1. # dm versions [ opencount flush ] (*1) # dm status offline1 [ opencount noflush ] (*1) # dm versions [ opencount flush ] (*1) # dm table offline1 [ opencount flush securedata ] (*1) # Trying to open and read device /dev/sdk1 with direct-io. # dm versions [ opencount flush ] (*1) # dm deps offline1 [ opencount flush ] (*1) # dm versions [ opencount flush ] (*1) # dm table offline1 [ opencount flush securedata ] (*1) # dm versions [ opencount flush ] (*1) # Udev cookie 0xd4d82bf (semid 5) created # Udev cookie 0xd4d82bf (semid 5) incremented to 1 # Udev cookie 0xd4d82bf (semid 5) incremented to 2 # Udev cookie 0xd4d82bf (semid 5) assigned to REMOVE task(2) with flags DISABLE_LIBRARY_FALLBACK (0x20) # dm remove offline1 [ opencount flush retryremove ] (*1) # Udev cookie 0xd4d82bf (semid 5) decremented to 1 # Udev cookie 0xd4d82bf (semid 5) waiting for zero //hangs here udev log: Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Device is queued (SEQNUM=4516, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Device ready for processing (SEQNUM=4516, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: Successfully forked off 'n/a' as PID 8410. Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Worker is forked for processing SEQNUM=4516. Feb 26 18:51:38 gentoodesktop systemd-udevd: 252:2: Device is queued (SEQNUM=4517, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: 252:2: Device ready for processing (SEQNUM=4517, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Processing device (SEQNUM=4516, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Removing watch handle 50. Feb 26 18:51:38 gentoodesktop systemd-udevd: Successfully forked off 'n/a' as PID 8411. Feb 26 18:51:38 gentoodesktop systemd-udevd: 252:2: Worker is forked for processing SEQNUM=4517. Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Device is queued (SEQNUM=4518, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: SEQNUM=4518 blocked by SEQNUM=4516 Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: /usr/lib/udev/rules.d/95-dm-notify.rules:12 RUN '/sbin/dmsetup udevcomplete $env{DM_COOKIE}' Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: /usr/lib/udev/rules.d/disk-monitor.rules:4 RUN '/usr/sbin/disk-monitor.sh $env{DEVNAME}' Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: No reference left for '/dev/mapper/offline1', removing Feb 26 18:51:38 gentoodesktop systemd-udevd: 252:2: Processing device (SEQNUM=4517, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: No reference left for '/dev/disk/by-id/dm-name-offline1', removing Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: No reference left for '/dev/disk/by-id/dm-uuid-CRYPT-LUKS2-f2eafcc2880e4d34afa3132486d1d6ae-offline1', removing Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: No reference left for '/dev/disk/by-uuid/5d5633e2-2f7c-49de-babf-f3ed263a3c8b', removing Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Running command "/usr/sbin/disk-monitor.sh /dev/dm-2" Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Starting '/usr/sbin/disk-monitor.sh /dev/dm-2' Feb 26 18:51:38 gentoodesktop systemd-udevd: Successfully forked off '(spawn)' as PID 8412. Feb 26 18:51:38 gentoodesktop systemd-udevd: 252:2: Device processed (SEQNUM=4517, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: 252:2: sd-device-monitor(worker): Passed 167 byte to netlink monitor. Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Process '/usr/sbin/disk-monitor.sh /dev/dm-2' succeeded. Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Device processed (SEQNUM=4516, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: sd-device-monitor(worker): Passed 963 byte to netlink monitor. Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Device ready for processing (SEQNUM=4518, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: sd-device-monitor(manager): Passed 230 byte to netlink monitor. Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Processing device (SEQNUM=4518, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Removing watch handle -1. Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: /usr/lib/udev/rules.d/disk-monitor.rules:4 RUN '/usr/sbin/disk-monitor.sh $env{DEVNAME}' Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Running command "/usr/sbin/disk-monitor.sh /dev/dm-2" Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Starting '/usr/sbin/disk-monitor.sh /dev/dm-2' Feb 26 18:51:38 gentoodesktop systemd-udevd: Successfully forked off '(spawn)' as PID 8419. Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Process '/usr/sbin/disk-monitor.sh /dev/dm-2' succeeded. Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: Device processed (SEQNUM=4518, ACTION=remove) Feb 26 18:51:38 gentoodesktop systemd-udevd: dm-2: sd-device-monitor(worker): Passed 230 byte to netlink monitor. Feb 26 18:51:38 gentoodesktop systemd-udevd: No events are queued, removing /run/udev/queue. Feb 26 18:51:42 gentoodesktop systemd-udevd: Cleanup idle workers Feb 26 18:51:42 gentoodesktop systemd-udevd: Unload kernel module index. Feb 26 18:51:42 gentoodesktop systemd-udevd: Unload kernel module index. Feb 26 18:51:42 gentoodesktop systemd-udevd: Unloaded link configuration context. Feb 26 18:51:42 gentoodesktop systemd-udevd: Unloaded link configuration context. Feb 26 18:51:42 gentoodesktop systemd-udevd: Worker exited. Feb 26 18:51:42 gentoodesktop systemd-udevd: Worker exited. Feb 26 18:51:46 gentoodesktop systemd-udevd: Cleanup idle workers
Asked by Gooberpatrol66 (417 rep)
Feb 27, 2023, 01:02 AM
Last activity: Feb 28, 2023, 07:22 AM