guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#38871] Add a check before activating modprobe


From: kanichos
Subject: [bug#38871] Add a check before activating modprobe
Date: Thu, 02 Jan 2020 15:13:45 +0300

Currently an activation service unconditionally tries to set up a modprobe 
wrapper by writing to /proc/sys/kernel/modprobe. This breaks if the kernel is 
built without loadable module support, Shepherd completely aborts. I believe 
there is no reason for it to be so. Just add a simple check for the existence 
of this /proc node.

---
 gnu/build/activation.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index c6c7e7fd3b..f7a5e53e79 100644
--- a/gnu/build/activation.scm
+++ b/gnu/build/activation.scm
@@ -269,9 +269,10 @@ second element is the name it should appear at, such as:
 
 (define (activate-modprobe modprobe)
   "Tell the kernel to use MODPROBE to load modules."
-  (call-with-output-file "/proc/sys/kernel/modprobe"
-    (lambda (port)
-      (display modprobe port))))
+  (if (file-exists? "/proc/sys/kernel/modprobe")
+    (call-with-output-file "/proc/sys/kernel/modprobe"
+      (lambda (port)
+        (display modprobe port)))))
 
 (define (activate-firmware directory)
   "Tell the kernel to look for device firmware under DIRECTORY.  This
-- 
2.23.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]