unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: 30629@debbugs.gnu.org
Subject: [bug#30629] [PATCH 0/5] Detect missing modules in the initrd
Date: Tue, 27 Feb 2018 22:15:31 +0100	[thread overview]
Message-ID: <87tvu2w2vg.fsf@gnu.org> (raw)
In-Reply-To: <20180227222632.42bcf52c@scratchpost.org> (Danny Milosavljevic's message of "Tue, 27 Feb 2018 22:29:51 +0100")

Hi Danny!

Danny Milosavljevic <dannym@scratchpost.org> skribis:

>>   1. ‘device-module-aliases’ returns the empty list for /dev/dm-0, which
>>      is a LUKS device on my laptop.  I’m not sure what it would take to
>>      have it return “dm-crypt”, etc.  Same for RAID devices.
>
> Hmm...  I don't know either.

I browsed kmod in search of code that does that but couldn’t find it.
Do you know of another source for such things?

>>   2. Let’s assume you have: (initrd-modules '("a")).  ‘guix system’
>>      could report that module “b” is missing, even if “b” is actually a
>>      dependency of “a” and will therefore be automatically included in
>>      the initrd.  I think that’s an acceptable limitation (fixing it is
>>      non-trivial since we’d ideally need to build the target kernel so
>>      we can inspect its modules and determine their closure.)
>
> I think that's okay.

OK.

>> You’re welcome to give it a try.  In particular it’d be great if you
>> could check that ‘device-module-aliases’ returns the right thing on your
>> machine, as I shown in the example above.
>
> scheme@(guile-user)> (device-module-aliases "/dev/sda5")
> $1 = ("scsi:t-0x00" "pci:v00008086d00009C03sv000017AAsd00002214bc01sc06i01")
> scheme@(guile-user)> (device-module-aliases "/dev/sda1")
> $2 = ("scsi:t-0x00" "pci:v00008086d00009C03sv000017AAsd00002214bc01sc06i01")

Looks good.

> P.S. I just integrated my patchset (v5) and your patchset and have a working system
> with pure guile initrd (modprobe is in guile, too).  I ran basic system tests and
> also rebooted my machine with it :)

Damn it you’re too fast.  :-)  That’s 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 <dannym@scratchpost.org>
> 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’d rather change that to ‘modprobe-program’ and have it return:

  (program-file "modprobe" (with-import-modules … #~(begin …)))

mostly because “file-like objects” compose better than arbitrary 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’t use ‘uname’ here because that returns info about the
build host, not about the machine and kernel we’re deploying.

> +                 (path (string-append linux-release-module-directory name)))

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)
              …
              (for-each (lambda (module)
                          …)))
            …)

>  (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’.

  reply	other threads:[~2018-02-27 21:16 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 14:17 [bug#30629] [PATCH 0/5] Detect missing modules in the initrd Ludovic Courtès
2018-02-27 14:22 ` Ludovic Courtès
2018-02-27 14:22   ` [bug#30629] [PATCH 1/5] Add (guix glob) Ludovic Courtès
2018-02-27 21:45     ` Marius Bakke
2018-02-28 11:25     ` Danny Milosavljevic
2018-03-01  9:57       ` Ludovic Courtès
2018-03-01 10:11         ` Danny Milosavljevic
2018-03-01 14:29     ` Danny Milosavljevic
2018-02-27 14:22   ` [bug#30629] [PATCH 2/5] linux-modules: Add 'device-module-aliases' and related procedures Ludovic Courtès
2018-02-27 19:33     ` Danny Milosavljevic
2018-02-27 20:55       ` Ludovic Courtès
2018-02-27 21:58         ` Danny Milosavljevic
2018-02-27 21:24           ` Ludovic Courtès
2018-02-27 14:22   ` [bug#30629] [PATCH 3/5] linux-initrd: Separate file system module logic Ludovic Courtès
2018-03-01 14:31     ` Danny Milosavljevic
2018-02-27 14:22   ` [bug#30629] [PATCH 4/5] system: Add 'initrd-modules' field Ludovic Courtès
2018-03-01 18:39     ` Danny Milosavljevic
2018-02-27 14:22   ` [bug#30629] [PATCH 5/5] guix system: Check for the lack of modules in the initrd Ludovic Courtès
2018-03-02 12:39     ` Danny Milosavljevic
2018-02-27 21:29 ` [bug#30629] [PATCH 0/5] Detect missing " Danny Milosavljevic
2018-02-27 21:15   ` Ludovic Courtès [this message]
2018-02-27 22:50     ` Danny Milosavljevic
2018-02-27 23:13       ` [bug#30638] [WIP v2] linux-initrd: Make modprobe pure-Guile Danny Milosavljevic
2018-02-27 23:17         ` Danny Milosavljevic
2018-02-28 11:47         ` [bug#30638] [WIP v3] " Danny Milosavljevic
2018-02-28 12:05           ` [bug#30638] [WIP v4] " Danny Milosavljevic
2018-02-28 11:36       ` [bug#30629] [PATCH 0/5] Detect missing modules in the initrd Danny Milosavljevic
2018-03-01 10:05       ` Ludovic Courtès
2018-03-01 10:11         ` Danny Milosavljevic
2018-03-01 11:46       ` Danny Milosavljevic
2018-03-01 13:39         ` Ludovic Courtès
2018-03-01 13:54           ` Danny Milosavljevic
2018-03-02 12:56             ` bug#30629: " Ludovic Courtès
2018-03-02 17:50               ` [bug#30629] " Danny Milosavljevic
2018-03-02 18:16                 ` Danny Milosavljevic
2018-03-03  8:42                 ` Ludovic Courtès
2018-03-01 13:55           ` Danny Milosavljevic
2018-03-01 21:20             ` Ludovic Courtès
2018-03-02 11:42               ` Danny Milosavljevic
2018-02-28  3:03     ` [bug#30629] Device mapper modalias Danny Milosavljevic
2018-03-01  8:56       ` Danny Milosavljevic
2018-03-01 10:11       ` Ludovic Courtès
2018-03-07 18:56         ` Danny Milosavljevic

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=87tvu2w2vg.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=30629@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).