diff --git a/debian/init-functions.d/40-systemd b/debian/init-functions.d/40-systemd index 3260d84..1e6ca11 100644 --- a/debian/init-functions.d/40-systemd +++ b/debian/init-functions.d/40-systemd @@ -33,6 +33,7 @@ fi systemctl_redirect () { local s local rc + local args local prog=${1##*/} local command=$2 @@ -53,6 +54,11 @@ systemctl_redirect () { service="${prog%.sh}.service" + # This is a workaround for users which start services via hook scripts + # during early boot which can lead to deadlocks. + if systemctl list-jobs | grep -q -E "(network|sysinit)\.target" ; then + args="--no-block" + fi # Don't try to run masked services. Don't check for errors, if # this errors, we'll just call systemctl and possibly explode # there. @@ -60,7 +66,7 @@ systemctl_redirect () { [ "$state" = "LoadState=masked" ] && return 0 [ "$command" = status ] || log_daemon_msg "$s" "$service" - /bin/systemctl $command "$service" + /bin/systemctl $args $command "$service" rc=$? [ "$command" = status ] || log_end_msg $rc