#StackBounty: #18.04 #shutdown #raid #systemd #lvm Timed out Availability of block devices

Bounty: 50

On a fresh Ubuntu 18.04 (64 bit) Server install, the blk-availability.service always killed by timeout at shutdown.

I think the dependency of this service is bad, but I don’t know what would be the good shutdown order for this.

An almost same config has been worked on Xenial

The disk sub-system is

  • NVMe SSD
    • EFI partition
    • boot partition
    • LVM phisical volume
      • root logical volume
      • swap logical volume
      • data logical volume
  • 2 pcs. HDDs in RAID1 (but the md0 is not used yet)


systemd[1]: Stopped Load/Save Random Seed.
systemd[1]: Stopped Update UTMP about System Boot/Shutdown.
systemd[1]: Stopped Network Time Synchronization.
kernel: usb 1-13: USB disconnect, device number 2
systemd[1]: blk-availability.service: Stopping timed out. Terminating.
systemd[1]: blk-availability.service: Control process exited, code=killed status=15
blkdeactivate[2447]:   [MD]: deactivating raid1 device md0... resync action in progress...
systemd[1]: blk-availability.service: Failed with result 'timeout'.
systemd[1]: Stopped Availability of block devices.
systemd[1]: Stopping iSCSI initiator daemon (iscsid)...
iscsid[951]: iscsid shutting down.
systemd[1]: Stopped iSCSI initiator daemon (iscsid).
systemd[1]: Stopped target Network is Online.
systemd[1]: Stopped Wait for Network to be Configured.
systemd[1]: Stopped target Network.
systemd[1]: Stopping Network Name Resolution...
systemd[1]: Stopped Network Name Resolution.
systemd[1]: Stopping Network Service...
systemd[1]: Stopped Create Volatile Files and Directories.
systemd[1]: Stopped target Local File Systems.
systemd[1]: Unmounting /boot/efi...
systemd[1]: Unmounting /run/user/1000...
systemd[1]: Unmounted /run/user/1000.
systemd[1]: Stopped target Swap.
systemd[1]: Deactivating swap /dev/disk/by-uuid/8a3d99d0-683e-xxxx-xxxx-9765162cc070...
systemd[1]: Unmounted /boot/efi.
systemd[1]: Unmounting /boot...
systemd[1]: Stopped File System Check on /dev/disk/by-uuid/AB9E-5A2C.
systemd[1]: Deactivated swap /dev/xxx_server_ssd/swap.
systemd[1]: Deactivated swap /dev/disk/by-uuid/8a3d99d0-683e-xxxx-xxxx-9765162cc070.
systemd[1]: Deactivated swap /dev/disk/by-id/dm-uuid-LVM-eatHKVdbDuw5L5RXXXXXXX2yJn7QosUWvV2IIApCOG73Bc2CbrUabBC6L3dh0N2D.
systemd[1]: Deactivated swap /dev/disk/by-id/dm-name-xxx_server_ssd-swap.
systemd[1]: Deactivated swap /dev/dm-1.
systemd[1]: Stopped Network Service.
systemd[1]: Deactivated swap /dev/mapper/xxx_server_ssd-swap.
systemd[1]: Unmounted /boot.
systemd[1]: Stopped File System Check on /dev/disk/by-uuid/d7cc70cc-0f33-xxxx-xxxx-cc21d3ed1232.
systemd[1]: Removed slice system-systemdx2dfsck.slice.
systemd[1]: Stopped target Local File Systems (Pre).
systemd[1]: Stopped Remount Root and Kernel File Systems.
systemd[1]: Stopped Create Static Device Nodes in /dev.
systemd[1]: Stopping Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling...
systemd[1]: Stopped target Network (Pre).
systemd[1]: Stopped Apply Kernel Variables.
systemd[1]: Stopped Load Kernel Modules.
systemd[1]: Reached target Shutdown.
systemd[1]: Reached target Unmount All Filesystems.
systemd[1]: Reached target Final Step.
systemd[1]: Starting Power-Off...

systemctl cat blk-availability.service

# /lib/systemd/system/blk-availability.service
Description=Availability of block devices
After=lvm2-activation.service lvm2-lvmetad.service iscsi-shutdown.service iscsi.service iscsid.service fcoe.service

ExecStop=/sbin/blkdeactivate -u -l wholevg -m disablequeueing -r wait



Is this an Ubuntu bug? How can I solve it?

Update: I created a bug report https://bugs.launchpad.net/ubuntu/+source/lvm2/+bug/1780196

Update 2: I found the commit where introduced this blkdeactivate: lvm2 upstream: c698ee14bbb1310cf2383c8977d14a8e29139f8c

Traverses the tree of block devices and tries to deactivate them.
Currently, it supports device-mapper-based devices together with LVM.
See man/blkdeactivate.8 for more info.

It is targeted for use during shutdown to properly deactivate the
whole block device stack – systemd and init scripts are provided as
well. However, it might be used directly on command line too.

In this case, this stuff runs too early, as I think.

Update 3: I think it can be fixed in 2 ways:

  • blkdeactivate handles properly the syncing software-raid arrays
  • re-order this service, to be after the “standard” software-raid deinit

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.