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".
This commit is contained in:
Ludovic Courtès 2014-06-29 22:06:29 +02:00
parent 62f0a4792b
commit 081c5b2d66

View file

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