From 33916a20971f3e3819a58f4ace3f43a2f4bb9bc9 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 18 Oct 2017 09:43:37 +0200 Subject: [PATCH] Fix #82: Revert parts of 34a1524 and add workaround from Void Linux In commit 34a1524 the start of udevd was refactored to allow it to be a properly monitored service caused systems using eudev to malfunction. This patch reverts part of that commit and adds a workaround found when trying to reproduce issue #82 on Void Linux: - Start a temporary udevd in the background - Call udevadm to trigger bringup of all subsystems and devices - Wait for everything to settle - Tell temporary udevd to exit (new) In the world of `mdev` this song and dance act is not required. Signed-off-by: Joachim Nilsson --- src/finit.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/finit.c b/src/finit.c index 77418acf..60e81e2a 100644 --- a/src/finit.c +++ b/src/finit.c @@ -350,7 +350,7 @@ int main(int argc, char* argv[]) run_interactive("mdev -s", "Populating device tree"); } else { char *cmd; - char line[80]; + char line[256]; cmd = which("udevd"); if (!cmd) @@ -364,8 +364,19 @@ int main(int argc, char* argv[]) udev = 0; } - free(cmd); } + + snprintf(line, sizeof(line), "%s --daemon", cmd); + run_interactive(line, "Populating device tree"); + + if (udev && whichp("udevadm")) { + run("udevadm trigger --action=add --type=subsystems"); + run("udevadm trigger --action=add --type=devices"); + run("udevadm settle --timeout=120"); + run("udevadm control --exit"); + } + + free(cmd); } /* @@ -419,13 +430,6 @@ int main(int argc, char* argv[]) sm_init(&sm); sm_step(&sm); - /* On udev systems we can now talk to udevd */ - if (udev && whichp("udevadm")) { - run("udevadm trigger --action=add --type=subsystems"); - run("udevadm trigger --action=add --type=devices"); - run("udevadm settle --timeout=120"); - } - /* * Network stuff */