:: [devuan-dev] bug#483: bug#483: eude…
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Trek
Datum:  
To: 483
Betreff: [devuan-dev] bug#483: bug#483: eudev: eudev sometimes fails to generate initial hotplug events
I had some time to check the sources of eudev and it does not contains
the f59118e commit, that prevented the removal of the control socket on
exit[1], so I send this patch to restore the old rock solid start-up
behavior of udev

the patch is based on the Devuan unstable ed8c5770e0 commit, but please
note that it is untested, as i don't have a Devuan system, nor eudev,
but at least it shows how to do it

basically eudev is launched with --daemon argument and all the pidfile
tracking stuff is removed, because when eudev is killed by sendsigs, it
removes the control socket and dmsetup/cryptsetup will not hang trying
to connect to eudev on shutdown

ciao!

1. https://github.com/systemd/systemd/issues/2477#issuecomment-239077407
diff -urN a/eudev.init b/eudev.init
--- a/eudev.init    2020-08-11 16:55:13.809023204 +0200
+++ b/eudev.init    2020-08-11 17:06:49.737018235 +0200
@@ -11,10 +11,8 @@
 PATH="/lib/udev:/sbin:/bin"
 NAME="udevd"
 DAEMON="/sbin/udevd"
+DAEMON_ARGS="--daemon"
 DESC="hot-plug events dispatcher"
-PIDFILE="/run/udevd.pid"
-CTRLFILE="/run/udev/control"
-OMITDIR="/run/sendsigs.omit.d"


 # we need to unmount /dev/pts/ and remount it later over the devtmpfs
 unmount_devpts() {
@@ -166,12 +164,9 @@
     [ -x /sbin/restorecon ] && /sbin/restorecon -R /dev


     log_daemon_msg "Starting $DESC" "$NAME"
-    if start-stop-daemon --start --name $NAME --user root --quiet \
-    --pidfile $PIDFILE --exec $DAEMON --background --make-pidfile; then
-    # prevents udevd to be killed by sendsigs (see #261 & DEBIAN #791944)
-      mkdir -p $OMITDIR
-      ln -sf $PIDFILE $OMITDIR/$NAME
-      log_end_msg $?
+    if start-stop-daemon --start --name $NAME --exec $DAEMON --quiet \
+    -- $DAEMON_ARGS; then
+    log_end_msg $?
     else
     log_warning_msg $?
     log_warning_msg "Waiting 15 seconds and trying to continue anyway"
@@ -205,37 +200,19 @@


     stop)
     log_daemon_msg "Stopping $DESC" "$NAME"
-    if start-stop-daemon --stop --name $NAME --user root --quiet \
-             --pidfile $PIDFILE --remove-pidfile --oknodo --retry 5; then
-    # prevents cryptsetup/dmsetup hangs ( see #261 & Debian bug #791944 )
-      rm -f $CTRLFILE
-      log_end_msg $?
-    else
-      log_end_msg $?
-    fi
+    start-stop-daemon --stop --name $NAME --quiet --oknodo --retry 5
+    log_end_msg $?
     ;;


     restart)
     log_daemon_msg "Stopping $DESC" "$NAME"
-    if start-stop-daemon --stop --name $NAME --user root --quiet \
-      --pidfile $PIDFILE --remove-pidfile --oknodo --retry 5; then
-      # prevents cryptsetup/dmsetup hangs ( see #261 & Debian bug #791944 )
-      rm -f $CTRLFILE
-      log_end_msg $?
-    else
-      log_end_msg $? || true
-    fi
+    start-stop-daemon --stop --name $NAME --quiet --oknodo --retry 5
+    log_end_msg $? || true


     log_daemon_msg "Starting $DESC" "$NAME"
-    if start-stop-daemon --start --name $NAME --user root --quiet \
-    --pidfile $PIDFILE --exec $DAEMON --background --make-pidfile; then
-      # prevents udevd to be killed by sendsigs (see #261 & DEBIAN #791944)
-      mkdir -p $OMITDIR
-      ln -sf $PIDFILE $OMITDIR/$NAME
-      log_end_msg $?
-    else
-      log_end_msg $?
-    fi
+    start-stop-daemon --start --name $NAME --exec $DAEMON --quiet \
+      -- $DAEMON_ARGS
+    log_end_msg $?
     ;;


     reload|force-reload)