Devuan bug report logs - #237
cryptsetup: System hangs (minutes until timeout) on lvm on luks during shutdown. Patch attached.

Package: cryptsetup; Reported by: =?utf-8?q?Dr=2E_Jan_Hau=C3=9F?= <devujan@drhauss.de>;
Date: Thu, 23 Aug 2018 15:03:01 UTC;
Maintainer for cryptsetup is (unknown).

View this report as an mbox folder.


Report forwarded to devuan-bugs@lists.dyne.org, owner@bugs.devuan.org:
bug#237; Package cryptsetup. Full text available.



Acknowledgement sent to =?utf-8?q?Dr=2E_Jan_Hau=C3=9F?= <devujan@drhauss.de>:
New bug report received and forwarded. Copy sent to owner@bugs.devuan.org. Full text available.



Message received at submit@bugs.devuan.org:

From: =?utf-8?q?Dr=2E_Jan_Hau=C3=9F?= <devujan@drhauss.de>
To: Devuan Bug Tracking System <submit@bugs.devuan.org>
Subject: cryptsetup: System hangs (minutes until timeout) on lvm on luks during shutdown. Patch attached.
Date: Thu, 23 Aug 2018 16:47:41 +0200

Package: cryptsetup
Version: 2:1.7.3-4
Severity: normal



-- Package-specific info:
-- /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.17.0-0.bpo.1-amd64 root=/dev/mapper/svg-root_d2_lv ro quiet amdgpu.dc=1 resume=UUID=54f94d03-5f1d-4725-9e36-3ec18b6910f3 ivrs_ioapic[4]=00:14.0 ivrs_ioapic[5]=00:00.2 pcie_aspm=force acpi_serialize pci=noaer

-- /etc/crypttab
nvme0n1p3_crypt UUID=8e567911-848f-4f16-aaeb-f054c7571b09 root_key luks,keyscript=/lib/cryptsetup/scripts/decrypt_keyctl
nvme0n1p4_crypt UUID=a5576297-455b-4ef7-920d-761e27f5fe10 root_key luks,keyscript=/lib/cryptsetup/scripts/decrypt_keyctl
sda7_crypt UUID=5fdbcf43-4cb9-4017-8cd0-89b041c94f05 root_key luks,keyscript=/lib/cryptsetup/scripts/decrypt_keyctl

-- /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/svg-root_d2_lv /               xfs     defaults        0       0
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=9A3B-5F19  /boot/efi       vfat    umask=0077      0       1
/dev/mapper/svg-srv_d2_lv /srv            xfs     nodev,nosuid    0       0
/dev/mapper/svg-usr_d2_lv /usr            xfs     nodev           0       0
/dev/mapper/svg-usr_share_d2_lv /usr/share      xfs     nodev,nosuid    0       0
/dev/mapper/svg-var_d2_lv /var            xfs     nodev,nosuid,noexec 0       0
/dev/mapper/svg-var_cache_d2_lv /var/cache      xfs     nodev,nosuid    0       0
/dev/mapper/svg-var_lib_d2_lv /var/lib        xfs     defaults        0       0
/dev/mapper/svg-var_log_d2_lv /var/log        xfs     nodev,nosuid,noexec 0       0
/dev/mapper/svg-var_spool_d2_lv /var/spool      xfs     nodev,nosuid,noexec 0       0
/dev/mapper/svg-var_tmp_d2_lv /var/tmp        ext2    nodev,user_xattr 0       2
/dev/mapper/svg-opt_d2_lv /opt        xfs    nodev,nosuid	0       2
/dev/mapper/svg-tmp_lv /tmp        ext2    nodev,user_xattr 0       2
/dev/mapper/uvg-home_lv /home           xfs     nodev,nosuid    0       0
/dev/mapper/svg-swap_lv none            swap    sw              0       0

-- lsmod
Module                  Size  Used by
rfcomm                 86016  12
cmac                   16384  0
appletalk              45056  0
ax25                   69632  0
ipx                    32768  0
p8023                  16384  1 ipx
p8022                  16384  1 ipx
psnap                  16384  2 appletalk,ipx
llc                    16384  2 p8022,psnap
bnep                   24576  2
iptable_filter         16384  0
ip_tables              28672  1 iptable_filter
fuse                  118784  3
x_tables               49152  2 iptable_filter,ip_tables
ext4                  741376  2
mbcache                16384  1 ext4
jbd2                  118784  1 ext4
fscrypto               32768  1 ext4
ecb                    16384  0
nls_ascii              16384  1
nls_cp437              20480  1
vfat                   20480  1
fat                    77824  1 vfat
parport_pc             32768  0
ppdev                  20480  0
lp                     20480  0
parport                57344  3 parport_pc,lp,ppdev
dm_cache_smq           28672  1
dm_cache               69632  2 dm_cache_smq
dm_persistent_data     86016  1 dm_cache
dm_bio_prison          20480  1 dm_cache
dm_bufio               32768  1 dm_persistent_data
arc4                   16384  2
amdkfd                200704  1
snd_hda_codec_realtek   110592  1
amdgpu               3125248  17
snd_hda_codec_generic    86016  1 snd_hda_codec_realtek
snd_hda_codec_hdmi     57344  1
snd_hda_intel          45056  4
uvcvideo              114688  0
btusb                  53248  0
ath10k_pci             61440  0
snd_hda_codec         151552  4 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek
btrtl                  16384  1 btusb
videobuf2_vmalloc      16384  1 uvcvideo
chash                  16384  1 amdgpu
videobuf2_memops       16384  1 videobuf2_vmalloc
edac_mce_amd           28672  0
btbcm                  16384  1 btusb
gpu_sched              28672  1 amdgpu
ath10k_core           344064  1 ath10k_pci
snd_hda_core           94208  5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek
btintel                24576  1 btusb
videobuf2_v4l2         28672  1 uvcvideo
ttm                   126976  1 amdgpu
kvm_amd               106496  0
ath                    32768  1 ath10k_core
snd_hwdep              20480  1 snd_hda_codec
ccp                    94208  1 kvm_amd
videobuf2_common       49152  2 videobuf2_v4l2,uvcvideo
bluetooth             630784  39 btrtl,btintel,btbcm,bnep,btusb,rfcomm
efi_pstore             16384  0
dell_wmi               16384  0
dell_laptop            24576  1
snd_pcm               118784  4 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_core
dell_smbios            28672  2 dell_wmi,dell_laptop
snd_timer              36864  1 snd_pcm
dcdbas                 16384  1 dell_smbios
drbg                   28672  1
wmi_bmof               16384  0
videodev              212992  3 videobuf2_v4l2,uvcvideo,videobuf2_common
sparse_keymap          16384  1 dell_wmi
dell_wmi_descriptor    16384  2 dell_wmi,dell_smbios
dell_smm_hwmon         16384  0
rtsx_usb_ms            20480  0
ansi_cprng             16384  0
mac80211              827392  1 ath10k_core
drm_kms_helper        196608  1 amdgpu
ecdh_generic           24576  1 bluetooth
snd                    94208  16 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_pcm
memstick               16384  1 rtsx_usb_ms
cdc_acm                32768  0
joydev                 24576  0
crc16                  16384  2 bluetooth,ext4
chaoskey               16384  0
media                  45056  2 videodev,uvcvideo
evdev                  28672  17
kvm                   724992  1 kvm_amd
irqbypass              16384  1 kvm
tpm_crb                16384  0
drm                   462848  10 gpu_sched,drm_kms_helper,amdgpu,ttm
cfg80211              774144  3 ath,mac80211,ath10k_core
soundcore              16384  1 snd
i2c_algo_bit           16384  1 amdgpu
serio_raw              16384  0
tpm_tis                16384  0
pcspkr                 16384  0
tpm_tis_core           20480  1 tpm_tis
efivars                20480  1 efi_pstore
k10temp                16384  0
wmi                    28672  4 dell_wmi,wmi_bmof,dell_smbios,dell_wmi_descriptor
shpchp                 40960  0
sp5100_tco             16384  0
tpm                    65536  3 tpm_tis,tpm_crb,tpm_tis_core
dell_rbtn              16384  0
battery                24576  0
rng_core               16384  3 ccp,chaoskey,tpm
video                  45056  2 dell_wmi,dell_laptop
ac                     16384  0
rfkill                 28672  9 bluetooth,dell_laptop,dell_rbtn,cfg80211
button                 16384  0
acpi_cpufreq           24576  0
xfs                  1495040  11
libcrc32c              16384  2 dm_persistent_data,xfs
crc32c_generic         16384  0
algif_skcipher         16384  0
af_alg                 28672  1 algif_skcipher
dm_crypt               45056  3
dm_mod                147456  59 dm_crypt,dm_cache,dm_bufio
rtsx_usb_sdmmc         28672  0
mmc_core              172032  1 rtsx_usb_sdmmc
rtsx_usb               20480  2 rtsx_usb_sdmmc,rtsx_usb_ms
sg                     36864  0
hid_generic            16384  0
usbhid                 57344  0
sd_mod                 53248  2
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
crc32c_intel           24576  3
ghash_clmulni_intel    16384  0
pcbc                   16384  0
ahci                   40960  1
libahci                40960  1 ahci
aesni_intel           200704  7
xhci_pci               16384  0
aes_x86_64             20480  1 aesni_intel
libata                278528  2 libahci,ahci
crypto_simd            16384  1 aesni_intel
xhci_hcd              262144  1 xhci_pci
cryptd                 28672  6 crypto_simd,ghash_clmulni_intel,aesni_intel
glue_helper            16384  1 aesni_intel
psmouse               172032  0
nvme                   36864  3
usbcore               290816  8 xhci_hcd,usbhid,cdc_acm,rtsx_usb,uvcvideo,btusb,xhci_pci,chaoskey
scsi_mod              253952  3 sd_mod,libata,sg
i2c_piix4              24576  0
usb_common             16384  1 usbcore
r8169                  94208  0
mii                    16384  1 r8169
nvme_core              77824  5 nvme
i2c_hid                24576  0
hid                   135168  3 i2c_hid,usbhid,hid_generic


-- System Information:
Distributor ID:	Devuan
Description:	Devuan GNU/Linux 2.0 (ascii)
Release:	2.0
Codename:	ascii

Architecture: x86_64

Kernel: Linux 4.17.0-0.bpo.1-amd64 (SMP w/8 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages cryptsetup depends on:
ii  cryptsetup-bin         2:1.7.3-4
ii  debconf [debconf-2.0]  1.5.61
ii  dmsetup                2:1.02.137-2
ii  libc6                  2.24-11+deb9u3

Versions of packages cryptsetup recommends:
ii  busybox                                 1:1.22.0-19+b3
ii  console-setup                           1.164
ii  initramfs-tools [linux-initramfs-tool]  0.130
ii  kbd                                     2.0.3-2+b1

Versions of packages cryptsetup suggests:
ii  dosfstools              4.1-1
ii  keyutils                1.5.9-9
ii  liblocale-gettext-perl  1.07-3+b1

-- debconf information:
  cryptsetup/prerm_active_mappings: true

I run the Devuan ASCII system on LVM on LUKS.
In function do_stop in file /lib/cryptsetup/cryptdisks.functions there 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   2018-08-14 17:12:31.543227705 +0200
+++ /lib/cryptsetup/cryptdisks.functions        2018-08-23 16:36:23.849064962 +0200
@@ -763,9 +763,17 @@
 
 # Removes all mappings in crypttab
 do_stop () {
-       local dst src key opts opencount major minor
+       local dst src key opts opencount major minor vgs vg
 
        dmsetup mknodes
+       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"
 
        egrep -v "^[[:space:]]*(#|$)" "$TABFILE" | while read dst src key opts; do
------------------------patch/-----------------------------------------------------

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

Kind regards

Jan





Devuan BTS -- Powered by Debian bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.

Devuan Bugs Owner <owner@bugs.devuan.org>.
Last modified: Mon, 10 Dec 2018 11:08:42 UTC