0

ver since I set up my LUKS-encrypted BTRFS RAID1 between my two NVMe drives on Debian 12, the shutdown process has taken way too long, about a minute and a half.

I had to get a video of the shutdown screen before it powers off, which led me to the culprit of the dm/crypt not being un-mounted.

I realize that / being on the unlocked BTRFS file systems must complicate the umounting process during shutdown, but waiting this long cannot be the only way.

I wouldn't care too much, as other posts about this issue suggest, except that waiting this long for a shutdown is annoying, and waiting this long for a reboot is frustrating. It's also a laptop, so waiting this amount of time before putting it away in my bag is a problem. I am guessing that this is supposed to happen, I wouldn't think people with LUKS and BTRFS are trulying waiting this long for reboot/shutdown??

  1. In my particular disk setup, is there any risk in these devices not being umounted properly?
  2. Is there any way to remove the huge delay in shutdown? I attempted to change systemd's watchdog timer to 3 seconds, but it did not affect the shutdown time.
  3. Why doesn't systemd handle this already? On a normal system, "/" would be on an EXT4 filesystem that would also need to be umounted at shutdown?

lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS nvme0n1 259:0 0 931.5G 0 disk ├─nvme0n1p1 259:2 0 949M 0 part /boot/efi └─nvme0n1p2 259:3 0 930.6G 0 part └─crypt_nvme0 254:0 0 930.6G 0 crypt / nvme1n1 259:1 0 931.5G 0 disk ├─nvme1n1p1 259:4 0 949M 0 part └─nvme1n1p2 259:5 0 930.6G 0 part └─crypt_nvme1 254:1 0 930.6G 0 crypt 

cat /etc/fstab

# MAIN # Primary efi partition - secondary below UUID=A490-28B5 /boot/efi vfat umask=0077,noexec,nodev,nosuid 0 1 # BTRFS RAID 1 (UUID applies to both disks) UUID=15767954-1ec3-44aa-b1e3-b890ca937277 / btrfs defaults,subvol=@,ssd,noatime,space_cache=v2,commit=120,compress=zstd 0 0 

cat /etc/crypttab

crypt_nvme0 UUID=63780057-f91e-426d-9be3-84383fd9b534 none luks crypt_nvme1 UUID=c434a425-6552-4036-ae34-4f8c1c728d9a none luks 

journald logs before next boot:

Nov 17 15:35:36 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:36 debian systemd-cryptsetup[5094]: Device crypt_nvme0 is still in use. Nov 17 15:35:36 debian systemd-cryptsetup[5094]: Failed to deactivate: Device or resource busy Nov 17 15:35:36 debian systemd[1]: systemd-cryptsetup@crypt_nvme0.service: Failed with result 'exit-code'. Nov 17 15:35:36 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:37 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:37 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:37 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:37 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:37 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:38 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:38 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:38 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:38 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:38 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:39 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:39 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:39 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:39 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:39 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:40 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:40 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:40 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:40 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:40 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:41 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:41 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:41 debian systemd-cryptsetup[5080]: device-mapper: remove ioctl on crypt_nvme1 failed: Device or resource busy Nov 17 15:35:41 debian systemd-cryptsetup[5080]: Device crypt_nvme1 is still in use. Nov 17 15:35:41 debian systemd-cryptsetup[5080]: Failed to deactivate: Device or resource busy Nov 17 15:35:41 debian systemd[1]: systemd-cryptsetup@crypt_nvme1.service: Failed with result 'exit-code'. Nov 17 15:35:41 debian kernel: watchdog: watchdog0: watchdog did not stop! 

Last messages before power off:

systemd-shutdown[1]: Could not detach DM /dev/dm-1: Device or resource busy systemd-shutdown[1]: Could not detach DM /dev/dm-0: Device or resource busy watchdog: watchdog0: watchdog did not stop! sstemd-shutdown[1]: Failed to finalize DM devices, ignoring. 

ls -l /dev/mapper/

total 0 crw------- 1 root root 10, 236 Nov 17 15:36 control lrwxrwxrwx 1 root root 7 Nov 17 15:36 crypt_nvme0 -> ../dm-0 lrwxrwxrwx 1 root root 7 Nov 17 15:36 crypt_nvme1 -> ../dm-1 

After reboot systemd crypt services:

● blockdev@dev-mapper-crypt_nvme0.target - Block Device Preparation for /dev/mapper/crypt_nvme0 Loaded: loaded (/lib/systemd/system/[email protected]; static) Active: active since Sun 2024-11-17 15:36:35 PST; 5min ago Docs: man:systemd.special(7) ● systemd-cryptsetup@crypt_nvme1.service - Cryptography Setup for crypt_nvme1 Loaded: loaded (/etc/crypttab; generated) Active: active (exited) since Sun 2024-11-17 15:36:35 PST; 5min ago Docs: man:crypttab(5) man:systemd-cryptsetup-generator(8) man:[email protected](8) Process: 896 ExecStart=/lib/systemd/systemd-cryptsetup attach crypt_nvme1 /dev/disk/by-uuid/c434a425-6552-4036-ae34-4f8c1c728d9a none luks (code=exited, status=0/SUCCESS) Main PID: 896 (code=exited, status=0/SUCCESS) CPU: 5ms Nov 17 15:36:35 debian systemd-cryptsetup[896]: Volume crypt_nvme1 already active. ● system-systemd\x2dcryptsetup.slice - Cryptsetup Units Slice Loaded: loaded (/lib/systemd/system/system-systemd\x2dcryptsetup.slice; static) Active: active since Sun 2024-11-17 15:36:34 PST; 5min ago Docs: man:[email protected](8) Tasks: 0 Memory: 828.0K CPU: 10ms CGroup: /system.slice/system-systemd\x2dcryptsetup.slice Nov 17 15:36:35 debian systemd-cryptsetup[896]: Volume crypt_nvme1 already active. Nov 17 15:36:35 debian systemd-cryptsetup[895]: Volume crypt_nvme0 already active. Notice: journal has been rotated since unit was started, output may be incomplete. ● systemd-cryptsetup@crypt_nvme0.service - Cryptography Setup for crypt_nvme0 Loaded: loaded (/etc/crypttab; generated) Active: active (exited) since Sun 2024-11-17 15:36:35 PST; 5min ago Docs: man:crypttab(5) man:systemd-cryptsetup-generator(8) man:[email protected](8) Process: 895 ExecStart=/lib/systemd/systemd-cryptsetup attach crypt_nvme0 /dev/disk/by-uuid/63780057-f91e-426d-9be3-84383fd9b534 none luks (code=exited, status=0/SUCCESS) Main PID: 895 (code=exited, status=0/SUCCESS) CPU: 5ms Nov 17 15:36:35 debian systemd-cryptsetup[895]: Volume crypt_nvme0 already active. ● cryptsetup.target - Local Encrypted Volumes Loaded: loaded (/lib/systemd/system/cryptsetup.target; static) Active: active since Sun 2024-11-17 15:36:35 PST; 5min ago Docs: man:systemd.special(7) ● blockdev@dev-mapper-crypt_nvme1.target - Block Device Preparation for /dev/mapper/crypt_nvme1 Loaded: loaded (/lib/systemd/system/[email protected]; static) Active: active since Sun 2024-11-17 15:36:35 PST; 5min ago Docs: man:systemd.special(7) 

ls -l /dev/disk/by-uuid/

total 0 lrwxrwxrwx 1 root root 10 Nov 17 15:36 15767954-1ec3-44aa-b1e3-b890ca937277 -> ../../dm-0 lrwxrwxrwx 1 root root 15 Nov 17 15:36 63780057-f91e-426d-9be3-84383fd9b534 -> ../../nvme0n1p2 lrwxrwxrwx 1 root root 15 Nov 17 15:36 A490-28B5 -> ../../nvme0n1p1 lrwxrwxrwx 1 root root 15 Nov 17 15:36 c434a425-6552-4036-ae34-4f8c1c728d9a -> ../../nvme1n1p2 lrwxrwxrwx 1 root root 15 Nov 17 15:36 D2D5-D83C -> ../../nvme1n1p1 

mount | grep nvme

/dev/mapper/crypt_nvme0 on / type btrfs (rw,noatime,compress=zstd:3,ssd,space_cache=v2,commit=120,subvolid=256,subvol=/@) /dev/nvme0n1p1 on /boot/efi type vfat (rw,nosuid,nodev,noexec,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro) 
2
  • You have your filesystem root (/) on your RAIDed drives. Shutdown needs /, but also needs to unmount your RAIDed drives. Thus the timeout. Check the documentation, it may be that "/ on RAID" is a disallowed configuration. Commented Nov 18, 2024 at 13:58
  • On Debian's own wiki https://wiki.debian.org/SoftwareRAID has a section on root filesystem on RAID (with mdraid). Unfortunately, does not mention setting it up to properly umount on shutdown. Commented Nov 18, 2024 at 17:37

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.