fixing cryptdisks stall on shutdown / rebooot in debian Stretch
date: 2020-03-13
symptom
Debian’s hangs on shutdown, stalling forever so the system can’t power down.
From bug reports, this only affects system with SysVInit, but not systems with systemd.
cause
Investigation of the problem revealed the following situation:
is not stopped in runlevel 0 and 6 by its own script but killed by the
, which runs before .
depends on to remove the mapper link
for the encrpyted devices i.e.
is not able to handle its own pid file and it is not started started with the
but just executed and sent to background.
should should be stopped after
and
in runlevel 0 and 6 to ensure that the mappings are cleaned up after the encrypted disks have
been unmounted in runlevel 0 and 6.
fix
The fix involves:
start and stop by
creates a pid-file upon start of udev
uses that pid-file to kill udev in runlevel 0 and 6
add to to prevent
being killed by
provide a link in runlevel 0 and 6 to stop udev on shutdown / reboot
after (link ) and
(link ).
The relevant parts in the udev script are in the start and stop function, only the fixed version is provided here:
start
log_daemon_msg "Starting $DESC" "$NAME"
if start-stop-daemon --start --name $NAME --user root --quiet --pidfile $PIDFILE --exec $DAEMON --background --make-pidfile; then
mkdir -p /run/sendsigs.omit.d
ln -s $PIDFILE /run/sendsigs.omit.d/udev
log_end_msg $?
else
log_warning_msg $?
log_warning_msg "Waiting 15 seconds and trying to continue anyway"
sleep 15
fi