[pkg-cryptsetup-devel] cryptsetup-run: System hangs (minutes until timeout) on lvm on luks during shutdown. Patch attached.

Dr. Jan Hauß devuan at drhauss.de
Fri Nov 1 20:27:01 GMT 2019


  Package: cryptsetup-run
  Version: 2:2.1.0-5+deb10u2
  Followup-For: Bug #720340



  -- Package-specific info:

  -- System Information:
  Debian Release: 10.0
  Architecture: amd64 (x86_64)
  Foreign Architectures: i386

  Kernel: Linux 4.19.0-6-amd64 (SMP w/4 CPU cores)
  Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8),
  LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
  Shell: /bin/sh linked to /bin/dash
  Init: sysvinit (via /sbin/init)
  LSM: AppArmor: enabled

  Versions of packages cryptsetup-run depends on:
  ii  cryptsetup-bin         2:2.1.0-5+deb10u2
  ii  debconf [debconf-2.0]  1.5.71
  ii  dmsetup                2:1.02.155-3
  ii  libc6                  2.28-10

  cryptsetup-run recommends no packages.

  Versions of packages cryptsetup-run suggests:
  ii  dosfstools              4.1-2
  ii  keyutils                1.6-6
  ii  liblocale-gettext-perl  1.07-3+b4

  -- debconf information:
    cryptsetup/prerm_active_mappings: true

I run Devuan beowulf on LVM on LUKS.
In function do_stop in file /lib/cryptsetup/cryptdisks.functions here is 
a vary off of the VGs missing. So the function handle_crypttab_line_stop 
gives unwanted return values and sleep $i within the funtion do_stop 
increments slowly to 16...
Which slows down the shutdown by unnecessary minutes.

I wrote the following patch according to the function activate_vg from
/usr/share/initramfs-tools/scripts/local-top/cryptroot
which varys on the VGs before chroot.

 
-----------------------patch------------------------------------------------------

  --- /lib/cryptsetup/cryptdisks-functions.orig   2019-09-30 
21:17:28.999962846 +0200
  +++ /lib/cryptsetup/cryptdisks-functions        2019-09-30 
21:24:53.219944630 +0200
  @@ -180,6 +180,15 @@
   # Removes all mappings in crypttab
   do_stop() {
       dmsetup mknodes
  +    local vgs vg
  +       if [ -x /sbin/lvm ]; then
  +        vgs="$(/sbin/lvm vgscan | sed -n 
'/"/s/^.*"\([^'\'']*\)".*$/\1/p')"
  +         if [ -n "${vgs}" ]; then
  +          for vg in ${vgs}; do
  +           /sbin/lvm vgchange -a n ${vg} >/dev/null 2>&1
  +          done
  +         fi
  +        fi
       log_action_begin_msg "Stopping $INITSTATE crypto disks"

       crypttab_foreach_entry _do_stop_callback
 
------------------------patch/-----------------------------------------------------

The above patch silently varys off the VGs and makes 
handle_crypttab_line_stop work.

  Kind regards

  Jan
> 




More information about the pkg-cryptsetup-devel mailing list