On Thu, 13 Sep 2018 19:02:26 -0700
Bill Brelsford <w...@k2di.net> wrote:

> With the --background argument, a race condition exists and
> "udevadm trigger" starts too soon.
> A workaround is to add a short sleep:

can you try if this patch fixes the problem?
my system is not affected so I can't check

thank you!


the sleep timeout could be different depending on the hardware, so it
checks every second if udev is ready, up to 15 seconds

it seems to be there is no reliable method to know if udev is running
fine, so it calls udevadm control -S, that it's essentially a no-op
when udev is just started, but at least it checks if the control socket
is listening

ciao
>From 1c9dd060a25d904aa200c9fdc33e34dc003dd1d8 Mon Sep 17 00:00:00 2001
From: Trek <tre...@inbox.ru>
Date: Sat, 15 Sep 2018 05:50:03 +0200
Subject: [PATCH] Wait for udev to be ready before trigger under sysvinit

The start-stop-daemon command with the --background argument returns
immediately, too soon to trigger events on some systems. Update the
SysV init script to wait until udev is ready.

Closes: #908796
---
 debian/udev.init | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/debian/udev.init b/debian/udev.init
index 9c394bb..4b30297 100644
--- a/debian/udev.init
+++ b/debian/udev.init
@@ -170,11 +170,16 @@ case "$1" in
         # prevents udevd to be killed by sendsigs (see #791944)
         mkdir -p $OMITDIR
         ln -sf $PIDFILE $OMITDIR/$NAME
-        log_end_msg $?
+
+        # wait for udev to be ready (see #908796)
+        timeout=15
+        until udevadm control -S || [ $timeout -le 0 ]; do
+            timeout=$((timeout-1))
+            sleep 1
+        done
+        udevadm control -S && log_success_msg || log_failure_msg
     else
-        log_warning_msg $?
-        log_warning_msg "Waiting 15 seconds and trying to continue anyway"
-        sleep 15
+        log_failure_msg
     fi
 
     log_action_begin_msg "Synthesizing the initial hotplug events"
-- 
2.1.4

Reply via email to