[pkg-cryptsetup-devel] Bug#698758: Bug#698758: cryptsetup: cryptscripts_start deadlocks for 2 min when run from udev script
Jonas Meurer
jonas at freesources.org
Thu Dec 17 10:05:50 UTC 2015
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.
Cheers
jonas
>
> ### 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
>
> _______________________________________________
> pkg-cryptsetup-devel mailing list
> pkg-cryptsetup-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-cryptsetup-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-cryptsetup-devel/attachments/20151217/b4ea4537/attachment.sig>
More information about the pkg-cryptsetup-devel
mailing list