Subject: bug#483: [devuan-dev] bug#483: eudev: eudev sometimes fails to generate initial hotplug events

From: Trek <[email-masked]>
Date: Wed, 12 Aug 2020 21:01:58 +0200

sorry to write again, but my previous patch could work only if the
interpreter is set to /bin/sh without the -e option

if you don't want to remove the -e option, then this patch should
applied instead

ciao!
diff -urN a/eudev.init b/eudev.init
--- a/eudev.init	2020-08-11 16:55:13.809023204 +0200
+++ b/eudev.init	2020-08-12 20:59:47.963533922 +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,11 +164,8 @@
     [ -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
+    if start-stop-daemon --start --name $NAME --exec $DAEMON --quiet \
+	-- $DAEMON_ARGS; then
       log_end_msg $?
     else
 	log_warning_msg $?
@@ -205,10 +200,7 @@
 
     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
+    if start-stop-daemon --stop --name $NAME --quiet --oknodo --retry 5; then
       log_end_msg $?
     else
       log_end_msg $?
@@ -217,21 +209,15 @@
 
     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
+    if start-stop-daemon --stop --name $NAME --quiet --oknodo --retry 5; then
       log_end_msg $?
     else
       log_end_msg $? || true
     fi
 
     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
+    if start-stop-daemon --start --name $NAME --exec $DAEMON --quiet \
+      -- $DAEMON_ARGS; then
       log_end_msg $?
     else
       log_end_msg $?