Bug#791944: /etc/init.d/sendsigs kills systemd-udevd upon shutdown, causing dmsetup to hang

Marc Andre Selig sea at sedacon.com
Mon Jul 24 13:10:14 BST 2017


This bug has affected one of my remote servers after upgrading to Stretch.
I would have appreciated a hint in Release Notes not (yet) to install
Debian 9 on servers with sysvinit and encrypted partitions.

Anyway, while the fix to this bug is not present in Stretch, I have
created two simplistic init scripts that keep udev running until
cryptdisks have finished, effectively implementing Pali's suggestion in
#238 but without having to modify /etc/init.d/udev itself.
-------------- next part --------------
#!/bin/sh
### BEGIN INIT INFO
# Provides:          fix-udev-cryptsetup
# Required-Start:
# Required-Stop:     sendsigs
# Default-Start:
# Default-Stop:      0 6
# Short-Description: Fix cryptsetup hang on shutdown
# Description:       If sysvinit is used on a system with at least
#                    one encrypted partition and systemd-udev
#                    installed, cryptsetup (/etc/init.d/cryptdisks)
#                    will hang on shutdown (see
#                    <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=791944>).
#                    This script keeps udev running until after
#                    cryptdisks have shut down.
### END INIT INFO

# Author: Marc Andre Selig <sea at sedacon.com>

DESC="Fix cryptsetup hang on shutdown"

case "$1" in
start)
	;;
stop)
	mkdir -p /run/sendsigs.omit.d
	pgrep systemd-udevd > /run/sendsigs.omit.d/udev
	;;
*)
	echo "Usage: fix-udev-cryptsetup {start|stop}"
	exit 1
	;;
esac
-------------- next part --------------
#!/bin/sh
### BEGIN INIT INFO
# Provides:          fix-udev-stop
# Required-Start:
# Required-Stop:     umountroot
# X-Stop-After:      cryptdisks-early
# Default-Start:
# Default-Stop:      0 6
# Short-Description: Stop udev if not done before
# Description:       If sysvinit is used on a system with at least
#                    one encrypted partition and systemd-udev
#                    installed, cryptsetup (/etc/init.d/cryptdisks)
#                    will hang on shutdown (see
#                    <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=791944>).
#                    This script kills systemd-udevd if it has been
#                    kept running by fix-udev-cryptsetup.
### END INIT INFO

# Author: Marc Andre Selig <sea at sedacon.com>

DESC="Stop udev if not done before"

case "$1" in
start)
	;;
stop)
	if [ -f /run/sendsigs.omit.d/udev ]; then
		kill $(cat /run/sendsigs.omit.d/udev)
		rm -f /run/sendsigs.omit.d/udev
	fi
	;;
*)
	echo "Usage: fix-udev-stop {start|stop}"
	exit 1
	;;
esac


More information about the Pkg-systemd-maintainers mailing list