From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#30760: guix system init broken on non GuixSD Date: Fri, 09 Mar 2018 23:42:37 +0100 Message-ID: <87efksyioy.fsf@gnu.org> References: <20180309173530.wfdw356rf53tesck@doom> <20180309231543.2ede5fa1@scratchpost.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1euQjC-0001IY-OM for bug-guix@gnu.org; Fri, 09 Mar 2018 17:43:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1euQj7-0002lA-Sm for bug-guix@gnu.org; Fri, 09 Mar 2018 17:43:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:45017) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1euQj7-0002l4-P9 for bug-guix@gnu.org; Fri, 09 Mar 2018 17:43:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1euQj7-0005oE-Hz for bug-guix@gnu.org; Fri, 09 Mar 2018 17:43:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20180309231543.2ede5fa1@scratchpost.org> (Danny Milosavljevic's message of "Fri, 9 Mar 2018 23:15:43 +0100") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Danny Milosavljevic Cc: 30760@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, Danny Milosavljevic 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-module= s.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=E2=80=99d 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=E2=80=99s g= oing to be built.) The current tradeoff is to make that diagnostic based on the running kernel, even if it=E2=80=99s an approximation. If that=E2=80=99s fine with you I=E2=80=99d like to fix this bug with the c= onservative patch below. Thoughts? Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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 --=-=-=--