Subject: Don’t attempt to create a module database when none are available
From: Ivan Kozlov <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Sat, 04 Apr 2020 19:16:15 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

The present code breaks with a non-modular kernel. This can be easily avoided.

--- a/gnu/system.scm
+++ #<buffer system.scm>
@@ -477,13 +477,19 @@
 value of the SYSTEM-SERVICE-TYPE service."
   (let ((locale (operating-system-locale-directory os)))
     (mlet* %store-monad ((kernel -> (operating-system-kernel os))
+                         (kernel-modules (package-file kernel "lib/modules"))
                          (modules ->
                           (operating-system-kernel-loadable-modules os))
+                         (has-modules ->
+                          (or (not (null? modules))
+                              (file-exists? kernel-modules)))
                          (kernel
                           (profile-derivation
                            (packages->manifest
                             (cons kernel modules))
-                           #:hooks (list linux-module-database)))
+                           #:hooks (if has-modules
+                                       (list linux-module-database)
+                                       '())))
                          (initrd -> (operating-system-initrd-file os))
                          (params    (operating-system-boot-parameters-file os)))
       (return `(("kernel" ,kernel)