On Mon, 1 Oct 2018 01:11:30 +0200
Michael Biebl <bi...@debian.org> wrote:

> The only supported way in udev to signal readiness is the sd-notify
> API. My gut feeling is, that having an sd-notify wrapper for
> non-systemd systems (e.g. directly built into start-stop-daemon via
> say an --wait-for-sd-notify switch) would be the cleanest and most
> robust way. This might even benefit other daemons besides udevd.

nice catch, but probably it cannot be done in time for buster freeze

after another code inspection, I wrote a simpler version of the patch,
as it only checks for the existence of the control file

it should be sufficient as udev --daemon forks and exits just after
calling listen_fds(), that creates the control file via bind()

to Bill Brelsford: please, can you try again if this new patch fixes the
problem? thank you!

ciao
>From e1322be4d6416259a0e3e1e4370e8ff722cda146 Mon Sep 17 00:00:00 2001
From: Trek <tre...@inbox.ru>
Date: Mon, 1 Oct 2018 06:38:35 +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, checking the control file.

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..374df4e 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=150
+        until [ -S $CTRLFILE -o $timeout -le 0 ]; do
+            timeout=$((timeout - 1))
+            sleep 0.1
+        done
+        [ -S $CTRLFILE ] && 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