Your message dated Thu, 17 Dec 2015 11:06:39 +0100
with message-id <[email protected]>
and subject line Re: [pkg-cryptsetup-devel] Bug#698758: cryptsetup: 
cryptscripts_start deadlocks for 2 min when run from udev script
has caused the Debian Bug report #698758,
regarding cryptsetup: cryptscripts_start deadlocks for 2 min when run from udev 
script
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
698758: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698758
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: cryptsetup
Version: 2:1.4.3-4
Severity: minor
Tags: patch

Dear Maintainer,

I have a LUKS container on a removable drive, and wanted cryptdisks_start
to automatically open it (using the decrypt_derived keyscript) whenever 
I plugged it in.  An obvious way to achieve this is with a udev script.  
However, cryptdisks_start calls 'udevadm settle' at a certain point.  So 
any such udev script will deadlock until the default 120 second timeout 
is reached.  Having to wait 2 minutes for the devices for my encrypted 
USB drive to appear is not really a big deal, but it is annoying.

I propose the following patch to /lib/cryptsetup/cryptdisks.functions 
which checks whether or not the script is being called by a binary 
called '/sbin/udevd' before calling 'udevadm settle'.  This solves my 
problem, yet I feel like there should be a better way to do this by 
playing around with --seq-start or --seq-end option to udevadm.  I don't 
really understand the situation that requires that 'udevadm settle' 
command to be there.  A quick googling indicated that that it's 
important for avoiding a race condition involving the detection of new
swap devices.

### BEGIN PATCH ###

--- a/lib/cryptsetup/cryptdisks.functions
+++ b/lib/cryptsetup/cryptdisks.functions
@@ -430,7 +430,12 @@
 # Rename the device from its temp name to its final name, which will
 # trigger mountall
 finalize_device () {
-       if [ -x /sbin/udevadm ]; then
+       local parent_link
+
+       parent_link="/proc/$PPID/exe"
+       if [ ! -h $parent_link ] || \
+          [ "$( /bin/readlink $parent_link )" != "/sbin/udevd" ] && \
+          [ -x /sbin/udevadm ]; then
                udevadm settle
        fi
        dmsetup rename "${dst}_unformatted" "$dst"

### END PATCH ###

-- Package-specific info:
-- /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.2.0-4-amd64 
root=UUID=fd750c27-b2d1-4bcc-a6f9-339ebea239a1 ro nouveau.blacklist=1 
i915.i915_enable_rc6=1 i915.semaphores=1 pcie_aspm=force quiet

-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages cryptsetup depends on:
ii  cryptsetup-bin         2:1.4.3-4
ii  debconf [debconf-2.0]  1.5.49
ii  dmsetup                2:1.02.74-4
ii  libc6                  2.13-37

Versions of packages cryptsetup recommends:
ii  busybox                                 1:1.20.0-7
ii  console-setup                           1.88
ii  initramfs-tools [linux-initramfs-tool]  0.109
ii  kbd                                     1.15.3-9

Versions of packages cryptsetup suggests:
ii  dosfstools              3.0.13-1
ii  liblocale-gettext-perl  1.05-7+b1

-- debconf information:
  cryptsetup/prerm_active_mappings: true

--- End Message ---
--- Begin Message ---
Am 17.12.2015 um 11:05 schrieb Jonas Meurer:
> Am 23.01.2013 um 11:19 schrieb Andrew Stimpson:
>> Package: cryptsetup
>> Version: 2:1.4.3-4
>> Severity: minor
>> Tags: patch
>>
>> Dear Maintainer,
>>
>> I have a LUKS container on a removable drive, and wanted cryptdisks_start
>> to automatically open it (using the decrypt_derived keyscript) whenever 
>> I plugged it in.  An obvious way to achieve this is with a udev script.  
>> However, cryptdisks_start calls 'udevadm settle' at a certain point.  So 
>> any such udev script will deadlock until the default 120 second timeout 
>> is reached.  Having to wait 2 minutes for the devices for my encrypted 
>> USB drive to appear is not really a big deal, but it is annoying.
>>
>> I propose the following patch to /lib/cryptsetup/cryptdisks.functions 
>> which checks whether or not the script is being called by a binary 
>> called '/sbin/udevd' before calling 'udevadm settle'.  This solves my 
>> problem, yet I feel like there should be a better way to do this by 
>> playing around with --seq-start or --seq-end option to udevadm.  I don't 
>> really understand the situation that requires that 'udevadm settle' 
>> command to be there.  A quick googling indicated that that it's 
>> important for avoiding a race condition involving the detection of new
>> swap devices.
> 
> I'm closing this bugreport since the way udev works changed a lot in the
> last years. /sbin/udevd doesn't even exist in current stable anymore. If
> the bugreport is still valid for you, feel free to reopen.

This time closing for real.


Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---

Reply via email to