unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: 30760@debbugs.gnu.org
Subject: bug#30760: guix system init broken on non GuixSD
Date: Fri, 09 Mar 2018 23:42:37 +0100	[thread overview]
Message-ID: <87efksyioy.fsf@gnu.org> (raw)
In-Reply-To: <20180309231543.2ede5fa1@scratchpost.org> (Danny Milosavljevic's message of "Fri, 9 Mar 2018 23:15:43 +0100")

[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]

Hello,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> there's a problem with check-device-initrd-modules: on "guix system init"
> it doesn't get linux-module-directory and doesn't pass it on to matching-modules.
> matching-modules then eventually defaults to (current-alias-file) - which is not
> found on a non-GuixSD system.

Yeah.

> Would it be possible to get rid of the defaults in gnu/build/linux-modules.scm ?
> I don't think those are safe or useful for our requirements.  I've had to work
> around those before.
>
> check-initrd-modules could use the initrd's new kernel modules to find
> out which modules to include (after all).
>
> Then we could also check the dependencies directly in the new Linux kernel
> modules and all in all it would be safer.

It would be safer indeed, but we’d have to build the kernel and
everything before we can make a diagnostic.  That would lead to a weird
user experience, similar to what we currently see with grafts (things
are built/downloader, and later on you get a message about what’s going
to be built.)

The current tradeoff is to make that diagnostic based on the running
kernel, even if it’s an approximation.

If that’s fine with you I’d like to fix this bug with the conservative
patch below.

Thoughts?

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2743 bytes --]

diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 4fe673cca..8cae4fb63 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -40,6 +40,7 @@
             current-module-debugging-port
 
             device-module-aliases
+            current-alias-file
             known-module-aliases
             matching-modules))
 
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 1eb5f5130..16a8c4375 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -353,17 +353,27 @@ loaded at boot time in the order in which they appear."
 (define (check-device-initrd-modules device linux-modules location)
   "Raise an error if DEVICE needs modules beyond LINUX-MODULES to operate.
 DEVICE must be a \"/dev\" file name."
-  (let ((modules (delete-duplicates
-                  (append-map matching-modules
-                              (device-module-aliases device)))))
-    (unless (every (cute member <> linux-modules) modules)
-      (raise (condition
-              (&message
-               (message (format #f (G_ "you may need these modules \
+  (define aliases
+    ;; Attempt to load 'modules.alias' from the current kernel, assuming we're
+    ;; on GuixSD, and assuming that corresponds to the kernel we'll be
+    ;; installing.  Skip the whole thing if that file cannot be read.
+    (catch 'system-error
+      (lambda ()
+        (known-module-aliases))
+      (const #f)))
+
+  (when aliases
+    (let ((modules (delete-duplicates
+                    (append-map (cut matching-modules <> aliases)
+                                (device-module-aliases device)))))
+      (unless (every (cute member <> linux-modules) modules)
+        (raise (condition
+                (&message
+                 (message (format #f (G_ "you may need these modules \
 in the initrd for ~a:~{ ~a~}")
-                                device modules)))
-              (&fix-hint
-               (hint (format #f (G_ "Try adding them to the
+                                  device modules)))
+                (&fix-hint
+                 (hint (format #f (G_ "Try adding them to the
 @code{initrd-modules} field of your @code{operating-system} declaration, along
 these lines:
 
@@ -373,8 +383,8 @@ these lines:
    (initrd-modules (append (list~{ ~s~})
                            %base-initrd-modules)))
 @end example\n")
-                             modules)))
-              (&error-location
-               (location (source-properties->location location))))))))
+                               modules)))
+                (&error-location
+                 (location (source-properties->location location)))))))))
 
 ;;; linux-initrd.scm ends here

  reply	other threads:[~2018-03-09 22:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 17:35 bug#30760: guix system init broken on non GuixSD Tomáš Čech
2018-03-09 22:15 ` Danny Milosavljevic
2018-03-09 22:42   ` Ludovic Courtès [this message]
2018-03-09 22:52     ` Danny Milosavljevic
2018-03-09 23:19       ` Ludovic Courtès
2018-03-10 21:42         ` Tomáš Čech
2018-03-11 16:31         ` Danny Milosavljevic
     [not found]         ` <20180310063219.bxgl7bgspxu2o5ez@doom>
     [not found]           ` <874llmuwc5.fsf@gnu.org>
2018-03-12  9:19             ` Tomáš Čech
2018-03-12 12:24               ` Danny Milosavljevic
2018-03-12 12:38                 ` Danny Milosavljevic
2018-03-12 12:57                 ` Ludovic Courtès
2018-03-15 10:43                   ` Ludovic Courtès
2018-03-12 15:27                 ` Tomáš Čech

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efksyioy.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=30760@debbugs.gnu.org \
    --cc=dannym@scratchpost.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).