From 081c5b2d66b6f9bdd1b966a96640b7ec4df8d5a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Sun, 29 Jun 2014 22:06:29 +0200
Subject: [PATCH] services: udev: Make sure modules are found, and use "udevadm
 settle".

* gnu/services/base.scm (udev-service): Set $LINUX_MODULE_DIRECTORY.  In
  the parent, invoke "udevadm settle" before "udevadm trigger".
---
 gnu/services/base.scm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 0df4f652dae..bab07aa4b73 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -409,6 +409,10 @@ (define* (udev-service #:key (udev udev))
              (requirement '(root-file-system))
              (documentation "Populate the /dev directory.")
              (start #~(lambda ()
+                        ;; Allow udev to find the modules.
+                        (setenv "LINUX_MODULE_DIRECTORY"
+                                "/run/booted-system/kernel/lib/modules")
+
                         (let ((pid (primitive-fork)))
                           (case pid
                             ((0)
@@ -421,6 +425,9 @@ (define* (udev-service #:key (udev udev))
                              (execl (string-append #$udev "/libexec/udev/udevd")
                                     "udevd"))
                             (else
+                             ;; Wait for things to settle down.
+                             (system* (string-append #$udev "/bin/udevadm")
+                                      "settle")
                              ;; Create a bunch of devices.
                              (system* (string-append #$udev "/bin/udevadm")
                                       "trigger")
-- 
GitLab