Fixing "Stopping remaining crypto disks..." in SysVinit Debian and Devuan
2 January 2020
SysVinit Debian/Devuan installations have this problem: encrypted disks are not properly unmounted during shutdown, which results in this:
In the end, after some timeout, it just fails with an error.
Quite famous bug, it seems:
But we will not tolerate it, will we?
Run vgdisplay
and lvdisplay
.
# vgdisplay
--- Volume group ---
VG Name debian-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 19.74 GiB
PE Size 4.00 MiB
Total PE 5054
Alloc PE / Size 5054 / 19.74 GiB
Free PE / Size 0 / 0
VG UUID H3PpKg-f8BB-MncA-qJXb-Alf1-k80E-66KB3l
# lvdisplay
--- Logical volume ---
LV Path /dev/debian-vg/root
LV Name root
VG Name debian-vg
LV UUID TVTUmj-DAeh-3RE2-FIEV-ADRd-Kms7-ObWMIO
LV Write Access read/write
LV Creation host, time debian, 2020-01-01 18:53:41 -0500
LV Status available
# open 1
LV Size 18.74 GiB
Current LE 4798
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:1
--- Logical volume ---
LV Path /dev/debian-vg/swap_1
LV Name swap_1
VG Name debian-vg
LV UUID ASGoEn-2yn4-yQoX-aXS3-fEf2-oFca-WKUNqJ
LV Write Access read/write
LV Creation host, time debian, 2020-01-01 18:53:41 -0500
LV Status available
# open 2
LV Size 1.00 GiB
Current LE 256
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:2
Now go to /lib/cryptsetup
and open the cryptdisks-functions
file. Find do_stop
function and add these commands at the beginning:
lvchange -an /dev/debian-vg/root
vgchange -an debian-vg
dmsetup remove_all
Save the file and it's done.
If you have any comments, contact me by email.