From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqmbW-00046F-HX for guix-patches@gnu.org; Tue, 27 Feb 2018 16:16:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqmbS-0003fh-Gs for guix-patches@gnu.org; Tue, 27 Feb 2018 16:16:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:56338) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqmbS-0003fa-Cw for guix-patches@gnu.org; Tue, 27 Feb 2018 16:16:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqmbS-0000ge-5C for guix-patches@gnu.org; Tue, 27 Feb 2018 16:16:02 -0500 Subject: [bug#30629] [PATCH 0/5] Detect missing modules in the initrd Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180227141720.12513-1-ludo@gnu.org> <20180227222632.42bcf52c@scratchpost.org> Date: Tue, 27 Feb 2018 22:15:31 +0100 In-Reply-To: <20180227222632.42bcf52c@scratchpost.org> (Danny Milosavljevic's message of "Tue, 27 Feb 2018 22:29:51 +0100") Message-ID: <87tvu2w2vg.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Danny Milosavljevic Cc: 30629@debbugs.gnu.org Hi Danny! Danny Milosavljevic skribis: >> 1. =E2=80=98device-module-aliases=E2=80=99 returns the empty list for = /dev/dm-0, which >> is a LUKS device on my laptop. I=E2=80=99m not sure what it would = take to >> have it return =E2=80=9Cdm-crypt=E2=80=9D, etc. Same for RAID devi= ces. > > Hmm... I don't know either. I browsed kmod in search of code that does that but couldn=E2=80=99t find i= t. Do you know of another source for such things? >> 2. Let=E2=80=99s assume you have: (initrd-modules '("a")). =E2=80=98g= uix system=E2=80=99 >> could report that module =E2=80=9Cb=E2=80=9D is missing, even if = =E2=80=9Cb=E2=80=9D is actually a >> dependency of =E2=80=9Ca=E2=80=9D and will therefore be automatical= ly included in >> the initrd. I think that=E2=80=99s an acceptable limitation (fixin= g it is >> non-trivial since we=E2=80=99d ideally need to build the target ker= nel so >> we can inspect its modules and determine their closure.) > > I think that's okay. OK. >> You=E2=80=99re welcome to give it a try. In particular it=E2=80=99d be = great if you >> could check that =E2=80=98device-module-aliases=E2=80=99 returns the rig= ht thing on your >> machine, as I shown in the example above. > > scheme@(guile-user)> (device-module-aliases "/dev/sda5") > $1 =3D ("scsi:t-0x00" "pci:v00008086d00009C03sv000017AAsd00002214bc01sc06= i01") > scheme@(guile-user)> (device-module-aliases "/dev/sda1") > $2 =3D ("scsi:t-0x00" "pci:v00008086d00009C03sv000017AAsd00002214bc01sc06= i01") Looks good. > P.S. I just integrated my patchset (v5) and your patchset and have a work= ing system > with pure guile initrd (modprobe is in guile, too). I ran basic system t= ests and > also rebooted my machine with it :) Damn it you=E2=80=99re too fast. :-) That=E2=80=99s good news though! > Attached is the integration patch, so let's just review the patchsets > as normal and then push both and then push the integration patch. Do you think we could squash things to avoid the kmod-static intermediate step when we push? > I'm not sure about the module resolution order, first use the aliases or = first > use the real module files? In what part? > The Linux modules should be much more under control then... Yes! > From ffd464d540943e221636f7c63bcd22f4370803ae Mon Sep 17 00:00:00 2001 > From: Danny Milosavljevic > Date: Tue, 27 Feb 2018 21:25:27 +0100 > Subject: [FIXME 13/13] linux-initrd: Make modprobe pure-Guile. > Tags: patch > > * gnu/build/linux-initrd.scm (build-initrd): Replace kmod by modprobe. > * gnu/system/linux-initrd.scm (%modprobe-exp): New variable. > (expression->initrd): Delete parameter "kmod". Use the above. > (raw-initrd): Replace kmod's default by "kmod". > (base-initrd): Replace kmod's default by "kmod". > Add LINUX-MODULES parameter again because it fell out before (?). Awesome. :-) > +(define* (%modprobe-exp linux-module-directory) > + (with-imported-modules (source-module-closure > + '((gnu build linux-modules))) > + #~(begin I=E2=80=99d rather change that to =E2=80=98modprobe-program=E2=80=99 and ha= ve it return: (program-file "modprobe" (with-import-modules =E2=80=A6 #~(begin =E2=80= =A6))) mostly because =E2=80=9Cfile-like objects=E2=80=9D compose better than arbi= trary pieces of code. > + (use-modules (gnu build linux-modules) (ice-9 getopt-long) > + (ice-9 match) (srfi srfi-1)) > + (define (lookup module) > + (let* ((name (ensure-dot-ko module)) > + (linux-release-module-directory > + (string-append "/lib/modules/" (utsname:release (uname= )) > + "/")) I think we can=E2=80=99t use =E2=80=98uname=E2=80=99 here because that retu= rns info about the build host, not about the machine and kernel we=E2=80=99re deploying. > + (path (string-append linux-release-module-directory nam= e))) s/path/directory/ :-) > + (if (file-exists? path) > + path > + ;; FIXME: Make safe. > + (match (delete-duplicates (matching-modules module > + (known-module-aliases > + (string-append linux-release-module-directory > + "modules.alias")))) > + (() #f) > + ((x-name) (lookup x-name)) > + ((_ ...) > + (error "several modules by that name" > + name)))))) > + (define option-spec > + '((quiet (single-char #\q) (value #f)))) > + (define options (getopt-long (command-line) option-spec)) > + (for-each > + (lambda (option) > + (match option > + ((() modules ...) > + (for-each > + (lambda (module) > + (let ((file-name (lookup module))) > + (when file-name > + (load-linux-module* file-name > + #:lookup-module lookup)))) Should it be an error when MODULE could not be found? Also, indentation should be like: (for-each (lambda (option) =E2=80=A6 (for-each (lambda (module) =E2=80=A6))) =E2=80=A6) > (define* (base-initrd file-systems > #:key > (linux linux-libre) > + (linux-modules '()) > (kmod kmod-minimal/static) > (mapped-devices '()) > qemu-networking? We no longer need #:kmod here. Thank you! Ludo=E2=80=99.