[PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’

  • Open
  • quality assurance status badge
Details
11 participants
  • Andreas Enge
  • Brian Cully
  • Felix Lechner
  • Ian Eure
  • John Kehayias
  • Kaelyn
  • Leo Famulari
  • Ludovic Courtès
  • Maxim Cournoyer
  • Maxime Devos
  • Morgan Arnold
Owner
unassigned
Submitted by
Brian Cully
Severity
normal

Debbugs page

Brian Cully wrote 3 years ago
[PATCH v1] initrd: Allow extra search paths w ith ‘initrd-extra-module-paths’
(address . guix-patches@gnu.org)
87wnf3pv87.fsf@ditto.jhoto.spork.org
This patch allows copying of out-of-tree kernel modules to the Linux
initrd.

For out-of-tree modules to found, an extra slot has been added to
‘operating-system’: ‘initrd-extra-module-paths’, which contains a list
containing items of either FILE-LIKE or (FILE-LIKE OUTPUT) which will be
searched for modules in addition to the standard Linux module path. The
required modules can then be added to ‘initrd-modules’ as normal and all paths
will be searched for it, including for any modules depended on.

* gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument to
DIRECTORIES. Now takes a list of directories to search, rather than a single
one.
* gnu/system.scm <operating-system>: Add INITRD-EXTRA-MODULE-PATHS
field and accessor. Takes a list of file-like objects.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
argument to PACKAGES. Now contains a list of file-likes to search for modules.
(raw-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
to (flat-linux-extra-module-paths) along with the selected LINUX package.
(base-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
to (raw-initrd).
---
gnu/build/linux-modules.scm | 19 ++++++++------
gnu/system.scm | 5 ++++
gnu/system/linux-initrd.scm | 52 +++++++++++++++++++++++++------------
3 files changed, 51 insertions(+), 25 deletions(-)

Toggle diff (194 lines)
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 053720574b..97b7e429ea 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -225,8 +225,8 @@ (define (file-name->module-name file)
'.ko[.gz|.xz]' and normalizing it."
(normalize-module-name (strip-extension (basename file))))
-(define (find-module-file directory module)
- "Lookup module NAME under DIRECTORY, and return its absolute file name.
+(define (find-module-file directories module)
+ "Lookup module NAME under DIRECTORIES, and return its absolute file name.
NAME can be a file name with or without '.ko', or it can be a module name.
Raise an error if it could not be found.
@@ -247,16 +247,19 @@ (define names
(else chr)))
module))))
- (match (find-files directory
- (lambda (file stat)
- (member (strip-extension
- (basename file)) names)))
+ (match (append-map (lambda (directory)
+ (find-files directory
+ (lambda (file _stat)
+ (member (strip-extension
+ (basename file))
+ names))))
+ directories)
((file)
file)
(()
- (error "kernel module not found" module directory))
+ (error "kernel module not found" module directories))
((_ ...)
- (error "several modules by that name" module directory))))
+ (error "several modules by that name" module directories))))
(define* (recursive-module-dependencies files
#:key (lookup-module dot-ko))
diff --git a/gnu/system.scm b/gnu/system.scm
index c3810cbeeb..15ac30c933 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -103,6 +103,7 @@ (define-module (gnu system)
operating-system-label
operating-system-default-label
operating-system-initrd-modules
+ operating-system-initrd-extra-module-paths
operating-system-initrd
operating-system-users
operating-system-groups
@@ -232,6 +233,8 @@ (define-record-type* <operating-system> operating-system
(initrd-modules operating-system-initrd-modules ; list of strings
(thunked) ; it's system-dependent
(default %base-initrd-modules))
+ (initrd-extra-module-paths operating-system-initrd-extra-module-paths ; list of file-likes
+ (default '()))
(firmware operating-system-firmware ; list of packages
(default %base-firmware))
@@ -1307,6 +1310,8 @@ (define make-initrd
#:linux (operating-system-kernel os)
#:linux-modules
(operating-system-initrd-modules os)
+ #:linux-extra-module-paths
+ (operating-system-initrd-extra-module-paths os)
#:mapped-devices mapped-devices
#:keyboard-layout (operating-system-keyboard-layout os)))
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 4c4c78e444..50a182d7d5 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -119,13 +119,23 @@ (define builder
`(#:references-graphs (("closure" ,init))))
"/initrd.cpio.gz"))
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory packages modules)
"Return a flat directory containing the Linux kernel modules listed in
-MODULES and taken from LINUX."
+MODULES and taken from PACKAGES."
(define imported-modules
(source-module-closure '((gnu build linux-modules)
(guix build utils))))
+ (define (package+out->input package out)
+ (gexp-input package out))
+
+ (define package-inputs
+ (map (lambda (p)
+ (match p
+ ((p o) (package+out->input p o))
+ (p (package+out->input p "out"))))
+ packages))
+
(define build-exp
(with-imported-modules imported-modules
(with-extensions (list guile-zlib)
@@ -135,11 +145,12 @@ (define build-exp
(srfi srfi-1)
(srfi srfi-26))
- (define module-dir
- (string-append #$linux "/lib/modules"))
+ (define module-dirs
+ (map (cut string-append <> "/lib/modules")
+ '#$package-inputs))
(define modules
- (let* ((lookup (cut find-module-file module-dir <>))
+ (let* ((lookup (cut find-module-file module-dirs <>))
(modules (map lookup '#$modules)))
(append modules
(recursive-module-dependencies
@@ -172,20 +183,23 @@ (define* (raw-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-paths '())
(mapped-devices '())
(keyboard-layout #f)
(helper-packages '())
qemu-networking?
volatile-root?
(on-error 'debug))
- "Return as a file-like object a raw initrd, with kernel
-modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via 'root'. LINUX-MODULES is a list of kernel
-modules to be loaded at boot time. MAPPED-DEVICES is a list of device
-mappings to realize before FILE-SYSTEMS are mounted.
-HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include
-e2fsck/static or other packages needed by the initrd to check root partition.
+ "Return as a file-like object a raw initrd, with kernel modules taken from
+LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd,
+possibly in addition to the root file system specified on the kernel command
+line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at
+boot time. LINUX-EXTRA-MODULE-PATHS is a list of file-like objects which will
+be searched for modules in addition to the linux kernel. MAPPED-DEVICES is a
+list of device mappings to realize before FILE-SYSTEMS are mounted.
+HELPER-PACKAGES is a list of packages to be copied in the initrd. It may
+include e2fsck/static or other packages needed by the initrd to check root
+partition.
When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desired
console keyboard layout. This is done before MAPPED-DEVICES are set up and
@@ -221,7 +235,8 @@ (define file-system-scan-commands
#~())))
(define kodir
- (flat-linux-module-directory linux linux-modules))
+ (flat-linux-module-directory (cons linux linux-extra-module-paths)
+ linux-modules))
(expression->initrd
(with-imported-modules (source-module-closure
@@ -366,6 +381,7 @@ (define* (base-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-paths '())
(mapped-devices '())
(keyboard-layout #f)
qemu-networking?
@@ -386,9 +402,10 @@ (define* (base-initrd file-systems
QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd.
The initrd is automatically populated with all the kernel modules necessary
-for FILE-SYSTEMS and for the given options. Additional kernel
-modules can be listed in LINUX-MODULES. They will be added to the initrd, and
-loaded at boot time in the order in which they appear."
+for FILE-SYSTEMS and for the given options. Additional kernel modules can be
+listed in LINUX-MODULES. Additional search paths for modules can be listed in
+LINUX-EXTRA-MODULE-PATHS. They will be added to the initrd, and loaded at
+boot time in the order in which they appear."
(define linux-modules*
;; Modules added to the initrd and loaded from the initrd.
`(,@linux-modules
@@ -408,6 +425,7 @@ (define helper-packages
(raw-initrd file-systems
#:linux linux
#:linux-modules linux-modules*
+ #:linux-extra-module-paths linux-extra-module-paths
#:mapped-devices mapped-devices
#:helper-packages helper-packages
#:keyboard-layout keyboard-layout

base-commit: 0a64b629ae8512790d532158a72a4a25698e8157
prerequisite-patch-id: 213ce2b9743f11d45836fe0794f117f3bb84063d
--
2.35.1
Maxime Devos wrote 3 years ago
Re: [bug#55231] [PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . Brian Cully)(address . bjc@spork.org)(address . 55231@debbugs.gnu.org)
c87a1c647289c0f0fb60773e2fd50916861b4d8b.camel@telenet.be
Brian Cully via Guix-patches via schreef op ma 02-05-2022 om 15:11 [-
0400]:
Toggle quote (3 lines)
> This patch allows copying of out-of-tree kernel modules to the Linux
> initrd.

This needs some information in the manual -- when does the field need
to be set? For what kernel modules? Is this required by v4l2loopback-
linux-module and librem-ec-acpi-linux-module? Things like that.
As-is, this functionality is hard to discover.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnBVPhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7hICAP9CDCAYffBUwkoR9lfzmRg/llBf
MbwZUM4GSZzfcnSn5QEAyofUp0BgfQaywlQmN6VYwaebfeGIVq7RjHqV4Dn2EAk=
=fPl7
-----END PGP SIGNATURE-----


Brian Cully wrote 3 years ago
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 55231@debbugs.gnu.org)
87sfprpmt3.fsf@ditto.jhoto.spork.org
Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (7 lines)
> This needs some information in the manual -- when does the field
> need
> to be set? For what kernel modules? Is this required by
> v4l2loopback-
> linux-module and librem-ec-acpi-linux-module? Things like that.
> As-is, this functionality is hard to discover.

I knew I missed something. How’s this look?

---
doc/guix.texi | 42 ++++++++++++++++++++++++++++++++++--------
1 file changed, 34 insertions(+), 8 deletions(-)

Toggle diff (107 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 5399584cb0..1ee2c1b4a3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -15173,6 +15173,16 @@ Window System.
The list of Linux kernel modules that need to be available in the
initial RAM disk. @xref{Initial RAM Disk}.
+@item @code{initrd-extra-module-paths} (default: @code{'()})
+@cindex initrd
+@cindex initial RAM disk
+A list of paths outside of the Linux kernel tree to search for
Linux
+kernel modules.
+
+The items in this may be either file-like objects (usually
packages), or
+a list where the first element is a package and the second is an
+output--e.g. @code{(list (list zfs "module"))}.
+
@item @code{initrd} (default: @code{base-initrd})
A procedure that returns an initial RAM disk for the Linux
kernel. This field is provided to support low-level
customization and
@@ -35516,6 +35526,19 @@ file system, you would write:
(initrd-modules (cons "megaraid_sas" %base-initrd-modules)))
@end lisp
+If a module listed in @code{initrd-modules} is not included in
the
+Linux-libre kernel, then the location to it must be added to the
+@code{initrd-extra-module-paths} list. For example, if your root
file
+system exists on a ZFS pool, then your configuration might look
like the
+following:
+
+@lisp
+(operating-system
+ ;; @dots{}
+ (initrd-modules (cons "zfs" %base-initrd-modules))
+ (initrd-extra-module-paths (list (list zfs "module"))))
+@end lisp
+
@defvr {Scheme Variable} %base-initrd-modules
This is the list of kernel modules included in the initrd by
default.
@end defvr
@@ -35629,13 +35652,15 @@ here is how to use it and customize it
further.
@cindex initrd
@cindex initial RAM disk
@deffn {Scheme Procedure} raw-initrd @var{file-systems} @
- [#:linux-modules '()] [#:mapped-devices '()] @
- [#:keyboard-layout #f] @
+ [#:linux-modules '()] [#:linux-extra-module-paths '()] @
+ [#:mapped-devices '()] [#:keyboard-layout #f] @
[#:helper-packages '()] [#:qemu-networking? #f]
[#:volatile-root? #f]
Return a derivation that builds a raw initrd. @var{file-systems}
is
a list of file systems to be mounted by the initrd, possibly in
addition to
the root file system specified on the kernel command line via
@option{root}.
@var{linux-modules} is a list of kernel modules to be loaded at
boot time.
+@var{linux-extra-module-paths} is a list of file-like objects to
be searched
+for kernel modules.
@var{mapped-devices} is a list of device mappings to realize
before
@var{file-systems} are mounted (@pxref{Mapped Devices}).
@var{helper-packages} is a list of packages to be copied in the
initrd.
@@ -35660,12 +35685,13 @@ to it are lost.
@deffn {Scheme Procedure} base-initrd @var{file-systems} @
[#:mapped-devices '()] [#:keyboard-layout #f] @
[#:qemu-networking? #f] [#:volatile-root? #f] @
- [#:linux-modules '()]
-Return as a file-like object a generic initrd, with kernel
-modules taken from @var{linux}. @var{file-systems} is a list of
file-systems to be
-mounted by the initrd, possibly in addition to the root file
system specified
-on the kernel command line via @option{root}.
@var{mapped-devices} is a list of device
-mappings to realize before @var{file-systems} are mounted.
+ [#:linux-modules '()] [#:linux-extra-module-paths '()]
+Return as a file-like object a generic initrd, with kernel
modules taken
+from @var{linux} and @var{linux-extra-module-paths}.
@var{file-systems}
+is a list of file-systems to be mounted by the initrd, possibly
in
+addition to the root file system specified on the kernel command
line
+via @option{root}. @var{mapped-devices} is a list of device
mappings to
+realize before @var{file-systems} are mounted.
When true, @var{keyboard-layout} is a @code{<keyboard-layout>}
record denoting
the desired console keyboard layout. This is done before
@var{mapped-devices}
--
2.35.1
Kaelyn wrote 3 years ago
[PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
j3O4Vb5dVlLA_P-LaSEH-2wB7aPJM3Zlupj1seuNjR34OijQwAiM9ZECRx309TmNwIejOzHv_W5lkUkeQC8MqGTbK3kqjcZa3fCx440oWcw=@protonmail.com
I've read through the original patch and the doc patch, and based on my own tinkering with guix initrd generation, the patches look good to me. I'm also happy to see the functionality being added, and already have plans for using it with zfs (to further the goal of an encrypted multi-disk zfs root).

Cheers,
Kaelyn
Maxime Devos wrote 3 years ago
(address . 55231@debbugs.gnu.org)
f31190b82fc43348535ee873bcc29a9ff501a6f7.camel@telenet.be
(for whatever reason, looks like this didn't end up in my inbox)
Toggle quote (8 lines)
> +@item @code{initrd-extra-module-paths} (default: @code{'()})
> [...]
> The items in this may be either file-like objects (usually
> packages), or
> +a list where the first element is a package and the second is an
> +output--e.g. @code{(list (list zfs "module"))}.


As-is, I don't think this is a good example, because
'expression->initrd' does not set #:substitutable? #false,
the 'zfs' package has the comment (*)

`(;; The ZFS kernel module should not be downloaded since the
license
;; terms don't allow for distributing it, only building it
locally.
#:substitutable? #f [...])

and IIUC, the code inside expression->initrd copies the kernel module
into
the new store item, so it looks like this accidentally suggest people
to
commit copyvios, and copyvios are currently against the law.

Greetings,
Maxime.

(*) Though I don't understand that comment: Guix is a distribution, so
by definition
it's distributing zfs -- unless it's only talking about the binaries
and not the
source code ...
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYn6+whccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7tLWAP43VVfdGmeFc9n0cZfORPFbnUiG
b2Lnn8OyvxuhJtatbQEAlkKAnfaCenTjzuTbHXXUmzswBC/4ZzWpl4AtlxOWSQ8=
=lAgN
-----END PGP SIGNATURE-----


Brian Cully wrote 3 years ago
[PATCH v2] initrd: Allow extra search paths w ith ‘initrd-extra-module-paths’
(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@kublai.com)
2053c4ab42dfe2719cfc377934ac2fb9bcb500a9.1653160364.git.bjc@spork.org
From: Brian Cully <bjc@kublai.com>

This patch allows copying of out-of-tree kernel modules to the Linux
initrd.

For out-of-tree modules to found, an extra slot has been added to
‘operating-system’: ‘initrd-extra-module-paths’, which contains a list
containing items of either FILE-LIKE or (FILE-LIKE OUTPUT) which will be
searched for modules in addition to the standard Linux module path. The
required modules can then be added to ‘initrd-modules’ as normal and all paths
will be searched for it, including for any modules depended on.

* doc: Update documentation for ‘initrd-extra-module-paths’.
* gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument to
DIRECTORIES. Now takes a list of directories to search, rather than a single
one.
* gnu/system.scm <operating-system>: Add INITRD-EXTRA-MODULE-PATHS
field and accessor. Takes a list of file-like objects.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
argument to PACKAGES. Now contains a list of file-likes to search for modules.
(raw-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
to (flat-linux-extra-module-paths) along with the selected LINUX package.
(base-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
to (raw-initrd).
---
This version includes both the previous patch and the documentation.

doc/guix.texi | 42 ++++++++++++++++++++++++------
gnu/build/linux-modules.scm | 19 ++++++++------
gnu/system.scm | 5 ++++
gnu/system/linux-initrd.scm | 52 +++++++++++++++++++++++++------------
4 files changed, 85 insertions(+), 33 deletions(-)

Toggle diff (270 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index faa35060ef..9fd45ea209 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -15490,6 +15490,16 @@ operating-system Reference
The list of Linux kernel modules that need to be available in the
initial RAM disk. @xref{Initial RAM Disk}.
+@item @code{initrd-extra-module-paths} (default: @code{'()})
+@cindex initrd
+@cindex initial RAM disk
+A list of paths outside of the Linux kernel tree to search for Linux
+kernel modules.
+
+The items in this may be either file-like objects (usually packages), or
+a list where the first element is a package and the second is an
+output--e.g. @code{(list (list zfs "module"))}.
+
@item @code{initrd} (default: @code{base-initrd})
A procedure that returns an initial RAM disk for the Linux
kernel. This field is provided to support low-level customization and
@@ -35816,6 +35826,19 @@ Initial RAM Disk
(initrd-modules (cons "megaraid_sas" %base-initrd-modules)))
@end lisp
+If a module listed in @code{initrd-modules} is not included in the
+Linux-libre kernel, then the location to it must be added to the
+@code{initrd-extra-module-paths} list. For example, if your root file
+system exists on a ZFS pool, then your configuration might look like the
+following:
+
+@lisp
+(operating-system
+ ;; @dots{}
+ (initrd-modules (cons "zfs" %base-initrd-modules))
+ (initrd-extra-module-paths (list (list zfs "module"))))
+@end lisp
+
@defvr {Scheme Variable} %base-initrd-modules
This is the list of kernel modules included in the initrd by default.
@end defvr
@@ -35929,13 +35952,15 @@ Initial RAM Disk
@cindex initrd
@cindex initial RAM disk
@deffn {Scheme Procedure} raw-initrd @var{file-systems} @
- [#:linux-modules '()] [#:mapped-devices '()] @
- [#:keyboard-layout #f] @
+ [#:linux-modules '()] [#:linux-extra-module-paths '()] @
+ [#:mapped-devices '()] [#:keyboard-layout #f] @
[#:helper-packages '()] [#:qemu-networking? #f] [#:volatile-root? #f]
Return a derivation that builds a raw initrd. @var{file-systems} is
a list of file systems to be mounted by the initrd, possibly in addition to
the root file system specified on the kernel command line via @option{root}.
@var{linux-modules} is a list of kernel modules to be loaded at boot time.
+@var{linux-extra-module-paths} is a list of file-like objects to be searched
+for kernel modules.
@var{mapped-devices} is a list of device mappings to realize before
@var{file-systems} are mounted (@pxref{Mapped Devices}).
@var{helper-packages} is a list of packages to be copied in the initrd.
@@ -35960,12 +35985,13 @@ Initial RAM Disk
@deffn {Scheme Procedure} base-initrd @var{file-systems} @
[#:mapped-devices '()] [#:keyboard-layout #f] @
[#:qemu-networking? #f] [#:volatile-root? #f] @
- [#:linux-modules '()]
-Return as a file-like object a generic initrd, with kernel
-modules taken from @var{linux}. @var{file-systems} is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via @option{root}. @var{mapped-devices} is a list of device
-mappings to realize before @var{file-systems} are mounted.
+ [#:linux-modules '()] [#:linux-extra-module-paths '()]
+Return as a file-like object a generic initrd, with kernel modules taken
+from @var{linux} and @var{linux-extra-module-paths}. @var{file-systems}
+is a list of file-systems to be mounted by the initrd, possibly in
+addition to the root file system specified on the kernel command line
+via @option{root}. @var{mapped-devices} is a list of device mappings to
+realize before @var{file-systems} are mounted.
When true, @var{keyboard-layout} is a @code{<keyboard-layout>} record denoting
the desired console keyboard layout. This is done before @var{mapped-devices}
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 053720574b..97b7e429ea 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -225,8 +225,8 @@ (define (file-name->module-name file)
'.ko[.gz|.xz]' and normalizing it."
(normalize-module-name (strip-extension (basename file))))
-(define (find-module-file directory module)
- "Lookup module NAME under DIRECTORY, and return its absolute file name.
+(define (find-module-file directories module)
+ "Lookup module NAME under DIRECTORIES, and return its absolute file name.
NAME can be a file name with or without '.ko', or it can be a module name.
Raise an error if it could not be found.
@@ -247,16 +247,19 @@ (define (find-module-file directory module)
(else chr)))
module))))
- (match (find-files directory
- (lambda (file stat)
- (member (strip-extension
- (basename file)) names)))
+ (match (append-map (lambda (directory)
+ (find-files directory
+ (lambda (file _stat)
+ (member (strip-extension
+ (basename file))
+ names))))
+ directories)
((file)
file)
(()
- (error "kernel module not found" module directory))
+ (error "kernel module not found" module directories))
((_ ...)
- (error "several modules by that name" module directory))))
+ (error "several modules by that name" module directories))))
(define* (recursive-module-dependencies files
#:key (lookup-module dot-ko))
diff --git a/gnu/system.scm b/gnu/system.scm
index ba3a1865d7..6c712e5cea 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -107,6 +107,7 @@ (define-module (gnu system)
operating-system-label
operating-system-default-label
operating-system-initrd-modules
+ operating-system-initrd-extra-module-paths
operating-system-initrd
operating-system-users
operating-system-groups
@@ -236,6 +237,8 @@ (define-record-type* <operating-system> operating-system
(initrd-modules operating-system-initrd-modules ; list of strings
(thunked) ; it's system-dependent
(default %base-initrd-modules))
+ (initrd-extra-module-paths operating-system-initrd-extra-module-paths ; list of file-likes
+ (default '()))
(firmware operating-system-firmware ; list of packages
(default %base-firmware))
@@ -1312,6 +1315,8 @@ (define (operating-system-initrd-file os)
#:linux (operating-system-kernel os)
#:linux-modules
(operating-system-initrd-modules os)
+ #:linux-extra-module-paths
+ (operating-system-initrd-extra-module-paths os)
#:mapped-devices mapped-devices
#:keyboard-layout (operating-system-keyboard-layout os)))
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 4c4c78e444..50a182d7d5 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -119,13 +119,23 @@ (define* (expression->initrd exp
`(#:references-graphs (("closure" ,init))))
"/initrd.cpio.gz"))
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory packages modules)
"Return a flat directory containing the Linux kernel modules listed in
-MODULES and taken from LINUX."
+MODULES and taken from PACKAGES."
(define imported-modules
(source-module-closure '((gnu build linux-modules)
(guix build utils))))
+ (define (package+out->input package out)
+ (gexp-input package out))
+
+ (define package-inputs
+ (map (lambda (p)
+ (match p
+ ((p o) (package+out->input p o))
+ (p (package+out->input p "out"))))
+ packages))
+
(define build-exp
(with-imported-modules imported-modules
(with-extensions (list guile-zlib)
@@ -135,11 +145,12 @@ (define (flat-linux-module-directory linux modules)
(srfi srfi-1)
(srfi srfi-26))
- (define module-dir
- (string-append #$linux "/lib/modules"))
+ (define module-dirs
+ (map (cut string-append <> "/lib/modules")
+ '#$package-inputs))
(define modules
- (let* ((lookup (cut find-module-file module-dir <>))
+ (let* ((lookup (cut find-module-file module-dirs <>))
(modules (map lookup '#$modules)))
(append modules
(recursive-module-dependencies
@@ -172,20 +183,23 @@ (define* (raw-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-paths '())
(mapped-devices '())
(keyboard-layout #f)
(helper-packages '())
qemu-networking?
volatile-root?
(on-error 'debug))
- "Return as a file-like object a raw initrd, with kernel
-modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via 'root'. LINUX-MODULES is a list of kernel
-modules to be loaded at boot time. MAPPED-DEVICES is a list of device
-mappings to realize before FILE-SYSTEMS are mounted.
-HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include
-e2fsck/static or other packages needed by the initrd to check root partition.
+ "Return as a file-like object a raw initrd, with kernel modules taken from
+LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd,
+possibly in addition to the root file system specified on the kernel command
+line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at
+boot time. LINUX-EXTRA-MODULE-PATHS is a list of file-like objects which will
+be searched for modules in addition to the linux kernel. MAPPED-DEVICES is a
+list of device mappings to realize before FILE-SYSTEMS are mounted.
+HELPER-PACKAGES is a list of packages to be copied in the initrd. It may
+include e2fsck/static or other packages needed by the initrd to check root
+partition.
When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desired
console keyboard layout. This is done before MAPPED-DEVICES are set up and
@@ -221,7 +235,8 @@ (define* (raw-initrd file-systems
#~())))
(define kodir
- (flat-linux-module-directory linux linux-modules))
+ (flat-linux-module-directory (cons linux linux-extra-module-paths)
+ linux-modules))
(expression->initrd
(with-imported-modules (source-module-closure
@@ -366,6 +381,7 @@ (define* (base-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-paths '())
(mapped-devices '())
(keyboard-layout #f)
qemu-networking?
@@ -386,9 +402,10 @@ (define* (base-initrd file-systems
QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd.
The initrd is automatically populated with all the kernel modules necessary
-for FILE-SYSTEMS and for the given options. Additional kernel
-modules can be listed in LINUX-MODULES. They will be added to the initrd, and
-loaded at boot time in the order in which they appear."
+for FILE-SYSTEMS and for the given options. Additional kernel modules can be
+listed in LINUX-MODULES. Additional search paths for modules can be listed in
+LINUX-EXTRA-MODULE-PATHS. They will be added to the initrd, and loaded at
+boot time in the order in which they appear."
(define linux-modules*
;; Modules added to the initrd and loaded from the initrd.
`(,@linux-modules
@@ -408,6 +425,7 @@ (define* (base-initrd file-systems
(raw-initrd file-systems
#:linux linux
#:linux-modules linux-modules*
+ #:linux-extra-module-paths linux-extra-module-paths
#:mapped-devices mapped-devices
#:helper-packages helper-packages
#:keyboard-layout keyboard-layout
--
2.36.1
Kaelyn wrote 3 years ago
[PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
5RCll7W7NfLNRPRFsqgPxB3zS1_6W-9QJbOmXc5RW3E8oZ4Pm_JTzO0SZXsMkZtC811Rw5G0ISt75vP_YKll5MGU7_Krm3Y6IWoXYL9xR3A=@protonmail.com
As the earlier patch discussion seemed to have focused on ZFS licensing issues that are largely orothogonal to the functionality being added, I'd like to again voice my support for the proposed patch. While ZFS is indeed a bad example due to open questions about module licensing and redistribution, it isn't the only out-of-tree module currently packaged in Guix which could be used with the extra initrd support (not counting future packages or external channels). Within the guix repo, the packages using the `linux-module-build-system` aside from zfs are:
- acpi-call-linux-module
- bbswitch-module
- ddcci-driver-linux
- rtl8812au-aircrack-ng-linux-module
- rtl8821ce-linux-module
- ttyebus-linux-module
- v4l2loopback-linux-module
- vhba-module
- wiregard-linux-compat

Of those nine, at least four look to be for specific hardware, and I can come up with theoretical use cases for why someone might want those or wiregard-linux-compat (though the cases are definitely contrived straw-men that may or may not be implementable in practice or actually useful in an initrd context, such as network booting with an older kernel and the root filesystem can only be accessed over a wireguard connection).

Cheers,
Kaelyn
Ludovic Courtès wrote 3 years ago
(name . Brian Cully)(address . bjc@spork.org)(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@kublai.com)
87ilpkwf8x.fsf_-_@gnu.org
Hello Brian,

Brian Cully <bjc@spork.org> skribis:

Toggle quote (25 lines)
> From: Brian Cully <bjc@kublai.com>
>
> This patch allows copying of out-of-tree kernel modules to the Linux
> initrd.
>
> For out-of-tree modules to found, an extra slot has been added to
> ‘operating-system’: ‘initrd-extra-module-paths’, which contains a list
> containing items of either FILE-LIKE or (FILE-LIKE OUTPUT) which will be
> searched for modules in addition to the standard Linux module path. The
> required modules can then be added to ‘initrd-modules’ as normal and all paths
> will be searched for it, including for any modules depended on.
>
> * doc: Update documentation for ‘initrd-extra-module-paths’.
> * gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument to
> DIRECTORIES. Now takes a list of directories to search, rather than a single
> one.
> * gnu/system.scm <operating-system>: Add INITRD-EXTRA-MODULE-PATHS
> field and accessor. Takes a list of file-like objects.
> * gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
> argument to PACKAGES. Now contains a list of file-likes to search for modules.
> (raw-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
> to (flat-linux-extra-module-paths) along with the selected LINUX package.
> (base-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
> to (raw-initrd).

Nice, it looks like a welcome addition.

Toggle quote (13 lines)
> +If a module listed in @code{initrd-modules} is not included in the
> +Linux-libre kernel, then the location to it must be added to the
> +@code{initrd-extra-module-paths} list. For example, if your root file
> +system exists on a ZFS pool, then your configuration might look like the
> +following:
> +
> +@lisp
> +(operating-system
> + ;; @dots{}
> + (initrd-modules (cons "zfs" %base-initrd-modules))
> + (initrd-extra-module-paths (list (list zfs "module"))))
> +@end lisp

I wonder if we could reuse the ‘kernel-loadable-modules’ field for this
purpose instead of introducing a new field. We’d need to pass it to the
initrd procedures and have them search in there in addition to the
kernel package, pretty much like this patch already does actually.

WDYT?

Nitpick: the GNU convention is to use “path” to denote “search paths”,
and other “file”, “file name”, or similar. In this case, that’d be
“kernel module” or “Linux module”.

Thank you!

Ludo’.
Brian Cully wrote 3 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@kublai.com)
87a6aug4p2.fsf@ditto.jhoto.spork.org
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (9 lines)
> I wonder if we could reuse the ‘kernel-loadable-modules’ field
> for this
> purpose instead of introducing a new field. We’d need to pass
> it to the
> initrd procedures and have them search in there in addition to
> the
> kernel package, pretty much like this patch already does
> actually.

This sounds like it could be made to work as you suggest. My
feeling is that the two contexts are slightly different, though,
as the Linux modules are a superset of the initrd modules, so I’d
prefer not to mix them as it might be confusing to people who are
used to other Linux distros where the initrd modules are called
out separately. I admit I’m probably being silly here, and don’t
have any serious objection in principle.

Toggle quote (6 lines)
> Nitpick: the GNU convention is to use “path” to denote “search
> paths”,
> and other “file”, “file name”, or similar. In this case, that’d
> be
> “kernel module” or “Linux module”.

I struggled with this a fair amount, actually. What these
file-likes actually represent is an element of a search path, even
if they come in the odd form of a file-like object, which is why I
used ‘path’. ‘file’ seems wrong, as it implies (to me) that it’s
the ‘initrd-extra-module-files’ option itself that would include
the module, rather than the ‘initrd-modules’ option.

Of course, all this goes away if we just reuse
‘kernel-loadable-modules’ as an additional input, rather than
adding another option, so that’s a distinct mark in favor of doing
that.

When I get some time (hopefully soon!) I’ll try to thread
‘kernel-loadable-modules’ through instead and see how far I can
get with that approach. Do you think the documentation for it will
need to be updated to specify that it’s also used as a search path
for initrd building? Or maybe the better option is to update the
documentation for ‘initrd-modules’ to say that it uses
‘kernel-loadable-modules’ as input?

-bjc
Kaelyn wrote 3 years ago
[PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
jMhPvkR0keO7tVdAcEW2mIuI_3iopqkDVl73kagJHUdr7sa5CdxbqMwQ2j2CqDQymRUDaSXCPO_8CIv0qSDhOyD37Nc5rsnRyrNUBrVgQM4=@protonmail.com
Hi,

My $0.02 on 'initrd-extra-module-paths' vs 'kernel-loadable-modules': if the initrd code is smart enough to not include the entire packages and only includes the requested modules from the packages (which I think is already true based on behavior observed some time ago), then not having to duplicate the list would be preferable.

I found this issue in the tracker after being surprised that the initrd builder ignored 'kernel-loadable-modules' with 'initrd-modules' only working for modules that are included in the primary linux kernel package. That surprise over the incompatibility between 'initrd-modules' and 'kernel-loadable-modules' is also why I've been relatively vocal about the patch. ;)

Cheers,
Kaelyn
Ludovic Courtès wrote 3 years ago
(name . Brian Cully)(address . bjc@spork.org)(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@kublai.com)
87fskmky0d.fsf@gnu.org
Hi,

Brian Cully <bjc@spork.org> skribis:

Toggle quote (13 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> I wonder if we could reuse the ‘kernel-loadable-modules’ field for
>> this
>> purpose instead of introducing a new field. We’d need to pass it to
>> the
>> initrd procedures and have them search in there in addition to the
>> kernel package, pretty much like this patch already does actually.
>
> This sounds like it could be made to work as you suggest. My feeling
> is that the two contexts are slightly different, though, as the Linux
> modules are a superset of the initrd modules,

Right. Here, we want the initrd machinery to search for modules in any
place where they can be found, which is either ‘kernel’ or
‘kernel-loadable-modules’.

One could define ‘initrd-extra-module-paths’ to be different from
‘kernel-loadable-modules’, for example if you can be sure the module
will be loaded from the initrd and not after, but in general both are
likely to have the same value, no?

Toggle quote (12 lines)
>> Nitpick: the GNU convention is to use “path” to denote “search
>> paths”,
>> and other “file”, “file name”, or similar. In this case, that’d be
>> “kernel module” or “Linux module”.
>
> I struggled with this a fair amount, actually. What these file-likes
> actually represent is an element of a search path, even if they come
> in the odd form of a file-like object, which is why I used
> ‘path’. ‘file’ seems wrong, as it implies (to me) that it’s the
> ‘initrd-extra-module-files’ option itself that would include the
> module, rather than the ‘initrd-modules’ option.

Hmm right, you have a point! :-)

Toggle quote (8 lines)
> When I get some time (hopefully soon!) I’ll try to thread
> ‘kernel-loadable-modules’ through instead and see how far I can get
> with that approach. Do you think the documentation for it will need to
> be updated to specify that it’s also used as a search path for initrd
> building? Or maybe the better option is to update the documentation
> for ‘initrd-modules’ to say that it uses ‘kernel-loadable-modules’ as
> input?

I think you should update the documentation in the commit that changes
things, so that the patch is self-contained.

It may be enough to state in the documentation of the ‘initrd-modules’
field that its value is a list of module names that are searched for in
‘kernel’ and ‘kernel-loadable-modules’.

WDYT?

Thanks,
Ludo’.
Brian Cully wrote 3 years ago
[PATCH v2 1/2] Allows copying of out-of-tree modules to the Linux initrd.
(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@spork.org)
88d91cf303fd82c3667149ee8a647527f44bf571.1655430718.git.bjc@spork.org
With this patch, modules for ‘initrd-modules’ will not only be searched for in
the in-tree Linux modules, but also any additional modules specified in
‘kernel-loadable-modules’.

* gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument to
DIRECTORIES. Now takes a list of directories to search, rather than a single
one.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
argument to PACKAGES. Now contains a list of file-likes to search for modules.
(raw-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
to (flat-linux-extra-module-paths) along with the selected LINUX package.
(base-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
to (raw-initrd).
* gnu/system.scm (operating-system-initrd-file): pass in operating system
definition's kernel-loadable-modules into (make-initrd) as
LINUX-EXTRA-MODULE-PATHS.
---

I've removed the new operating-system slot in preference to re-using
kernel-loadable-modules, as discussed.

I did leave the old argument names for the lower level routines in place,
as I feel that they more accurately represent how the data are being
used.

I've also pulled out the documentation. Once this patch set is beaten
into acceptability, the documentation can be adjusted if that's deemed
necessary.

gnu/build/linux-modules.scm | 19 ++++++++------
gnu/system.scm | 2 ++
gnu/system/linux-initrd.scm | 52 +++++++++++++++++++++++++------------
3 files changed, 48 insertions(+), 25 deletions(-)

Toggle diff (174 lines)
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 053720574b..97b7e429ea 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -225,8 +225,8 @@ (define (file-name->module-name file)
'.ko[.gz|.xz]' and normalizing it."
(normalize-module-name (strip-extension (basename file))))
-(define (find-module-file directory module)
- "Lookup module NAME under DIRECTORY, and return its absolute file name.
+(define (find-module-file directories module)
+ "Lookup module NAME under DIRECTORIES, and return its absolute file name.
NAME can be a file name with or without '.ko', or it can be a module name.
Raise an error if it could not be found.
@@ -247,16 +247,19 @@ (define (find-module-file directory module)
(else chr)))
module))))
- (match (find-files directory
- (lambda (file stat)
- (member (strip-extension
- (basename file)) names)))
+ (match (append-map (lambda (directory)
+ (find-files directory
+ (lambda (file _stat)
+ (member (strip-extension
+ (basename file))
+ names))))
+ directories)
((file)
file)
(()
- (error "kernel module not found" module directory))
+ (error "kernel module not found" module directories))
((_ ...)
- (error "several modules by that name" module directory))))
+ (error "several modules by that name" module directories))))
(define* (recursive-module-dependencies files
#:key (lookup-module dot-ko))
diff --git a/gnu/system.scm b/gnu/system.scm
index ba1b7b5152..6f52377c8d 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1313,6 +1313,8 @@ (define (operating-system-initrd-file os)
#:linux (operating-system-kernel os)
#:linux-modules
(operating-system-initrd-modules os)
+ #:linux-extra-module-paths
+ (operating-system-kernel-loadable-modules os)
#:mapped-devices mapped-devices
#:keyboard-layout (operating-system-keyboard-layout os)))
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 4c4c78e444..50a182d7d5 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -119,13 +119,23 @@ (define* (expression->initrd exp
`(#:references-graphs (("closure" ,init))))
"/initrd.cpio.gz"))
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory packages modules)
"Return a flat directory containing the Linux kernel modules listed in
-MODULES and taken from LINUX."
+MODULES and taken from PACKAGES."
(define imported-modules
(source-module-closure '((gnu build linux-modules)
(guix build utils))))
+ (define (package+out->input package out)
+ (gexp-input package out))
+
+ (define package-inputs
+ (map (lambda (p)
+ (match p
+ ((p o) (package+out->input p o))
+ (p (package+out->input p "out"))))
+ packages))
+
(define build-exp
(with-imported-modules imported-modules
(with-extensions (list guile-zlib)
@@ -135,11 +145,12 @@ (define (flat-linux-module-directory linux modules)
(srfi srfi-1)
(srfi srfi-26))
- (define module-dir
- (string-append #$linux "/lib/modules"))
+ (define module-dirs
+ (map (cut string-append <> "/lib/modules")
+ '#$package-inputs))
(define modules
- (let* ((lookup (cut find-module-file module-dir <>))
+ (let* ((lookup (cut find-module-file module-dirs <>))
(modules (map lookup '#$modules)))
(append modules
(recursive-module-dependencies
@@ -172,20 +183,23 @@ (define* (raw-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-paths '())
(mapped-devices '())
(keyboard-layout #f)
(helper-packages '())
qemu-networking?
volatile-root?
(on-error 'debug))
- "Return as a file-like object a raw initrd, with kernel
-modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via 'root'. LINUX-MODULES is a list of kernel
-modules to be loaded at boot time. MAPPED-DEVICES is a list of device
-mappings to realize before FILE-SYSTEMS are mounted.
-HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include
-e2fsck/static or other packages needed by the initrd to check root partition.
+ "Return as a file-like object a raw initrd, with kernel modules taken from
+LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd,
+possibly in addition to the root file system specified on the kernel command
+line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at
+boot time. LINUX-EXTRA-MODULE-PATHS is a list of file-like objects which will
+be searched for modules in addition to the linux kernel. MAPPED-DEVICES is a
+list of device mappings to realize before FILE-SYSTEMS are mounted.
+HELPER-PACKAGES is a list of packages to be copied in the initrd. It may
+include e2fsck/static or other packages needed by the initrd to check root
+partition.
When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desired
console keyboard layout. This is done before MAPPED-DEVICES are set up and
@@ -221,7 +235,8 @@ (define* (raw-initrd file-systems
#~())))
(define kodir
- (flat-linux-module-directory linux linux-modules))
+ (flat-linux-module-directory (cons linux linux-extra-module-paths)
+ linux-modules))
(expression->initrd
(with-imported-modules (source-module-closure
@@ -366,6 +381,7 @@ (define* (base-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-paths '())
(mapped-devices '())
(keyboard-layout #f)
qemu-networking?
@@ -386,9 +402,10 @@ (define* (base-initrd file-systems
QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd.
The initrd is automatically populated with all the kernel modules necessary
-for FILE-SYSTEMS and for the given options. Additional kernel
-modules can be listed in LINUX-MODULES. They will be added to the initrd, and
-loaded at boot time in the order in which they appear."
+for FILE-SYSTEMS and for the given options. Additional kernel modules can be
+listed in LINUX-MODULES. Additional search paths for modules can be listed in
+LINUX-EXTRA-MODULE-PATHS. They will be added to the initrd, and loaded at
+boot time in the order in which they appear."
(define linux-modules*
;; Modules added to the initrd and loaded from the initrd.
`(,@linux-modules
@@ -408,6 +425,7 @@ (define* (base-initrd file-systems
(raw-initrd file-systems
#:linux linux
#:linux-modules linux-modules*
+ #:linux-extra-module-paths linux-extra-module-paths
#:mapped-devices mapped-devices
#:helper-packages helper-packages
#:keyboard-layout keyboard-layout
--
2.36.1
Ludovic Courtès wrote 3 years ago
Re: bug#55231: [PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . Brian Cully)(address . bjc@spork.org)(address . 55231@debbugs.gnu.org)
878rpvdo5w.fsf_-_@gnu.org
Hi Brian,

Brian Cully <bjc@spork.org> skribis:

Toggle quote (29 lines)
> With this patch, modules for ‘initrd-modules’ will not only be searched for in
> the in-tree Linux modules, but also any additional modules specified in
> ‘kernel-loadable-modules’.
>
> * gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument to
> DIRECTORIES. Now takes a list of directories to search, rather than a single
> one.
> * gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
> argument to PACKAGES. Now contains a list of file-likes to search for modules.
> (raw-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
> to (flat-linux-extra-module-paths) along with the selected LINUX package.
> (base-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
> to (raw-initrd).
> * gnu/system.scm (operating-system-initrd-file): pass in operating system
> definition's kernel-loadable-modules into (make-initrd) as
> LINUX-EXTRA-MODULE-PATHS.
> ---
>
> I've removed the new operating-system slot in preference to re-using
> kernel-loadable-modules, as discussed.
>
> I did leave the old argument names for the lower level routines in place,
> as I feel that they more accurately represent how the data are being
> used.
>
> I've also pulled out the documentation. Once this patch set is beaten
> into acceptability, the documentation can be adjusted if that's deemed
> necessary.

Alright!

It looks great to me. I have two cosmetic comments:

Toggle quote (3 lines)
> + (define (package+out->input package out)
> + (gexp-input package out))

I think you can remove this definition and use ‘gexp-input’ directly.

Toggle quote (6 lines)
> @@ -172,20 +183,23 @@ (define* (raw-initrd file-systems
> #:key
> (linux linux-libre)
> (linux-modules '())
> + (linux-extra-module-paths '())

Nitpick: I’d call it #:linux-extra-module-path (singular, as in “search
path”) or simply #:linux-extra-module-directories.

If you could introduce a couple of lines in doc/guix.texi to explain
where modules are searched for, that’d be perfect.

Thanks for taking the time to prepare this revision!

Ludo’.
Brian Cully wrote 3 years ago
[PATCH v3 1/2] Allows copying of out-of-tree modules to the Linux initrd.
(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@spork.org)
10a6842d1a6bde797d82d6b8107660bedce8b956.1655579477.git.bjc@spork.org
With this patch, modules for ‘initrd-modules’ will not only be searched for in
the in-tree Linux modules, but also any additional modules specified in
‘kernel-loadable-modules’.

* gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument to
DIRECTORIES. Now takes a list of directories to search, rather than a single
one.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
argument to PACKAGES. Now contains a list of file-likes to search for modules.
(raw-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (flat-linux-module-directory) along with the selected LINUX package.
(base-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (raw-initrd).
* gnu/system.scm (operating-system-initrd-file): pass in operating system
definition's kernel-loadable-modules into (make-initrd) as
LINUX-EXTRA-MODULE-DIRECTORIES.
---

This version removes the redundant (package+out->input) procedure, and
renames ‘linux-extra-module-paths’ to ‘linux-extra-module-directories’.

gnu/build/linux-modules.scm | 19 ++++++++------
gnu/system.scm | 2 ++
gnu/system/linux-initrd.scm | 49 ++++++++++++++++++++++++-------------
3 files changed, 45 insertions(+), 25 deletions(-)

Toggle diff (171 lines)
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 053720574b..97b7e429ea 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -225,8 +225,8 @@ (define (file-name->module-name file)
'.ko[.gz|.xz]' and normalizing it."
(normalize-module-name (strip-extension (basename file))))
-(define (find-module-file directory module)
- "Lookup module NAME under DIRECTORY, and return its absolute file name.
+(define (find-module-file directories module)
+ "Lookup module NAME under DIRECTORIES, and return its absolute file name.
NAME can be a file name with or without '.ko', or it can be a module name.
Raise an error if it could not be found.
@@ -247,16 +247,19 @@ (define (find-module-file directory module)
(else chr)))
module))))
- (match (find-files directory
- (lambda (file stat)
- (member (strip-extension
- (basename file)) names)))
+ (match (append-map (lambda (directory)
+ (find-files directory
+ (lambda (file _stat)
+ (member (strip-extension
+ (basename file))
+ names))))
+ directories)
((file)
file)
(()
- (error "kernel module not found" module directory))
+ (error "kernel module not found" module directories))
((_ ...)
- (error "several modules by that name" module directory))))
+ (error "several modules by that name" module directories))))
(define* (recursive-module-dependencies files
#:key (lookup-module dot-ko))
diff --git a/gnu/system.scm b/gnu/system.scm
index ba1b7b5152..2439560671 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1313,6 +1313,8 @@ (define (operating-system-initrd-file os)
#:linux (operating-system-kernel os)
#:linux-modules
(operating-system-initrd-modules os)
+ #:linux-extra-module-directories
+ (operating-system-kernel-loadable-modules os)
#:mapped-devices mapped-devices
#:keyboard-layout (operating-system-keyboard-layout os)))
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 4c4c78e444..f6e8f75efa 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -119,13 +119,20 @@ (define* (expression->initrd exp
`(#:references-graphs (("closure" ,init))))
"/initrd.cpio.gz"))
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory packages modules)
"Return a flat directory containing the Linux kernel modules listed in
-MODULES and taken from LINUX."
+MODULES and taken from PACKAGES."
(define imported-modules
(source-module-closure '((gnu build linux-modules)
(guix build utils))))
+ (define package-inputs
+ (map (lambda (p)
+ (match p
+ ((p o) (gexp-input p o))
+ (p (gexp-input p "out"))))
+ packages))
+
(define build-exp
(with-imported-modules imported-modules
(with-extensions (list guile-zlib)
@@ -135,11 +142,12 @@ (define (flat-linux-module-directory linux modules)
(srfi srfi-1)
(srfi srfi-26))
- (define module-dir
- (string-append #$linux "/lib/modules"))
+ (define module-dirs
+ (map (cut string-append <> "/lib/modules")
+ '#$package-inputs))
(define modules
- (let* ((lookup (cut find-module-file module-dir <>))
+ (let* ((lookup (cut find-module-file module-dirs <>))
(modules (map lookup '#$modules)))
(append modules
(recursive-module-dependencies
@@ -172,20 +180,23 @@ (define* (raw-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(mapped-devices '())
(keyboard-layout #f)
(helper-packages '())
qemu-networking?
volatile-root?
(on-error 'debug))
- "Return as a file-like object a raw initrd, with kernel
-modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via 'root'. LINUX-MODULES is a list of kernel
-modules to be loaded at boot time. MAPPED-DEVICES is a list of device
-mappings to realize before FILE-SYSTEMS are mounted.
-HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include
-e2fsck/static or other packages needed by the initrd to check root partition.
+ "Return as a file-like object a raw initrd, with kernel modules taken from
+LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd,
+possibly in addition to the root file system specified on the kernel command
+line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at
+boot time. LINUX-EXTRA-MODULE-DIRECTORIES is a list of file-like objects which
+will be searched for modules in addition to the linux kernel. MAPPED-DEVICES
+is a list of device mappings to realize before FILE-SYSTEMS are mounted.
+HELPER-PACKAGES is a list of packages to be copied in the initrd. It may
+include e2fsck/static or other packages needed by the initrd to check root
+partition.
When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desired
console keyboard layout. This is done before MAPPED-DEVICES are set up and
@@ -221,7 +232,8 @@ (define* (raw-initrd file-systems
#~())))
(define kodir
- (flat-linux-module-directory linux linux-modules))
+ (flat-linux-module-directory (cons linux linux-extra-module-directories)
+ linux-modules))
(expression->initrd
(with-imported-modules (source-module-closure
@@ -366,6 +378,7 @@ (define* (base-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(mapped-devices '())
(keyboard-layout #f)
qemu-networking?
@@ -386,9 +399,10 @@ (define* (base-initrd file-systems
QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd.
The initrd is automatically populated with all the kernel modules necessary
-for FILE-SYSTEMS and for the given options. Additional kernel
-modules can be listed in LINUX-MODULES. They will be added to the initrd, and
-loaded at boot time in the order in which they appear."
+for FILE-SYSTEMS and for the given options. Additional kernel modules can be
+listed in LINUX-MODULES. Additional directories for modules can be listed in
+LINUX-EXTRA-MODULE-DIRECTORIES. They will be added to the initrd, and loaded
+at boot time in the order in which they appear."
(define linux-modules*
;; Modules added to the initrd and loaded from the initrd.
`(,@linux-modules
@@ -408,6 +422,7 @@ (define* (base-initrd file-systems
(raw-initrd file-systems
#:linux linux
#:linux-modules linux-modules*
+ #:linux-extra-module-directories linux-extra-module-directories
#:mapped-devices mapped-devices
#:helper-packages helper-packages
#:keyboard-layout keyboard-layout
--
2.36.1
Brian Cully wrote 3 years ago
[PATCH v3 2/2] doc: ‘initrd-modules’ will search ‘kernel-loadable-modules’.
(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@spork.org)
65cf1060a7ce60b1b91a25f809af6264abdcfa59.1655579477.git.bjc@spork.org
---
doc/guix.texi | 13 +++++++++++++
1 file changed, 13 insertions(+)

Toggle diff (26 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index eda0956260..d97909695f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -36461,6 +36461,19 @@ Initial RAM Disk
(initrd-modules (cons "megaraid_sas" %base-initrd-modules)))
@end lisp
+If a module listed in @code{initrd-modules} is not included in the
+Linux-libre kernel, then the location to it must be added to the
+@code{kernel-loadable-modules} list. For example, if your root file
+system exists on a ZFS pool, then your configuration might look like the
+following:
+
+@lisp
+(operating-system
+ ;; @dots{}
+ (initrd-modules (cons "zfs" %base-initrd-modules))
+ (kernel-loadable-modules (list (list zfs "module"))))
+@end lisp
+
@defvr {Scheme Variable} %base-initrd-modules
This is the list of kernel modules included in the initrd by default.
@end defvr
--
2.36.1
Maxime Devos wrote 3 years ago
Re: [bug#55231] [PATCH v3 2/2] doc: ‘initrd-modules’ will search ‘kernel-loadable-modules’.
(name . Brian Cully)(address . bjc@spork.org)(address . 55231@debbugs.gnu.org)
d9e2175bb610845bc2ab662eaff69d439e03f1a1.camel@telenet.be
Brian Cully via Guix-patches via schreef op za 18-06-2022 om 15:11 [-
0400]:
Toggle quote (13 lines)
> +If a module listed in @code{initrd-modules} is not included in the
> +Linux-libre kernel, then the location to it must be added to the
> +@code{kernel-loadable-modules} list.  For example, if your root file
> +system exists on a ZFS pool, then your configuration might look like the
> +following:
> +
> +@lisp
> +(operating-system
> +  ;; @dots{}
> +  (initrd-modules (cons "zfs" %base-initrd-modules))
> +  (kernel-loadable-modules (list (list zfs "module"))))
> +@end lisp

As written previously, this is not a good example, because:

Toggle quote (15 lines)
> As-is, I don't think this is a good example, because
> 'expression->initrd' does not set #:substitutable? #false,
> the 'zfs' package has the comment (*)
>
> `(;; The ZFS kernel module should not be downloaded since the
> license
> ;; terms don't allow for distributing it, only building it
> locally.
> #:substitutable? #f [...])
>
> and IIUC, the code inside expression->initrd copies the kernel module
> into the new store item, so it looks like this accidentally suggest
> people to commit copyvios, and copyvios are currently against the
> law.

and because the defense for not considering the ZFS license to be a
problem consists of the ZFS module not being distributed in binary
form, whereas this suggestion would in some situations cause it to be
distributed in binary form.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYq427RccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7vuRAP93e+IazsNTgVuVDhMRelp9dHd9
9osZoFuZBA8dInijdAEAscxvbiaqTecbAuzG+bVfZ7Vf5XaiqqzlGlCl7lHS7wM=
=gS+J
-----END PGP SIGNATURE-----


Brian Cully wrote 3 years ago
Re: [bug#55231] [PATCH v3 2/2] doc: ‘initrd-mod ules’ will search ‘kernel-loadable-modules’.
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 55231@debbugs.gnu.org)
87czf566hu.fsf@ditto.jhoto.spork.org
Toggle quote (8 lines)
> and because the defense for not considering the ZFS license to
> be a
> problem consists of the ZFS module not being distributed in
> binary
> form, whereas this suggestion would in some situations cause it
> to be
> distributed in binary form.

If you have another example, I'll put it in instead. I used this
one, because I know this one works, and that's all.

That said, I'm not sure how this would cause the module to be
distributed as a binary. In order for it to be added to the
initrd, it will still need to built using the DKMS mechanism, and
thus compiled on (or at least for) the target Guix installation.

If the complaint is that one could generate a USB stick, or some
such, with ZFS in the initrd, then yes, that's possible. But
that's also possible by using the existing
‘kernel-loadable-modules’ mechanism to generate an image with
‘guix system image’ and distributing that. I don't think it's our
job to try and prevent such things, since, even if desirable, it's
not really feasible.

If the complaint is merely that it's in the documentation, then
ok, I'll change it to whatever module you want.

-bjc
Maxime Devos wrote 3 years ago
Re: [bug#55231] [PATCH v3 2/2] doc: ‘initrd-modules’ will search ‘kernel-loadable-modules’.
(name . Brian Cully)(address . bjc@spork.org)(address . 55231@debbugs.gnu.org)
45da2e782470b7bc69fd3014a8c9ced154a58e49.camel@telenet.be
Brian Cully schreef op za 18-06-2022 om 16:43 [-0400]:
Toggle quote (3 lines)
> That said, I'm not sure how this would cause the module to be
> distributed as a binary. [...]

Because #:substitutable? isn't set appropriately in dependents,
substitute servers exist, ZFS can be used on substitute servers and
someone using the substitute server might have a sufficiently similar
system configuration to do substitution of a store item containing a
copy of the ZFS binary.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYq5TBRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7hp7AQCihs5fFUXl54bTaZgaSYFETXaw
UNZbSrcVKTEp4xPvpAD/T1Xx/Un/AzQKpEh3zZvofBsPncHBsb9ASaA6PfhkNAw=
=POZ3
-----END PGP SIGNATURE-----


Brian Cully wrote 3 years ago
Re: [bug#55231] [PATCH v3 2/2] doc: ‘initrd-mod ules’ will search ‘kernel-loadable-modules’.
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 55231@debbugs.gnu.org)
878rpt5zmq.fsf@ditto.jhoto.spork.org
Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (9 lines)
> Because #:substitutable? isn't set appropriately in dependents,
> substitute servers exist, ZFS can be used on substitute servers
> and
> someone using the substitute server might have a sufficiently
> similar
> system configuration to do substitution of a store item
> containing a
> copy of the ZFS binary.

So, simply using ZFS in ‘kernel-loadable-modules’ would be enough
to trigger this misbehavior? That sounds like a pretty serious
issue. Would it be possible to have the substitute servers filter
on the #:substitutable flag?

This is getting out of scope, though. I don't really want this
patch to go in without /some/ documentation regarding how modules
get looked up, so if anyone has an alternate module and use-case,
I'll just swap it in for the ZFS one.

-bjc
Maxime Devos wrote 3 years ago
Re: [bug#55231] [PATCH v3 2/2] doc: ‘initrd-modules’ will search ‘kernel-loadable-modules’.
(name . Brian Cully)(address . bjc@spork.org)(address . 55231@debbugs.gnu.org)
23328359aaef00b461b27e46b5e716655a8ff015.camel@telenet.be
Brian Cully schreef op za 18-06-2022 om 19:11 [-0400]:
Toggle quote (5 lines)
> So, simply using ZFS in ‘kernel-loadable-modules’ would be enough
> to trigger this misbehavior? That sounds like a pretty serious
> issue. Would it be possible to have the substitute servers filter
> on the #:substitutable flag?

That's exactly what the #:substitutable flag is for (IIUC)!
However, the problem is that currently, that flag isn't set for
derivations that make a copy of the ZFS module. As I wrote previously:

Toggle quote (8 lines)
> > and IIUC, the code inside expression->initrd copies the kernel
> > module into the new store item,

> This is getting out of scope, though. I don't really want this
> patch to go in without /some/ documentation regarding how modules
> get looked up, so if anyone has an alternate module and use-case,
> I'll just swap it in for the ZFS one.

I don't have any.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYq8RHhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ryiAQCxJDyPWK8uOhO8EAe6QkxQ4VVJ
5x6qwjNw/pYnZctswQD/TqLj9GzZ0VfrT1S4sot56loPrdZ0aBiehxkpKBhOBw8=
=a5R3
-----END PGP SIGNATURE-----


Kaelyn wrote 3 years ago
Re: [bug#55231][PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
62rRCnWUAiOvJIODcOCnx0Vw7EUYR3YHxLrkEfMBUHjURBOWn_JfZf76LODMt2W8syVn0hnIaeU4ysQ-kfi5-4X3wyM7oGTnOO4t2JPwRzY=@protonmail.com
Hi again,

Regarding the documentation example, one (contrived) alternative is:

"""
For example, if you need the driver for a Realtek RTL8821CE wireless network adapter for mounting the root filesystem over NFS, your configuration might include the following:

@lisp
(operating-system
;; @dots{}
(initrd-modules (cons "8821ce" %base-initrd-modules))
(kernel-loadable-modules (list (list rtl8821ce-linux-module "module"))))
@end lisp
"""

While I don't have the hardware, I did verify the kernel module name by building the rtl8821ce-linux-module package.

Cheers,
Kaelyn
Brian Cully wrote 3 years ago
[PATCH v4 1/2] Allows copying of out-of-tree modules to the Linux initrd.
(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@spork.org)
10a6842d1a6bde797d82d6b8107660bedce8b956.1656077306.git.bjc@spork.org
With this patch, modules for ‘initrd-modules’ will not only be searched for in
the in-tree Linux modules, but also any additional modules specified in
‘kernel-loadable-modules’.

* gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument to
DIRECTORIES. Now takes a list of directories to search, rather than a single
one.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
argument to PACKAGES. Now contains a list of file-likes to search for modules.
(raw-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (flat-linux-module-directory) along with the selected LINUX package.
(base-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (raw-initrd).
* gnu/system.scm (operating-system-initrd-file): pass in operating system
definition's kernel-loadable-modules into (make-initrd) as
LINUX-EXTRA-MODULE-DIRECTORIES.
---
gnu/build/linux-modules.scm | 19 ++++++++------
gnu/system.scm | 2 ++
gnu/system/linux-initrd.scm | 49 ++++++++++++++++++++++++-------------
3 files changed, 45 insertions(+), 25 deletions(-)

Toggle diff (171 lines)
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 053720574b..97b7e429ea 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -225,8 +225,8 @@ (define (file-name->module-name file)
'.ko[.gz|.xz]' and normalizing it."
(normalize-module-name (strip-extension (basename file))))
-(define (find-module-file directory module)
- "Lookup module NAME under DIRECTORY, and return its absolute file name.
+(define (find-module-file directories module)
+ "Lookup module NAME under DIRECTORIES, and return its absolute file name.
NAME can be a file name with or without '.ko', or it can be a module name.
Raise an error if it could not be found.
@@ -247,16 +247,19 @@ (define (find-module-file directory module)
(else chr)))
module))))
- (match (find-files directory
- (lambda (file stat)
- (member (strip-extension
- (basename file)) names)))
+ (match (append-map (lambda (directory)
+ (find-files directory
+ (lambda (file _stat)
+ (member (strip-extension
+ (basename file))
+ names))))
+ directories)
((file)
file)
(()
- (error "kernel module not found" module directory))
+ (error "kernel module not found" module directories))
((_ ...)
- (error "several modules by that name" module directory))))
+ (error "several modules by that name" module directories))))
(define* (recursive-module-dependencies files
#:key (lookup-module dot-ko))
diff --git a/gnu/system.scm b/gnu/system.scm
index ba1b7b5152..2439560671 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1313,6 +1313,8 @@ (define (operating-system-initrd-file os)
#:linux (operating-system-kernel os)
#:linux-modules
(operating-system-initrd-modules os)
+ #:linux-extra-module-directories
+ (operating-system-kernel-loadable-modules os)
#:mapped-devices mapped-devices
#:keyboard-layout (operating-system-keyboard-layout os)))
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 4c4c78e444..f6e8f75efa 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -119,13 +119,20 @@ (define* (expression->initrd exp
`(#:references-graphs (("closure" ,init))))
"/initrd.cpio.gz"))
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory packages modules)
"Return a flat directory containing the Linux kernel modules listed in
-MODULES and taken from LINUX."
+MODULES and taken from PACKAGES."
(define imported-modules
(source-module-closure '((gnu build linux-modules)
(guix build utils))))
+ (define package-inputs
+ (map (lambda (p)
+ (match p
+ ((p o) (gexp-input p o))
+ (p (gexp-input p "out"))))
+ packages))
+
(define build-exp
(with-imported-modules imported-modules
(with-extensions (list guile-zlib)
@@ -135,11 +142,12 @@ (define (flat-linux-module-directory linux modules)
(srfi srfi-1)
(srfi srfi-26))
- (define module-dir
- (string-append #$linux "/lib/modules"))
+ (define module-dirs
+ (map (cut string-append <> "/lib/modules")
+ '#$package-inputs))
(define modules
- (let* ((lookup (cut find-module-file module-dir <>))
+ (let* ((lookup (cut find-module-file module-dirs <>))
(modules (map lookup '#$modules)))
(append modules
(recursive-module-dependencies
@@ -172,20 +180,23 @@ (define* (raw-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(mapped-devices '())
(keyboard-layout #f)
(helper-packages '())
qemu-networking?
volatile-root?
(on-error 'debug))
- "Return as a file-like object a raw initrd, with kernel
-modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via 'root'. LINUX-MODULES is a list of kernel
-modules to be loaded at boot time. MAPPED-DEVICES is a list of device
-mappings to realize before FILE-SYSTEMS are mounted.
-HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include
-e2fsck/static or other packages needed by the initrd to check root partition.
+ "Return as a file-like object a raw initrd, with kernel modules taken from
+LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd,
+possibly in addition to the root file system specified on the kernel command
+line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at
+boot time. LINUX-EXTRA-MODULE-DIRECTORIES is a list of file-like objects which
+will be searched for modules in addition to the linux kernel. MAPPED-DEVICES
+is a list of device mappings to realize before FILE-SYSTEMS are mounted.
+HELPER-PACKAGES is a list of packages to be copied in the initrd. It may
+include e2fsck/static or other packages needed by the initrd to check root
+partition.
When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desired
console keyboard layout. This is done before MAPPED-DEVICES are set up and
@@ -221,7 +232,8 @@ (define* (raw-initrd file-systems
#~())))
(define kodir
- (flat-linux-module-directory linux linux-modules))
+ (flat-linux-module-directory (cons linux linux-extra-module-directories)
+ linux-modules))
(expression->initrd
(with-imported-modules (source-module-closure
@@ -366,6 +378,7 @@ (define* (base-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(mapped-devices '())
(keyboard-layout #f)
qemu-networking?
@@ -386,9 +399,10 @@ (define* (base-initrd file-systems
QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd.
The initrd is automatically populated with all the kernel modules necessary
-for FILE-SYSTEMS and for the given options. Additional kernel
-modules can be listed in LINUX-MODULES. They will be added to the initrd, and
-loaded at boot time in the order in which they appear."
+for FILE-SYSTEMS and for the given options. Additional kernel modules can be
+listed in LINUX-MODULES. Additional directories for modules can be listed in
+LINUX-EXTRA-MODULE-DIRECTORIES. They will be added to the initrd, and loaded
+at boot time in the order in which they appear."
(define linux-modules*
;; Modules added to the initrd and loaded from the initrd.
`(,@linux-modules
@@ -408,6 +422,7 @@ (define* (base-initrd file-systems
(raw-initrd file-systems
#:linux linux
#:linux-modules linux-modules*
+ #:linux-extra-module-directories linux-extra-module-directories
#:mapped-devices mapped-devices
#:helper-packages helper-packages
#:keyboard-layout keyboard-layout
--
2.36.1
Brian Cully wrote 3 years ago
[PATCH v4 2/2] doc: ‘initrd-modules’ will search ‘kernel-loadable-modules’.
(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@spork.org)
decfa9ca4ff55b14673e7b1013ceac4cb3bf9371.1656077306.git.bjc@spork.org
---
doc/guix.texi | 15 +++++++++++++++
1 file changed, 15 insertions(+)

Toggle diff (28 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index eda0956260..7c4682a76d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -36461,6 +36461,21 @@ Initial RAM Disk
(initrd-modules (cons "megaraid_sas" %base-initrd-modules)))
@end lisp
+If a module listed in @code{initrd-modules} is not included in the
+Linux-libre kernel, then the location to it must be added to the
+@code{kernel-loadable-modules} list.
+
+For example, if you need the driver for a Realtek RTL8821CE wireless
+network adapter for mounting the root filesystem over NFS, your
+configuration might include the following:
+
+@lisp
+(operating-system
+ ;; @dots{}
+ (initrd-modules (cons "8821ce" %base-initrd-modules))
+ (kernel-loadable-modules (list (list rtl8821ce-linux-module "module"))))
+@end lisp
+
@defvr {Scheme Variable} %base-initrd-modules
This is the list of kernel modules included in the initrd by default.
@end defvr
--
2.36.1
Kaelyn wrote 10 months ago
Re: [bug#55231][PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
1tDxflmRvH9dG_XKzC_f96MeCAhzXoO3N5eKXVzaG01-pUYy2LKGjpKh6AgtQgMEQgggJKgJ_pZylYEQWZxbYFQ0kiCh4VAU4BxGOeXr4Zk=@protonmail.com
Hi,

I just want to say that the latest v4 of the patches look good to me, and has removed the example with the questionable licensing situation. I have also been using this patch quite successfully, in a slightly modified version (mostly module name changes) imported into a local channel, for almost 2 years now.

Also, if needed, I would be happy to rebase the patches against the current master.

Cheers,
Kaelyn
Morgan Arnold wrote 1 months ago
[PATCH 1/2] Allows copying of out-of-tree modules to the Linux initrd.
(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@spork.org)
20250205220421.23774-1-morgan.arnold@proton.me
From: Brian Cully <bjc@spork.org>

With this patch, modules for ‘initrd-modules’ will not only be searched for in
the in-tree Linux modules, but also any additional modules specified in
‘kernel-loadable-modules’.

* gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument to
DIRECTORIES. Now takes a list of directories to search, rather than a single
one.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
argument to PACKAGES. Now contains a list of file-likes to search for modules.
(raw-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (flat-linux-module-directory) along with the selected LINUX package.
(base-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (raw-initrd).
* gnu/system.scm (operating-system-initrd-file): pass in operating system
definition's kernel-loadable-modules into (make-initrd) as
LINUX-EXTRA-MODULE-DIRECTORIES.
---
gnu/build/linux-modules.scm | 19 ++++++++------
gnu/system.scm | 2 ++
gnu/system/linux-initrd.scm | 50 ++++++++++++++++++++++++-------------
3 files changed, 45 insertions(+), 26 deletions(-)

Toggle diff (178 lines)
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 32baf6c525..b47bce9ab2 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -246,8 +246,8 @@ (define (file-name->module-name file)
'.ko[.gz|.xz|.zst]' and normalizing it."
(normalize-module-name (strip-extension (basename file))))
-(define (find-module-file directory module)
- "Lookup module NAME under DIRECTORY, and return its absolute file name.
+(define (find-module-file directories module)
+ "Lookup module NAME under DIRECTORIES, and return its absolute file name.
NAME can be a file name with or without '.ko', or it can be a module name.
Raise an error if it could not be found.
@@ -268,16 +268,19 @@ (define names
(else chr)))
module))))
- (match (find-files directory
- (lambda (file stat)
- (member (strip-extension
- (basename file)) names)))
+ (match (append-map (lambda (directory)
+ (find-files directory
+ (lambda (file _stat)
+ (member (strip-extension
+ (basename file))
+ names))))
+ directories)
((file)
file)
(()
- (error "kernel module not found" module directory))
+ (error "kernel module not found" module directories))
((_ ...)
- (error "several modules by that name" module directory))))
+ (error "several modules by that name" module directories))))
(define* (recursive-module-dependencies files
#:key (lookup-module dot-ko))
diff --git a/gnu/system.scm b/gnu/system.scm
index 8df871f255..1921b60c25 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1373,6 +1373,8 @@ (define make-initrd
#:linux (operating-system-kernel os)
#:linux-modules
(operating-system-initrd-modules os)
+ #:linux-extra-module-directories
+ (operating-system-kernel-loadable-modules os)
#:mapped-devices mapped-devices
#:keyboard-layout (operating-system-keyboard-layout os)))
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index dc08edc791..dab40dfe22 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -120,13 +120,20 @@ (define builder
`(#:references-graphs (("closure" ,init))))
"/initrd.cpio.gz"))
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory packages modules)
"Return a flat directory containing the Linux kernel modules listed in
-MODULES and taken from LINUX."
+MODULES and taken from PACKAGES."
(define imported-modules
(source-module-closure '((gnu build linux-modules)
(guix build utils))))
+ (define package-inputs
+ (map (lambda (p)
+ (match p
+ ((p o) (gexp-input p o))
+ (p (gexp-input p "out"))))
+ packages))
+
(define build-exp
(with-imported-modules imported-modules
(with-extensions (list guile-zlib guile-zstd)
@@ -138,8 +145,9 @@ (define build-exp
(srfi srfi-26)
(ice-9 match))
- (define module-dir
- (string-append #$linux "/lib/modules"))
+ (define module-dirs
+ (map (cut string-append <> "/lib/modules")
+ '#$package-inputs))
(define builtin-modules
(match (find-files module-dir (lambda (file stat)
@@ -157,7 +165,7 @@ (define modules-to-lookup
(lset-difference string=? '#$modules builtin-modules))
(define modules
- (let* ((lookup (cut find-module-file module-dir <>))
+ (let* ((lookup (cut find-module-file module-dirs <>))
(modules (map lookup modules-to-lookup)))
(append modules
(recursive-module-dependencies
@@ -192,6 +200,7 @@ (define* (raw-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(pre-mount #t)
(mapped-devices '())
(keyboard-layout #f)
@@ -199,15 +208,16 @@ (define* (raw-initrd file-systems
qemu-networking?
volatile-root?
(on-error 'debug))
- "Return as a file-like object a raw initrd, with kernel
-modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via 'root'. LINUX-MODULES is a list of kernel
-modules to be loaded at boot time. MAPPED-DEVICES is a list of device
-mappings to realize before FILE-SYSTEMS are mounted. PRE-MOUNT is a
-G-expression to evaluate before realizing MAPPED-DEVICES.
-HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include
-e2fsck/static or other packages needed by the initrd to check root partition.
+ "Return as a file-like object a raw initrd, with kernel modules taken from
+LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd,
+possibly in addition to the root file system specified on the kernel command
+line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at
+boot time. LINUX-EXTRA-MODULE-DIRECTORIES is a list of file-like objects which
+will be searched for modules in addition to the linux kernel. MAPPED-DEVICES
+is a list of device mappings to realize before FILE-SYSTEMS are mounted.
+HELPER-PACKAGES is a list of packages to be copied in the initrd. It may
+include e2fsck/static or other packages needed by the initrd to check root
+partition.
When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desired
console keyboard layout. This is done before MAPPED-DEVICES are set up and
@@ -243,7 +253,8 @@ (define file-system-scan-commands
#~())))
(define kodir
- (flat-linux-module-directory linux linux-modules))
+ (flat-linux-module-directory (cons linux linux-extra-module-directories)
+ linux-modules))
(expression->initrd
(with-imported-modules (source-module-closure
@@ -390,6 +401,7 @@ (define* (base-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(mapped-devices '())
(keyboard-layout #f)
qemu-networking?
@@ -410,9 +422,10 @@ (define* (base-initrd file-systems
QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd.
The initrd is automatically populated with all the kernel modules necessary
-for FILE-SYSTEMS and for the given options. Additional kernel
-modules can be listed in LINUX-MODULES. They will be added to the initrd, and
-loaded at boot time in the order in which they appear."
+for FILE-SYSTEMS and for the given options. Additional kernel modules can be
+listed in LINUX-MODULES. Additional directories for modules can be listed in
+LINUX-EXTRA-MODULE-DIRECTORIES. They will be added to the initrd, and loaded
+at boot time in the order in which they appear."
(define linux-modules*
;; Modules added to the initrd and loaded from the initrd.
`(,@linux-modules
@@ -432,6 +445,7 @@ (define helper-packages
(raw-initrd file-systems
#:linux linux
#:linux-modules linux-modules*
+ #:linux-extra-module-directories linux-extra-module-directories
#:mapped-devices mapped-devices
#:helper-packages helper-packages
#:keyboard-layout keyboard-layout
--
2.47.1
Morgan Arnold wrote 1 months ago
[PATCH 2/2] doc: ‘initrd-modules’ will search ‘kernel-loadable-modules’.
(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@spork.org)
20250205220421.23774-2-morgan.arnold@proton.me
From: Brian Cully <bjc@spork.org>

---
doc/guix.texi | 15 +++++++++++++++
1 file changed, 15 insertions(+)

Toggle diff (28 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index bb5f29277f..2ca8bbda51 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43252,6 +43252,21 @@ file system, you would write:
(initrd-modules (cons "megaraid_sas" %base-initrd-modules)))
@end lisp
+If a module listed in @code{initrd-modules} is not included in the
+Linux-libre kernel, then the location to it must be added to the
+@code{kernel-loadable-modules} list.
+
+For example, if you need the driver for a Realtek RTL8821CE wireless
+network adapter for mounting the root filesystem over NFS, your
+configuration might include the following:
+
+@lisp
+(operating-system
+ ;; @dots{}
+ (initrd-modules (cons "8821ce" %base-initrd-modules))
+ (kernel-loadable-modules (list (list rtl8821ce-linux-module "module"))))
+@end lisp
+
@defvar %base-initrd-modules
This is the list of kernel modules included in the initrd by default.
@end defvar
--
2.47.1
Morgan Arnold wrote 1 months ago
[PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
6Uxo8QbXiUMWqlYZwxpdOYroHPEageNgoo-EJQSgpT4CvfjIq_k-noKrQDBM39x_FqCs9KVh1oZcjR1ns3sfP9TDJe_Y-mkMiZ3NixHyFp8=@proton.me
I've made a (hopefully acceptable) attempt to rebase the patches on the newest master of the Guix repo. If there's anything preventing these patches from being merged, please let me know.

Best,

Morgan
Ian Eure wrote 1 months ago
Re: Understanding #:substitutable? and #55231
(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55231@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
87a5awylhy.fsf@retrospec.tv
Hi Morgan,

Morgan Arnold via "Development of GNU Guix and the GNU System
distribution." <guix-devel@gnu.org> writes:

Toggle quote (10 lines)
> Hello,
>
> If the issue is simply that the patch has not been rebased
> against a
> new enough version of Guix to be merged, I am happy to do that
> rebasing. Additionally, please correct me if I have made any
> incorrect
> assertions above.
>

It does seem that #55231 ended up in a place where there was
concensus that it was acceptable, but didn’t get merged for some
reason or other. I definitely could be wrong, but I suspect the
issue is that when non-#:substitutable? packages are used in
places other than package inputs, the downstream derivations don’t
carry that information. I believe when used as a package input,
non-#:substitutable? packages do, in fact, poison all downstream
derivations. Happy to be corrected if I’m wrong here.

I think it’s reasonable to merge this after it’s rebased on
current master, and would be willing to do that unless Maxime or
Ludo’ raise an objection.

However, you resent a v1 patch to a bug where four versions has
already been sent. If you’d be willing to resend as v5 (with `git
format-patch -v5 -2'), I can get it pushed.

Thanks,

-- Ian
Maxime Devos wrote 1 months ago
(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55231@debbugs.gnu.org)
58533ecf-607f-4a41-a94f-c232a26c46f5@telenet.be
On 9/02/2025 2:06, Ian Eure wrote:

Toggle quote (12 lines)
> Hi Morgan,
>
> Morgan Arnold via "Development of GNU Guix and the GNU System
> distribution." <guix-devel@gnu.org> writes:
>
>> Hello,
>>
>> If the issue is simply that the patch has not been rebased against a
>> new enough version of Guix to be merged, I am happy to do that
>> rebasing. Additionally, please correct me if I have made any incorrect
>> assertions above.

No. See the stuff about #:substitutable?. The reason I didn't answer
back then, is that I don't want to keep being a broken record.

If 'make-linux-libre' in the presence of ZFS leads to #:subsitutable?
problems, that doesn't mean it's fine to ignore the law for #52231. It
means you need to:

 (a) remove ZFS
 (b) or adjust 'make-linux-libre' (whether code or documentation,
preferably code) to do the #:substitutable? thing

More generally, legality > convenience (except in case of revolution,
but that's not applicable to Guix, and it seems inadvisable to talk
about such matters in the open).

More specifically, ZFS proponents (at least as a group, and when limited
to those visible in Guix) tend to be rather incoherent in their
positions, in the sense that simultaneously do:

 (1) consider GPL and ZFS license to be compatible,
 (2) with caveat about "no binary distributions"  (legal restriction)
 (3) want to get ZFS in a distribution
 (4) their method to get ZFS in the distribution doesn't address point (2)
 (5) and they refuse to fix the legal issue (4) when pointed out to
them, with as reason:
 (5a) previous versions of Guix already violate restriction (2)
 (5b) it's technically slightly inconvenient

Like, (5a) just makes things _worse_ (as now would be _knowingly_  in
violation of the law, and the duration of the violation increases) and
(5b) is utterly irrelevant to the law - Guix is subject to the law, not
the other way around.

And pointing this out to them doesn't seem to ever work.

It has been some time ago, but I probably suspected it wouldn't work in
this case either.

Toggle quote (9 lines)
> It does seem that #55231 ended up in a place where there was concensus
> that it was acceptable, but didn’t get merged for some reason or
> other.  I definitely could be wrong, but I suspect the issue is that
> when non-#:substitutable? packages are used in places other than
> package inputs, the downstream derivations don’t carry that
> information.  I believe when used as a package input,
> non-#:substitutable? packages do, in fact, poison all downstream
> derivations.  Happy to be corrected if I’m wrong here.

Not quite - to my understanding, the downstream derivations _also_ don't
carry that information when it's in package inputs (at least, last time
I checked there didn't seem to be any mechanism to set #:substitutable?
to #false when any of the inputs are unsubstitutable (whether non-bag(?)
derivation inputs, implicit inputs, native-inputs, ...)).

For packages, in typical situations the #:substitutable? #false of any
'native-inputs' of a package shouldn't impact the substitutability of
the package. For 'inputs', it rather depends (e.g. static/dynamic, the
particulars of the license, is it because of license reasons or
something else). Since it somewhat depends on the situation, if you
implement a thing like this, I would recommend making it a _default_ for
#:substitutable?(*), that can be overridden by some method.

Toggle quote (4 lines)
> I think it’s reasonable to merge this after it’s rebased on current
> master, and would be willing to do that unless Maxime or Ludo’ raise
> an objection.

First you say you suspect the issue is that #:substitutable?-related
behaviour isn't right yet, and immediately in the next paragraph you say
it's reasonable to merge it. Given that the patches haven't been
adjusted to solve this, this is rather incongruent.

I already raised the objection several times in the past (including
_before_ #55231), and none of the patch revisions attempted to deal with
the objection.  Issues don't simply magically resolve themselves. I
believe you can infer whether I would object to the current state of
#55231 or not.

Regards,
Maxime Devos
Kaelyn wrote 1 months ago
(name . Maxime Devos)(address . maximedevos@telenet.be)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55231@debbugs.gnu.org)(name . Ian Eure)(address . ian@retrospec.tv)
_vvV6oht3R-W5PqRtwQhRBDb8q-O40J39F7fnTG3JLHVXOujpZdQ4s-G85O27ErbFokl95RtkiUBXlE8pLJVFsnN6-ANPTMGK4Vq0iBUP_I=@protonmail.com
Hi,

On Sunday, February 9th, 2025 at 9:11 AM, Maxime Devos <maximedevos@telenet.be> wrote:

Toggle quote (51 lines)
>
>
> On 9/02/2025 2:06, Ian Eure wrote:
>
> > Hi Morgan,
> >
> > Morgan Arnold via "Development of GNU Guix and the GNU System
> > distribution." guix-devel@gnu.org writes:
> >
> > > Hello,
> > >
> > > If the issue is simply that the patch has not been rebased against a
> > > new enough version of Guix to be merged, I am happy to do that
> > > rebasing. Additionally, please correct me if I have made any incorrect
> > > assertions above.
>
>
> No. See the stuff about #:substitutable?. The reason I didn't answer
> back then, is that I don't want to keep being a broken record.
>
> If 'make-linux-libre' in the presence of ZFS leads to #:subsitutable?
> problems, that doesn't mean it's fine to ignore the law for #52231. It
> means you need to:
>
> (a) remove ZFS
> (b) or adjust 'make-linux-libre' (whether code or documentation,
> preferably code) to do the #:substitutable? thing
>
> More generally, legality > convenience (except in case of revolution,
>
> but that's not applicable to Guix, and it seems inadvisable to talk
> about such matters in the open).

> More specifically, ZFS proponents (at least as a group, and when limited
> to those visible in Guix) tend to be rather incoherent in their
> positions, in the sense that simultaneously do:
>
> (1) consider GPL and ZFS license to be compatible,
> (2) with caveat about "no binary distributions" (legal restriction)
> (3) want to get ZFS in a distribution
> (4) their method to get ZFS in the distribution doesn't address point (2)
> (5) and they refuse to fix the legal issue (4) when pointed out to
> them, with as reason:
> (5a) previous versions of Guix already violate restriction (2)
> (5b) it's technically slightly inconvenient
>
> Like, (5a) just makes things worse (as now would be knowingly in
> violation of the law, and the duration of the violation increases) and
> (5b) is utterly irrelevant to the law - Guix is subject to the law, not
> the other way around.

While I do not wish to chime in on either side at this time as I am most definitely not a lawyer, I want to share a few references and the result of a bit of recent research. As far as I can tell (as a layman), the legality of distributing a binary ZFS module is currently a matter of differing opinions, and a bit of searching has not revealed case precedent for deciding the matter. The closest to that which I found was a lawsuit against VMware in Germany over vmklinux within vSpere, which was dismissed on procedural grounds and for which VMware voluntarily announced the removal of vmklinux (https://sfconservancy.org/news/2019/apr/02/vmware-no-appeal/).

Regarding distributing ZFS, Ubuntu and their legal team concluded about 9 years ago that they can distribute ZFS kernel modules and still comply with both licenses. I also did not find mention of Ubuntu reversing their decision, or of legal issues around ZFS that have arisen for them in that time period. Again, I want to emphasize that IANAL and that there is not a clear decision on the legality of such distribution.

Here are a few useful links I found, both for and against ZFS binary distribution:

Toggle quote (5 lines)
> And pointing this out to them doesn't seem to ever work.
>
> It has been some time ago, but I probably suspected it wouldn't work in
> this case either.

Not to be offensive, but I find these statements to be very dismissive of those who disagree with you about ZFS distribution as well as both their reasoning for their position and their openness to differing viewpoints or new information.

As an aside, I can and do accept that the Guix maintainers hold the view that distributing binary ZFS modules is a license violation, and that they have rejected the patches in issue #55231 on the basis it could inadvertently allow for official substitutes to be made available containing a binary zfs.ko or spl.ko. I have worked around the absence in a satisfactory way for my needs by overriding much of the initrd generation within my local channel to effectively integrate #55231 there. However, responses like the one above (as well as some of the general sentiments raised in this email thread) have largely discouraged me from contributing to Guix aside from the occasional package bump or bug fix. Basically, I no longer have any opinion on the fate of the patches in #55231 or on how Guix wishes to deal with ZFS (and despite no discouraging responses on the issue, there's a good chance I won't find the motivation again to follow up on the single reply to https://issues.guix.gnu.org/71482,given the community attitudes I've observed regarding matters touching on ZFS).

Regards,
Kaelyn

Toggle quote (42 lines)
> > It does seem that #55231 ended up in a place where there was concensus
> > that it was acceptable, but didn’t get merged for some reason or
> > other. I definitely could be wrong, but I suspect the issue is that
> > when non-#:substitutable? packages are used in places other than
> > package inputs, the downstream derivations don’t carry that
> > information. I believe when used as a package input,
> > non-#:substitutable? packages do, in fact, poison all downstream
> > derivations. Happy to be corrected if I’m wrong here.
>
>
> Not quite - to my understanding, the downstream derivations also don't
> carry that information when it's in package inputs (at least, last time
> I checked there didn't seem to be any mechanism to set #:substitutable?
> to #false when any of the inputs are unsubstitutable (whether non-bag(?)
> derivation inputs, implicit inputs, native-inputs, ...)).
>
> For packages, in typical situations the #:substitutable? #false of any
> 'native-inputs' of a package shouldn't impact the substitutability of
> the package. For 'inputs', it rather depends (e.g. static/dynamic, the
> particulars of the license, is it because of license reasons or
> something else). Since it somewhat depends on the situation, if you
> implement a thing like this, I would recommend making it a default for
> #:substitutable?(*), that can be overridden by some method.
>
> > I think it’s reasonable to merge this after it’s rebased on current
> > master, and would be willing to do that unless Maxime or Ludo’ raise
> > an objection.
>
>
> First you say you suspect the issue is that #:substitutable?-related
> behaviour isn't right yet, and immediately in the next paragraph you say
> it's reasonable to merge it. Given that the patches haven't been
> adjusted to solve this, this is rather incongruent.
>
> I already raised the objection several times in the past (including
> before #55231), and none of the patch revisions attempted to deal with
> the objection. Issues don't simply magically resolve themselves. I
> believe you can infer whether I would object to the current state of
> #55231 or not.
>
> Regards,
> Maxime Devos
Ian Eure wrote 1 months ago
(name . Maxime Devos)(address . maximedevos@telenet.be)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Cou rtès)(address . ludo@gnu.org)(address . 55231@debbugs.gnu.org)
87wmdyx63a.fsf@retrospec.tv
Hi Maxime,

Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (20 lines)
> On 9/02/2025 2:06, Ian Eure wrote:
>
>> Hi Morgan,
>>
>> Morgan Arnold via "Development of GNU Guix and the GNU System
>> distribution." <guix-devel@gnu.org> writes:
>>
>>> Hello,
>>>
>>> If the issue is simply that the patch has not been rebased
>>> against a
>>> new enough version of Guix to be merged, I am happy to do that
>>> rebasing. Additionally, please correct me if I have made any
>>> incorrect
>>> assertions above.
>
> No. See the stuff about #:substitutable?. The reason I didn't
> answer
> back then, is that I don't want to keep being a broken record.

Could you help me understand the case where this becomes a
problem? Is it:

- If you have one machine with an operating-system which includes
a non-#:substitutable? out-of-tree kernel module in its initrd,
and
- A second machine with an identical initrd configuration, and
- The first machine is configured to serve substitutes, and
- The second machine uses the first as a substitute server

Then the non-#:substitutable? module would be distributed,
violating its license?

I’d also find it helpful to understand the line for specific acts
and entities in play, on a matrix of: allowing violations,
encouraging violations, or committing violations; and by
individual Guix users, or by the Guix project itself. For
example, I think the Guix project encouraging or committing a
violation is unacceptable.

I think this would help a great deal to make the bounds of the
problem clear, which is needed to solve them.


Toggle quote (6 lines)
> If 'make-linux-libre' in the presence of ZFS leads to
> #:subsitutable?
> problems, that doesn't mean it's fine to ignore the law for
> #52231. It
> means you need to:

Could you please help me understand how `make-linux-libre' is in
scope? I don’t believe any in-tree kernel modules have the
problematic license terms, so I think the issue is purely
out-of-tree stuff, whether that’s ZFS, nVidia drivers, "endpoint
protection" security systems, etc. Perhaps you meant
`make-initrd'?


Toggle quote (7 lines)
> More specifically, ZFS proponents (at least as a group, and when
> limited to those visible in Guix) tend to be rather incoherent
> in
> their positions, in the sense that simultaneously do:
>
>  (snip)

I appreciate your perspective, however, I’m more interested in
understanding the problems so they can be solved. Any help in
that area would be greatly appreciated.


Toggle quote (25 lines)
>> It does seem that #55231 ended up in a place where there was
>> concensus that it was acceptable, but didn’t get merged for
>> some
>> reason or other.  I definitely could be wrong, but I suspect
>> the
>> issue is that when non-#:substitutable? packages are used in
>> places
>> other than package inputs, the downstream derivations don’t
>> carry
>> that information.  I believe when used as a package input,
>> non-#:substitutable? packages do, in fact, poison all
>> downstream
>> derivations.  Happy to be corrected if I’m wrong here.
>
> Not quite - to my understanding, the downstream derivations
> _also_
> don't carry that information when it's in package inputs (at
> least,
> last time I checked there didn't seem to be any mechanism to set
> #:substitutable? to #false when any of the inputs are
> unsubstitutable
> (whether non-bag(?) derivation inputs, implicit inputs,
> native-inputs,
> ...)).

Ah, hmm. So these kind of violations are implictly prevented by
Guix not shipping things in combinations which would violate the
license terms?


Toggle quote (13 lines)
> For packages, in typical situations the #:substitutable? #false
> of any
> 'native-inputs' of a package shouldn't impact the
> substitutability of
> the package. For 'inputs', it rather depends
> (e.g. static/dynamic, the
> particulars of the license, is it because of license reasons or
> something else). Since it somewhat depends on the situation, if
> you
> implement a thing like this, I would recommend making it a
> _default_
> for #:substitutable?(*), that can be overridden by some method.

That’s a good suggestion, thank you.

Toggle quote (14 lines)
>> I think it’s reasonable to merge this after it’s rebased on
>> current
>> master, and would be willing to do that unless Maxime or Ludo’
>> raise
>> an objection.
>
> First you say you suspect the issue is that
> #:substitutable?-related
> behaviour isn't right yet, and immediately in the next paragraph
> you
> say it's reasonable to merge it. Given that the patches haven't
> been
> adjusted to solve this, this is rather incongruent.

While I agree that the fundamental #:substitutable? mechanism of
Guix could use improvement, I don’t believe these patches need to
wait for that work, becasue:

- This is a generic mechanism useful for any out-of-tree module
regardless of license[1].
- They won’t cause the Guix project to commit a license violation.
- They don’t encourage individuals to commit license violations.
- While they could /allow/ individuals to commit violations, many
things in Guix already do, because it’s infeasible to forbid.

To the last point:

- Right now, Guix allows a user to make a system image containing
compiled ZFS modules and distribute it.
- Guix ships DVD rippers and programs which can copy files, which
a user can commit copyright violations with.
- Guix ships numerous programs for file sharing, whose /primary/
purpose is committing copyright violations. The nicotine+
package is one example[1].

I am struggling to square objections to a patch whose intent and
primary use would be within the bounds of
non-binary-redistribution licenses, but which might enable an
individual to (most likely inadvertently) commit a license
violation with the significantly riskier things which are already
permitted. If I’m misunderstanding the situation here, I’d
appreciate further insight.

Some examples of other modules that could be used with this
facility are:

lttng, a GPL’d out-of-tree kernel tracing system
ddcci, a GPL’d out-of-tree module for controlling monitor settings
OpenRazer, a GPL’d out-of-tree module to suppot Razer HID hardware

I’m certain there are other cases where it’d be useful.

Toggle quote (10 lines)
> I already raised the objection several times in the past
> (including
> _before_ #55231), and none of the patch revisions attempted to
> deal
> with the objection.  Issues don't simply magically resolve
> themselves. I believe you can infer whether I would object to
> the
> current state of #55231 or not.
>

I haven’t been involved in this stuff in the past and don’t use
ZFS on Guix[2]. The issue I read, which this patch is for, it
appeared that your last objection was that the documentation gave
ZFS as an example, which is the Guix project obliquely encouraging
users to commit inadvertent violations. This problem was
addressed, therefore I believed your objections were resolved. I
apologize for midunderstanding the situation.

Thanks,

-- Ian

[1]: I distinguish between things with both legitimate and
illegitimate purposes (such as BitTorrent clients), and those
whose main purpose is clearly copyright violation.
[2]: I do use ZFS on Debian, where this issue is moot.
Maxime Devos wrote 1 months ago
(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55231@debbugs.gnu.org)(name . Ian Eure)(address . ian@retrospec.tv)
6af9b9dd-313a-4eb5-92c1-2edc42bed113@telenet.be
Toggle quote (2 lines)
> [ZFS (il)legality links]

This isn't the place for that. If you believe there are some new and
correct arguments for/against compatibility, that's something for a
separate thread. Some of these are old news.

Toggle quote (6 lines)
>> And pointing this out to them doesn't seem to ever work.
>>
>> It has been some time ago, but I probably suspected it wouldn't work in
>> this case either.
> Not to be offensive, but I find these statements to be very dismissive of those who disagree with you about ZFS distribution as well as both their reasoning for their position and their openness to differing viewpoints or new information.

This is a mischaracterisation - both of what I said in the mail you are
responding to, and the reality of what happened in the ZFS discussions.

It is indeed dismissive, but the dismissiveness is not 'because I
disagree with them', it's because of:

 * their slander(*) (see: Mason Loring Bliss) (also, to a much lesser
extent, right now you - I don't think this quoting out
context+misinterpretation _technically_ counts as slander, but it's
something bad nonetheless)
 * their rudeness (see: raid5atemyhomework) (also Mason Loring Bliss,
since slander is rude)
 * their hypocrisy as a group (see: they claim it can be fine because
of non-binary distribution, but they never change Guix to _make_ the ZFS
stuff non-binary)
 * repeating _old_ information as an argument/counter-argument, even
though it has already been made and replied to, without providing more
explanation or another interpretation (see: Mason Loring Bliss. Maybe
others, but in particular I recall Mason Loring Bliss doing this).

(*) In ordinary sense, without distinguishing between exact forms of
defamation, and not evaluating whether illegal or legal.

Sometimes, being dismissive, is a perfectly reasonable response. As long
as it's for the right reasons, well-founded, and with evidence.

Also, the 'dismissiveness to [others with different viewpoint]' is the
other way around (see: previous points).

Regards,
Maxime Devos
Morgan Arnold wrote 1 months ago
(name . Ian Eure)(address . ian@retrospec.tv)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)
vJ6xu7iGiFRs_Y9H8WamQ688G7KMgD1-ryOdpgMhsii3XCjtVBCmZhYepoCwYL7aMsKZeJX9J3bCLT7KEgpN9u5qX6yOEQZH6SDZuk6SOqo=@proton.me
Hi all,

Toggle quote (9 lines)
> > If 'make-linux-libre' in the presence of ZFS leads to
> > #:subsitutable?
> > problems, that doesn't mean it's fine to ignore the law for
> > #52231. It
> > means you need to:
>
>
> Could you please help me understand how `make-linux-libre' is in scope? I don’t believe any in-tree kernel modules have the problematic license terms, so I think the issue is purely out-of-tree stuff, whether that’s ZFS, nVidia drivers, "endpoint protection" security systems, etc. Perhaps you meant` make-initrd'?

I haven't had time to read all of this and go through the legal considerations that Kaelyn linked (thanks!), but just wanted to clarify that I was the one who brought up `make-linux-libre`, probably erroneously. I think that I misunderstood `make-linux-libre` as being capable of including out-of-tree kernel modules in the kernel, so I proposed that it was subject to the same licensing concerns. This, however, seems to have been a misunderstanding of `make-linux-libre` on my part. Anyway, Maxime reasonably points out that this is effectively irrelevant to whether or not the changes proposed here ought to be included in Guix.

Toggle quote (7 lines)
> I’d also find it helpful to understand the line for specific acts
> and entities in play, on a matrix of: allowing violations,
> encouraging violations, or committing violations; and by
> individual Guix users, or by the Guix project itself. For
> example, I think the Guix project encouraging or committing a
> violation is unacceptable.

I agree that it would be helpful to clarify the matrix mentioned here, and that Guix encouraging or committing a violation is unacceptable. I further agree that Guix allowing violations is inevitable, and I fail to see how the proposed changes either encourage a violation (modulo the changes made to the documentation) or commit a violation. I am very much not a lawyer, so I may be missing the violation entirely, and am trying to get up to speed on some of the legal concerns.

Best,

Morgan

On Sunday, February 9th, 2025 at 20:37, Ian Eure <ian@retrospec.tv> wrote:

Toggle quote (196 lines)
>
>
> Hi Maxime,
>
> Maxime Devos maximedevos@telenet.be writes:
>
> > On 9/02/2025 2:06, Ian Eure wrote:
> >
> > > Hi Morgan,
> > >
> > > Morgan Arnold via "Development of GNU Guix and the GNU System
> > > distribution." guix-devel@gnu.org writes:
> > >
> > > > Hello,
> > > >
> > > > If the issue is simply that the patch has not been rebased
> > > > against a
> > > > new enough version of Guix to be merged, I am happy to do that
> > > > rebasing. Additionally, please correct me if I have made any
> > > > incorrect
> > > > assertions above.
> >
> > No. See the stuff about #:substitutable?. The reason I didn't
> > answer
> > back then, is that I don't want to keep being a broken record.
>
>
> Could you help me understand the case where this becomes a
> problem? Is it:
>
> - If you have one machine with an operating-system which includes
> a non-#:substitutable? out-of-tree kernel module in its initrd,
> and
> - A second machine with an identical initrd configuration, and
> - The first machine is configured to serve substitutes, and
> - The second machine uses the first as a substitute server
>
> Then the non-#:substitutable? module would be distributed,
> violating its license?
>
> I’d also find it helpful to understand the line for specific acts
> and entities in play, on a matrix of: allowing violations,
> encouraging violations, or committing violations; and by
> individual Guix users, or by the Guix project itself. For
> example, I think the Guix project encouraging or committing a
> violation is unacceptable.
>
> I think this would help a great deal to make the bounds of the
> problem clear, which is needed to solve them.
>
> > If 'make-linux-libre' in the presence of ZFS leads to
> > #:subsitutable?
> > problems, that doesn't mean it's fine to ignore the law for
> > #52231. It
> > means you need to:
>
>
> Could you please help me understand how `make-linux-libre' is in scope? I don’t believe any in-tree kernel modules have the problematic license terms, so I think the issue is purely out-of-tree stuff, whether that’s ZFS, nVidia drivers, "endpoint protection" security systems, etc. Perhaps you meant` make-initrd'?
>
> > More specifically, ZFS proponents (at least as a group, and when
> > limited to those visible in Guix) tend to be rather incoherent
> > in
> > their positions, in the sense that simultaneously do:
> >
> > (snip)
>
>
> I appreciate your perspective, however, I’m more interested in
> understanding the problems so they can be solved. Any help in
> that area would be greatly appreciated.
>
> > > It does seem that #55231 ended up in a place where there was
> > > concensus that it was acceptable, but didn’t get merged for
> > > some
> > > reason or other. I definitely could be wrong, but I suspect
> > > the
> > > issue is that when non-#:substitutable? packages are used in
> > > places
> > > other than package inputs, the downstream derivations don’t
> > > carry
> > > that information. I believe when used as a package input,
> > > non-#:substitutable? packages do, in fact, poison all
> > > downstream
> > > derivations. Happy to be corrected if I’m wrong here.
> >
> > Not quite - to my understanding, the downstream derivations
> > also
> > don't carry that information when it's in package inputs (at
> > least,
> > last time I checked there didn't seem to be any mechanism to set
> > #:substitutable? to #false when any of the inputs are
> > unsubstitutable
> > (whether non-bag(?) derivation inputs, implicit inputs,
> > native-inputs,
> > ...)).
>
>
> Ah, hmm. So these kind of violations are implictly prevented by
> Guix not shipping things in combinations which would violate the
> license terms?
>
> > For packages, in typical situations the #:substitutable? #false
> > of any
> > 'native-inputs' of a package shouldn't impact the
> > substitutability of
> > the package. For 'inputs', it rather depends
> > (e.g. static/dynamic, the
> > particulars of the license, is it because of license reasons or
> > something else). Since it somewhat depends on the situation, if
> > you
> > implement a thing like this, I would recommend making it a
> > default
> > for #:substitutable?(*), that can be overridden by some method.
>
>
> That’s a good suggestion, thank you.
>
> > > I think it’s reasonable to merge this after it’s rebased on
> > > current
> > > master, and would be willing to do that unless Maxime or Ludo’
> > > raise
> > > an objection.
> >
> > First you say you suspect the issue is that
> > #:substitutable?-related
> > behaviour isn't right yet, and immediately in the next paragraph
> > you
> > say it's reasonable to merge it. Given that the patches haven't
> > been
> > adjusted to solve this, this is rather incongruent.
>
>
> While I agree that the fundamental #:substitutable? mechanism of
> Guix could use improvement, I don’t believe these patches need to
> wait for that work, becasue:
>
> - This is a generic mechanism useful for any out-of-tree module
> regardless of license[1].
> - They won’t cause the Guix project to commit a license violation.
> - They don’t encourage individuals to commit license violations.
> - While they could /allow/ individuals to commit violations, many
> things in Guix already do, because it’s infeasible to forbid.
>
> To the last point:
>
> - Right now, Guix allows a user to make a system image containing
> compiled ZFS modules and distribute it.
> - Guix ships DVD rippers and programs which can copy files, which
> a user can commit copyright violations with.
> - Guix ships numerous programs for file sharing, whose /primary/
> purpose is committing copyright violations. The nicotine+
> package is one example[1].
>
> I am struggling to square objections to a patch whose intent and
> primary use would be within the bounds of
> non-binary-redistribution licenses, but which might enable an
> individual to (most likely inadvertently) commit a license
> violation with the significantly riskier things which are already
> permitted. If I’m misunderstanding the situation here, I’d
> appreciate further insight.
>
> Some examples of other modules that could be used with this
> facility are:
>
> lttng, a GPL’d out-of-tree kernel tracing system
> ddcci, a GPL’d out-of-tree module for controlling monitor settings
> OpenRazer, a GPL’d out-of-tree module to suppot Razer HID hardware
>
> I’m certain there are other cases where it’d be useful.
>
> > I already raised the objection several times in the past
> > (including
> > before #55231), and none of the patch revisions attempted to
> > deal
> > with the objection. Issues don't simply magically resolve
> > themselves. I believe you can infer whether I would object to
> > the
> > current state of #55231 or not.
>
>
> I haven’t been involved in this stuff in the past and don’t use
> ZFS on Guix[2]. The issue I read, which this patch is for, it
> appeared that your last objection was that the documentation gave
> ZFS as an example, which is the Guix project obliquely encouraging
> users to commit inadvertent violations. This problem was
> addressed, therefore I believed your objections were resolved. I
> apologize for midunderstanding the situation.
>
> Thanks,
>
> -- Ian
>
> [1]: I distinguish between things with both legitimate and
> illegitimate purposes (such as BitTorrent clients), and those
> whose main purpose is clearly copyright violation.
> [2]: I do use ZFS on Debian, where this issue is moot.
John Kehayias wrote 1 months ago
(name . Maxime Devos)(address . maximedevos@telenet.be)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(address . 55231@debbugs.gnu.org)
871pw6x4u2.fsf@protonmail.com
Hi Maxime and everyone,

(As a I hope neutral bystander that knows nothing about nor has any
particular opinions about the ZFS topic but felt it necessary for
general "good Guix community" to chime in.)

I understand tone and all of that is difficult in these communications,
and we all have differing language familiarity/interpretations. And we
can all have strong opinions. I give everyone the benefit of the doubt
here, but I do want to (very politely I hope) course correct for this to
stay a good environment for all to discuss.

On Sun, Feb 09, 2025 at 08:46 PM, Maxime Devos wrote:

[snip]

Toggle quote (5 lines)
>  * their slander(*) (see: Mason Loring Bliss) (also, to a much lesser
> extent, right now you - I don't think this quoting out
> context+misinterpretation _technically_ counts as slander, but it's
> something bad nonetheless)

This is not productive to say the least. Let's please all refrain from
such escalation. Certainly point out when you disagree or ask for
evidence in discussions, but this is taking us off track.

Toggle quote (13 lines)
>  * their rudeness (see: raid5atemyhomework) (also Mason Loring Bliss,
> since slander is rude)
>  * their hypocrisy as a group (see: they claim it can be fine because
> of non-binary distribution, but they never change Guix to _make_ the ZFS
> stuff non-binary)
>  * repeating _old_ information as an argument/counter-argument, even
> though it has already been made and replied to, without providing more
> explanation or another interpretation (see: Mason Loring Bliss. Maybe
> others, but in particular I recall Mason Loring Bliss doing this).
>
> (*) In ordinary sense, without distinguishing between exact forms of
> defamation, and not evaluating whether illegal or legal.

Also, please be mindful that these are different people in the current
thread. Many of the people from the older ZFS threads don't seem to be
active on Guix, at least publicly. In any event, please be aware this is
a wide group on guix-devel with many opinions. Let's keep from
generalizations as much as possible.

Toggle quote (8 lines)
>
> Sometimes, being dismissive, is a perfectly reasonable response. As long
> as it's for the right reasons, well-founded, and with evidence.
>
> Also, the 'dismissiveness to [others with different viewpoint]' is the
> other way around (see: previous points).
>

If one feels that they are saying the same things and it is not going
anywhere new, I would encourage them to simply let the discussion
continue without them for others that may be finding this useful and
productive towards a path forward. Previous objections have been noted
and are available in this thread and previous issue discussions.

I hope guix-devel will continue to be a great place to discuss all
things Guix, whether in strong agreement, disagreement, or anywhere in
between. Tough discussions are welcome, but please keep this from
derailing further.

Thanks,
John
Maxime Devos wrote 1 months ago
(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55231@debbugs.gnu.org)
50767bf1-572c-4d62-8839-eb085a105783@telenet.be
On 9/02/2025 20:37, Ian Eure wrote:

Toggle quote (33 lines)
> Hi Maxime,
>
> Maxime Devos <maximedevos@telenet.be> writes:
>
>> On 9/02/2025 2:06, Ian Eure wrote:
>>
>>> Hi Morgan,
>>>
>>> Morgan Arnold via "Development of GNU Guix and the GNU System
>>> distribution." <guix-devel@gnu.org> writes:
>>>
>>>> Hello,
>>>>
>>>> If the issue is simply that the patch has not been rebased against a
>>>> new enough version of Guix to be merged, I am happy to do that
>>>> rebasing. Additionally, please correct me if I have made any incorrect
>>>> assertions above.
>>
>> No. See the stuff about #:substitutable?. The reason I didn't answer
>> back then, is that I don't want to keep being a broken record.
>
> Could you help me understand the case where this becomes a problem? 
> Is it:
>
> - If you have one machine with an operating-system which includes  a
> non-#:substitutable? out-of-tree kernel module in its initrd,  and
> - A second machine with an identical initrd configuration, and
> - The first machine is configured to serve substitutes, and
> - The second machine uses the first as a substitute server
>
> Then the non-#:substitutable? module would be distributed, violating
> its license?

Yes (assuming typical ZFS+GPL compatibility argument) (and assuming the
two machines are by different people - if it's by the same person, I
imagine it may simplify the legalities).

Well, it wouldn't be distributed as the module itself, as it's embedded
in the initrd. But the initrd is substitutable, so the initrd is
distributed.

Toggle quote (9 lines)
> I’d also find it helpful to understand the line for specific acts and
> entities in play, on a matrix of: allowing violations, encouraging
> violations, or committing violations; and by individual Guix users, or
> by the Guix project itself.  For example, I think the Guix project
> encouraging or committing a violation is unacceptable.
>
> I think this would help a great deal to make the bounds of the problem
> clear, which is needed to solve them.

I'd say:

Allowing violations by the Guix project: pretty much never. (Like,
_maybe_ in some cases it can be determined it's a dead law not worth
following in jurisdiction X at time [T,T+?), but then this needs to be
repeated for all the jurisdictions, and may need to be reevaluated
often, now consider that most of us probably aren't lawyers, let alone
in a sufficient number of jurisdictions, and that there may be
disagreements, and that evaluating the situation takes time+effort ...
Doesn't seem worthwhile.)

Encouraging violations: never. (Encouraging law breaking seems illegal.)

Allowing violations - depends, we're not going to install spyware and
constantly monitor them or something, so they probably could do things
out-of-sight. But "hint hint, don't add activate X (whose purpose is to
make Y), or the illegal substance Y will result" (**) doesn't seem like
something to have in Guix.

And while documenting "The default configuration of adding X (ZFS) to
your Y (operating-system kernel-modules) might be illegal, so also
modify the initrd to mark it as non-substitutable" is worth _something_,
it's much better to just automatically mark the initrd as
non-substitutable, as this is an easy pitfall and entirely automatable.

(**): this is reference to prohibition era in US

What I think Guix should (try to) ensure to be the case, is:

If users tag their custom stuff (including from channels) that shouldn't
be distributed with #:substitutable? #false, and they intentionally
change things to violate the law, then users can legally run their
substitute servers without worrying about the particulars of their
configuration, and without having to look closely at the manual (you
_should_ read the manual, but you might not known in advance which parts
you should have read, and might easily miss something). If Guix knows
that some of this isn't automated in some known situations, then in
those known situations it should produce some kind of error message,
such that they know they need to resolve the situation in some matter.

Toggle quote (10 lines)
>> If 'make-linux-libre' in the presence of ZFS leads to #:subsitutable?
>> problems, that doesn't mean it's fine to ignore the law for #52231. It
>> means you need to:
>
> Could you please help me understand how `make-linux-libre' is in
> scope?  I don’t believe any in-tree kernel modules have the
> problematic license terms, so I think the issue is purely out-of-tree
> stuff, whether that’s ZFS, nVidia drivers, "endpoint protection"
> security systems, etc.  Perhaps you meant `make-initrd'?

I meant 'make-linux-libre'. This is a comment about

Toggle quote (23 lines)
> If the concern is rather that this change makes it easier for someone to
> accidentally redistribute a compiled ZFS kernel module and commit a
> copyviol, I
> struggle to see how this concern is particular enough to #55231 to be
> a reason
> not to merge it. It seems to me, at least in principle, that it would
> be just
> as simple to commit a copyviol by using, say, the `make-linux-libre`
> function
> (which does not appear to set `#:substitutable? #f` on the resulting
> derivation, unsurprisingly) to build a kernel with the ZFS kernel
> module built
> in, and then redistributing that. It seems like the only way to
> completely
> remove this possibility would be to make `#:substitutable?`
> "poisoning", so to
> speak, in the sense that any derivation taking non-substitutable
> derivations as
> inputs would be marked non-substitutable itself. This seems to entirely
> eliminate the possibility of substituting something which is
> non-substitutable,
> but I have no idea if this is practical or even desirable.
>
Going the the above, it might be possible to add nominally out-of-tree
modules to be compiled from within the tree.

Do note that this is an 'if X then Y' construction, I did not claim that
'X' is the case.

I do not know whether make-linux-libre supports such a thing.

Toggle quote (10 lines)
>> More specifically, ZFS proponents (at least as a group, and when
>> limited to those visible in Guix) tend to be rather incoherent in
>> their positions, in the sense that simultaneously do:
>>
>>  (snip)
>
> I appreciate your perspective, however, I’m more interested in
> understanding the problems so they can be solved.  Any help in that
> area would be greatly appreciated.

The incoherency is the problem. If you want ZFS, and your belief ok ZFS
being legally OK is based on P being true, then it follows you have

 (a) ensure that P is true/rectify !P situations,
 (b) or give up on ZFS
 (c) (third alternative) or find another justification and ensure its
preconditions are met.

Yet, as a group, people that want ZFS in Guix have added ZFS without (a)
and (c).

Toggle quote (20 lines)
>>> It does seem that #55231 ended up in a place where there was
>>> concensus that it was acceptable, but didn’t get merged for some
>>> reason or other.  I definitely could be wrong, but I suspect the
>>> issue is that when non-#:substitutable? packages are used in places
>>> other than package inputs, the downstream derivations don’t carry
>>> that information.  I believe when used as a package input,
>>> non-#:substitutable? packages do, in fact, poison all downstream
>>> derivations.  Happy to be corrected if I’m wrong here.
>>
>> Not quite - to my understanding, the downstream derivations _also_
>> don't carry that information when it's in package inputs (at least,
>> last time I checked there didn't seem to be any mechanism to set
>> #:substitutable? to #false when any of the inputs are unsubstitutable
>> (whether non-bag(?) derivation inputs, implicit inputs, native-inputs,
>> ...)).
>
> Ah, hmm.  So these kind of violations are implictly prevented by Guix
> not shipping things in combinations which would violate the license
> terms?

... no? Guix _does_ ship things in bad combinations(*) (Linux-with-ZFS
initrd, by users running a substitute server, in the case that this
combination is in their configuration somewhere), without marking that
initrd combination as nonsubstitutable (IIRC).

(*) actually, I don't recall whether the Linux is part of the initrd,
but there also are other similar situations, e.g. system images. Same
problem.

Toggle quote (16 lines)
>>> I think it’s reasonable to merge this after it’s rebased on current
>>> master, and would be willing to do that unless Maxime or Ludo’ raise
>>> an objection.
>>
>> First you say you suspect the issue is that #:substitutable?-related
>> behaviour isn't right yet, and immediately in the next paragraph you
>> say it's reasonable to merge it. Given that the patches haven't been
>> adjusted to solve this, this is rather incongruent.
>
> While I agree that the fundamental #:substitutable? mechanism of Guix
> could use improvement, I don’t believe these patches need to wait for
> that work, becasue:
>
> - This is a generic mechanism useful for any out-of-tree module
>  regardless of license[1].

And one of these out-of-tree modules is ZFS, where it is not useful
as-is because of the license.

In fact, ZFS support is the purpose of #55231. (Evidence: (1) the
example in the manual, (2) Kaeylen mentioning plans for using this for ZFS)

Toggle quote (2 lines)
> - They won’t cause the Guix project to commit a license violation.
> - They don’t encourage individuals to commit license violations.
It does encourage them ... see, all the previously mentioned stuff about
substitute servers.
Toggle quote (3 lines)
> - While they could /allow/ individuals to commit violations, many
>  things in Guix already do, because it’s infeasible to forbid.

It's not, and has never been, a matter of forbidding of allowing users
to do something. It's  a matter of not leading to user (whether project
or individual user) to _accidentally_ perform a violations.

And it's entirely feasible to prevent this: see, the stuff about
#:substitutable? changes.

Toggle quote (5 lines)
> To the last point:
>
> - Right now, Guix allows a user to make a system image containing
>  compiled ZFS modules and distribute it.

s/allows an user to/lets an user accidentally/

This is a problem. This should be resolved this by (a) removing ZFS or
(b) modifying the image producer to mark it as non-substitutable.
(unlikely option (c): ZFS people adjust license). If people won't do (b)
yet, it follows that (a) needs to be done for now.

Toggle quote (6 lines)
> - Guix ships DVD rippers and programs which can copy files, which  a
> user can commit copyright violations with.
> - Guix ships numerous programs for file sharing, whose /primary/
>  purpose is committing copyright violations.  The nicotine+  package
> is one example[1].

This argument, essentially, is 'X already does the bad thing
Y(nicotine+).  So, it's fine to do Z (improper ZFS support) as well.'.

This really doesn't follow. Like, if I were to burn down a house
(illegal), that doesn't make it legal to steal a chair from the house.

Also, nowhere did I claim that #55231 purpose is committing copyright
violations.

Toggle quote (15 lines)
> I am struggling to square objections to a patch whose intent and
> primary use would be within the bounds of non-binary-redistribution
> licenses, but which might enable an individual to (most likely
> inadvertently) commit a license violation with the significantly
> riskier things which are already permitted.  If I’m misunderstanding
> the situation here, I’d appreciate further insight.
>
> Some examples of other modules that could be used with this facility are:
>
> lttng, a GPL’d out-of-tree kernel tracing system
> ddcci, a GPL’d out-of-tree module for controlling monitor settings
> OpenRazer, a GPL’d out-of-tree module to suppot Razer HID hardware
>
> I’m certain there are other cases where it’d be useful.

ZFS _is_ the primary use, see previous remarks. Even if it weren't the
primary use, it's still a main use, and will likely be advertised as
such (if not in Guix proper manual, then likely in outside guides). Even
it it weren't, ZFS is nevertheless a Linux kernel module in Guix, and
#55231 deals with kernel modules in Guix, so #55231 needs to deal with ZFS.

Just because X has good uses Y1 ... Yn (lttng, etc.), doesn't mean it's
fine to neglect the currently bad use Y0 (current implementation of
#55231 + ZFS support).

Best regards,
Maxime Devos
Maxime Devos wrote 1 months ago
(name . John Kehayias)(address . john.kehayias@protonmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(address . 55231@debbugs.gnu.org)
b7e8b482-4e8d-43ff-a0b6-e7ea62cab0ef@telenet.be
On 9/02/2025 21:04, John Kehayias wrote:
Toggle quote (24 lines)
> Hi Maxime and everyone,
>
> (As a I hope neutral bystander that knows nothing about nor has any
> particular opinions about the ZFS topic but felt it necessary for
> general "good Guix community" to chime in.)
>
> I understand tone and all of that is difficult in these communications,
> and we all have differing language familiarity/interpretations. And we
> can all have strong opinions. I give everyone the benefit of the doubt
> here, but I do want to (very politely I hope) course correct for this to
> stay a good environment for all to discuss.
>
> On Sun, Feb 09, 2025 at 08:46 PM, Maxime Devos wrote:
>
> [snip]
>
>>  * their slander(*) (see: Mason Loring Bliss) (also, to a much lesser
>> extent, right now you - I don't think this quoting out
>> context+misinterpretation _technically_ counts as slander, but it's
>> something bad nonetheless)
> This is not productive to say the least. Let's please all refrain from
> such escalation. Certainly point out when you disagree or ask for
> evidence in discussions, but this is taking us off track.

It _is_ on track. I replied to someone making a negative remark about my
behaviour, and defended myself.

If defending oneself is a form of 'off track', then 'off track' is a
good thing to do.

Toggle quote (18 lines)
>>  * their rudeness (see: raid5atemyhomework) (also Mason Loring Bliss,
>> since slander is rude)
>>  * their hypocrisy as a group (see: they claim it can be fine because
>> of non-binary distribution, but they never change Guix to _make_ the ZFS
>> stuff non-binary)
>>  * repeating _old_ information as an argument/counter-argument, even
>> though it has already been made and replied to, without providing more
>> explanation or another interpretation (see: Mason Loring Bliss. Maybe
>> others, but in particular I recall Mason Loring Bliss doing this).
>>
>> (*) In ordinary sense, without distinguishing between exact forms of
>> defamation, and not evaluating whether illegal or legal.
> Also, please be mindful that these are different people in the current
> thread. Many of the people from the older ZFS threads don't seem to be
> active on Guix, at least publicly. In any event, please be aware this is
> a wide group on guix-devel with many opinions. Let's keep from
> generalizations as much as possible.

Please be aware that I mentioned in the parentheses who.

Do note, that I didn't mention other people from the ZFS discussion.

Toggle quote (12 lines)
>> Sometimes, being dismissive, is a perfectly reasonable response. As long
>> as it's for the right reasons, well-founded, and with evidence.
>>
>> Also, the 'dismissiveness to [others with different viewpoint]' is the
>> other way around (see: previous points).
>>
> If one feels that they are saying the same things and it is not going
> anywhere new, I would encourage them to simply let the discussion
> continue without them for others that may be finding this useful and
> productive towards a path forward. Previous objections have been noted
> and are available in this thread and previous issue discussions.

This is, again, a mischaracterisation. Just, like, look at the ZFS
discussion, and in particular my response to Mason Loring Bliss' slander.

And there, I did let the discussion continue, and we did talk about new
things (except Mason Loring Bliss, who suddenly jumped in with slander,
and as basis mentioned old arguments ... in the form of a link, that has
been discussed already, without further interpretation). It's not an
exact fit, but if there's anything you need to give this advice to, it's
them, not me.

Toggle quote (5 lines)
> I hope guix-devel will continue to be a great place to discuss all
> things Guix, whether in strong agreement, disagreement, or anywhere in
> between. Tough discussions are welcome, but please keep this from
> derailing further.

It's not a great place. Every so often I have to defend myself against
false insinuations and sometimes people conveniently ignore previously
mentioned issues.

I wasn't doing any derailing. It was:

* (for old stuff) Mason Loring Bliss (and sort-of raid5atemyhomework,
but derailing isn't quite the right word there since they started with
the metaphorical rails) (maybe others, but those I recall in particular)
* (recently) you and Morgan Arnold with false insinuations

Like, if you a going to criticize someone's defense, at least bother to
look up their evidence ... (the posts by Mason Loring Bliss and
raid5atemyhomework are easy to find and speak for theirselves).

If the act of defending oneself against an accusation is, intrinsically,
a form of derailing, then derailing sometimes is a good thing.

Having to ever so often defend myself, is one of the reasons I avoid
Guix nowadays.

With all due respect,
Maxime Devos
Attachment: file
Morgan Arnold wrote 1 months ago
(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
JTtAimnNMICUW-We530BE44G5KpCO2CoYASQY0J4ThyM0PF-Q0HIlIsjt4j1SdsjjPBobI-0iYoARfw5MmWiYoeC6hATg9llGDhWg6Ku4MA=@proton.me
Hi all,

As a bit of an aside, I'm wondering if it wouldn't be possible to eliminate the possibility of even potential copyviols by a change to the `derivation` function? It currently sets environment variable for the builder daemon by setting `allowSubstitutes = 0` if `(not substitutable?)`. If non-substitutability were propagated by doing something like instead setting `allowSubstitutes = 0` if `(not substitutable?)` or if `(not (every substitutable-derivation? inputs))`, wouldn't this suffice to ensure that an initrd which contains non-substitutable inputs is properly marked non-substitutable?

It might be more correct to allow derivations built with non-substitutable native inputs to be substitutable nonetheless. The alternative seems like it could cause issues, in particular with the non-substitutable texlive package being used as a native input to build documentation.

Best,

Morgan
Leo Famulari wrote 1 months ago
Re: [bug#55231] Understanding #:substitutable? and #55231
(name . Maxime Devos via Guix-patches via)(address . guix-patches@gnu.org)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55231@debbugs.gnu.org)(name . Ian Eure)(address . ian@retrospec.tv)
Z6leT5MPfBTb3Ffq@jasmine.lan
On Sun, Feb 09, 2025 at 10:13:51PM +0100, Maxime Devos via Guix-patches via wrote:
Toggle quote (6 lines)
> And while documenting "The default configuration of adding X (ZFS) to your Y
> (operating-system kernel-modules) might be illegal, so also modify the
> initrd to mark it as non-substitutable" is worth _something_, it's much
> better to just automatically mark the initrd as non-substitutable, as this
> is an easy pitfall and entirely automatable.

I want to try to clarify my understanding of something. My impression is
that the problem would be distribution of the combination of Linux and
ZFS, as the GPL and CDDL both limit distribution, not use:

For the GPL2:

"Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope."


And the CDDL 1.0:

"3.1. Availability of Source Code. Any Covered Software that You
distribute or otherwise make available in Executable form must also be
made available in Source Code form and that Source Code form must be
distributed only under the terms of this License."


So, It would never be "illegal" to add ZFS to my operating-system
kernel-modules, right? The violation of the licenses would only arise
when distributing the combined work to a 3rd party?

My apologies if this has already been discussed, but it stuck out to me.
Felix Lechner wrote 1 months ago
(name . Leo Famulari)(address . leo@famulari.name)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(address . 55231@debbugs.gnu.org)(name . Maxime Devos via Guix-patches via)(address . guix-patches@gnu.org)
87bjva5sq8.fsf@lease-up.com
Hi Leo,

On Sun, Feb 09 2025, Leo Famulari wrote:

Toggle quote (3 lines)
> The violation of the licenses would only arise when distributing the
> combined work to a 3rd party?

That's also my understanding. Cloud images would be a problem, but Guix
makes those unnecessary!

Please do not rely on this message. I have no legal training.

Kind regards
Felix
Maxime Devos wrote 1 months ago
Re: Understanding #:substitutable? and #55231
(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . Ian Eure)(address . ian@retrospec.tv)
8f429bdd-eab1-45e6-98ca-21235e13ef2f@telenet.be
On 9/02/2025 23:42, Morgan Arnold wrote:

Toggle quote (4 lines)
> Hi all,
>
> As a bit of an aside, I'm wondering if it wouldn't be possible to eliminate the possibility of even potential copyviols by a change to the `derivation` function? It currently sets environment variable for the builder daemon by setting `allowSubstitutes = 0` if `(not substitutable?)`. If non-substitutability were propagated by doing something like instead setting `allowSubstitutes = 0` if `(not substitutable?)` or if `(not (every substitutable-derivation? inputs))`, wouldn't this suffice to ensure that an initrd which contains non-substitutable inputs is properly marked non-substitutable? [...]

This has effectively already been answered.

Best regards,
Maxime Devos
Andreas Enge wrote 1 months ago
(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
Z6oCQMYpj2R98syY@jurong
Hello,

Am Sun, Feb 09, 2025 at 10:42:26PM +0000 schrieb Morgan Arnold via Development of GNU Guix and the GNU System distribution.:
Toggle quote (2 lines)
> It might be more correct to allow derivations built with non-substitutable native inputs to be substitutable nonetheless. The alternative seems like it could cause issues, in particular with the non-substitutable texlive package being used as a native input to build documentation.

just to clarify, texlive (or more precisely, texlivetexmf) is marked as
non substitutable not because it would not be allowed, but because it is
huge and essentially just an unpacked big tarball. So people had better
build the package by themselves.

And it should not be used as a (native-)input to other packages: We have
the much smaller modular texlive packages for this, which make it
possible to depend precisely on what is needed to build the
documentation.

Andreas
bjc wrote 1 months ago
(name . Maxime Devos)(address . maximedevos@telenet.be)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Cou rtès)(address . ludo@gnu.org)(address . 55231@debbugs.gnu.org)(name . Ian Eure)(address . ian@retrospec.tv)
87jz9xde9s.fsf@spork.org
Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (12 lines)
> The incoherency is the problem. If you want ZFS, and your belief ok
> ZFS being legally OK is based on P being true, then it follows you
> have
>
>  (a) ensure that P is true/rectify !P situations,
>  (b) or give up on ZFS
>  (c) (third alternative) or find another justification and ensure its
> preconditions are met.
>
> Yet, as a group, people that want ZFS in Guix have added ZFS without
> (a) and (c).

Please refrain from calling me incoherent. This patch was specifically
designed to work within the bounds of Guix' restrictions, and has been
pointed out, has general use, not just for ZFS even if that was my
initial motivation. It was designed to be of general use, which also
would allow me my own particular uses.

I did not understand your objections over the substitutable flag at the
time, and I still don't completely. That's not incoherency, that's
because a) this is inherently complicated, and b) ‘#:substitutable?’ has
arguably broken default behavior and no way to currently fix it.

I'm staying out of this otherwise. This patch has been a particular sore
point for me and was a major reason I stepped back from Guix. I'm glad
others are finding it useful, and I wish them well in getting it
integrated, but I don't have it in me anymore to deal with the patch
process in this project.

-bjc
Felix Lechner wrote 1 months ago
(name . Maxime Devos)(address . maximedevos@telenet.be)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . John Kehayias)(address . john.kehayias@protonmail.com)(address . 55231@debbugs.gnu.org)
875xlh6bxy.fsf@lease-up.com
Hi Maxime,

On Sun, Feb 09 2025, Maxime Devos wrote:

Toggle quote (30 lines)
> It _is_ on track. I replied to someone making a negative remark about
> my behaviour, and defended myself.

> If defending oneself is a form of 'off track', then 'off track' is a
> good thing to do.

> Sometimes, being dismissive, is a perfectly reasonable response. As
> long as it's for the right reasons, well-founded, and with evidence.
>
> Also, the 'dismissiveness to [others with different viewpoint]' is the
> other way around (see: previous points).

> This is, again, a mischaracterisation

> It's not a great place. Every so often I have to defend myself against
> false insinuations and sometimes people conveniently ignore previously
> mentioned issues.

> I wasn't doing any derailing.

> Like, if you a going to criticize someone's defense, at least bother
> to look up their evidence ...

> If the act of defending oneself against an accusation is,
> intrinsically, a form of derailing, then derailing sometimes is a good
> thing.
>
> Having to ever so often defend myself, is one of the reasons I avoid
> Guix nowadays.

This kind of thing happens on technical lists from time to time. It's
not good to use perseverance, which is great when solving bugs, to
address social issues. Goodwill (or silence) are better for those.

Sometimes we just have to laugh at ourselves---and at all the compulsive
behavior that makes us human. Be friends, everyone!

Peace,
Felix

P.S. Your last message was in HTML format, so it was hard for me to sort
out who replied to whom (and the quotes above may be misattributed).
Morgan Arnold wrote 1 months ago
(name . Andreas Enge)(address . andreas@enge.fr)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
VBHM6E4b-4Rwi1VeyYGs9CNojT6aQ5kKvXr8yBjlHZUpRCoJgkmWNBtW1sYZs6FZ1r5hDHuj-cB9VvWXmZ29GM0P3dwRY-VSboFzryTvPAY=@proton.me
Hi Andreas,

Thanks for the clarification. If this is the case, and texlive is unlikely to be used as a native input, it seems reasonable to me that setting `allowSubstitutes = 0` if `(not (and substitutable? (every substitutable-derivation? inputs)))` would entirely eliminate the possibility of ZFS-based copyviols, as any derivation depending on it could not be substituted, and so neither Guix nor anyone using Guix could commit a copyviol. A user who wishes to use ZFS will then download the source code, compile the kernel module, and include it in their initrd, and this initrd will not accidentally be distributed. To the best of my non-lawyer understanding, this would not constitute any kind of copyviol.

This seems to me to implement a maximally conservative (in terms of avoiding possible copyviols) approach to incorporating ZFS into Guix. If this makes sense, I would be happy to include that change to `derivation` in this patch set.

Best,

Morgan

On Monday, February 10th, 2025 at 14:42, Andreas Enge <andreas@enge.fr> wrote:

Toggle quote (20 lines)
>
>
> Hello,
>
> Am Sun, Feb 09, 2025 at 10:42:26PM +0000 schrieb Morgan Arnold via Development of GNU Guix and the GNU System distribution.:
>
> > It might be more correct to allow derivations built with non-substitutable native inputs to be substitutable nonetheless. The alternative seems like it could cause issues, in particular with the non-substitutable texlive package being used as a native input to build documentation.
>
>
> just to clarify, texlive (or more precisely, texlivetexmf) is marked as
> non substitutable not because it would not be allowed, but because it is
> huge and essentially just an unpacked big tarball. So people had better
> build the package by themselves.
>
> And it should not be used as a (native-)input to other packages: We have
> the much smaller modular texlive packages for this, which make it
> possible to depend precisely on what is needed to build the
> documentation.
>
> Andreas
Maxim Cournoyer wrote 1 months ago
Re: bug#55231: [PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . Andreas Enge)(address . andreas@enge.fr)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
875xlgvd9h.fsf_-_@gmail.com
Hi,

Morgan Arnold <morgan.arnold@proton.me> writes:

Toggle quote (14 lines)
> Hi Andreas,
>
> Thanks for the clarification. If this is the case, and texlive is
> unlikely to be used as a native input, it seems reasonable to me that
> setting `allowSubstitutes = 0` if `(not (and substitutable? (every
> substitutable-derivation? inputs)))` would entirely eliminate the
> possibility of ZFS-based copyviols, as any derivation depending on it
> could not be substituted, and so neither Guix nor anyone using Guix
> could commit a copyviol. A user who wishes to use ZFS will then
> download the source code, compile the kernel module, and include it in
> their initrd, and this initrd will not accidentally be distributed. To
> the best of my non-lawyer understanding, this would not constitute any
> kind of copyviol.

I'm not sure exactly where in the daemon code this would be implemented?
Would you have a pseudo-code draft of where it'd be done? Few of us are
knowledgeable about the daemon code base.

Toggle quote (5 lines)
> This seems to me to implement a maximally conservative (in terms of
> avoiding possible copyviols) approach to incorporating ZFS into
> Guix. If this makes sense, I would be happy to include that change to
> `derivation` in this patch set.

The idea is logical to me, but the implementation, if it touches how a
derivation is computed/changes its result, IIUC, would invalidate all
past derivations ever computed by Nix/Guix, which would be highly
undesirable/disruptive.

--
Thanks,
Maxim
Morgan Arnold wrote 1 months ago
[PATCH v5 1/3] Allows copying of out-of-tree modules to the Linux initrd.
(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@spork.org)
15e253236ef3ffae9adf9139c274eeb8cfdf9e8e.1739285590.git.morgan.arnold@proton.me
From: Brian Cully <bjc@spork.org>

With this patch, modules for ‘initrd-modules’ will not only be searched for in
the in-tree Linux modules, but also any additional modules specified in
‘kernel-loadable-modules’.

* gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument to
DIRECTORIES. Now takes a list of directories to search, rather than a single
one.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
argument to PACKAGES. Now contains a list of file-likes to search for modules.
(raw-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (flat-linux-module-directory) along with the selected LINUX package.
(base-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (raw-initrd).
* gnu/system.scm (operating-system-initrd-file): pass in operating system
definition's kernel-loadable-modules into (make-initrd) as
LINUX-EXTRA-MODULE-DIRECTORIES.
---
gnu/build/linux-modules.scm | 19 ++++++++------
gnu/system.scm | 2 ++
gnu/system/linux-initrd.scm | 50 ++++++++++++++++++++++++-------------
3 files changed, 45 insertions(+), 26 deletions(-)

Toggle diff (180 lines)
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 32baf6c525..b47bce9ab2 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -246,8 +246,8 @@ (define (file-name->module-name file)
'.ko[.gz|.xz|.zst]' and normalizing it."
(normalize-module-name (strip-extension (basename file))))
-(define (find-module-file directory module)
- "Lookup module NAME under DIRECTORY, and return its absolute file name.
+(define (find-module-file directories module)
+ "Lookup module NAME under DIRECTORIES, and return its absolute file name.
NAME can be a file name with or without '.ko', or it can be a module name.
Raise an error if it could not be found.
@@ -268,16 +268,19 @@ (define (find-module-file directory module)
(else chr)))
module))))
- (match (find-files directory
- (lambda (file stat)
- (member (strip-extension
- (basename file)) names)))
+ (match (append-map (lambda (directory)
+ (find-files directory
+ (lambda (file _stat)
+ (member (strip-extension
+ (basename file))
+ names))))
+ directories)
((file)
file)
(()
- (error "kernel module not found" module directory))
+ (error "kernel module not found" module directories))
((_ ...)
- (error "several modules by that name" module directory))))
+ (error "several modules by that name" module directories))))
(define* (recursive-module-dependencies files
#:key (lookup-module dot-ko))
diff --git a/gnu/system.scm b/gnu/system.scm
index 8df871f255..1921b60c25 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1373,6 +1373,8 @@ (define (operating-system-initrd-file os)
#:linux (operating-system-kernel os)
#:linux-modules
(operating-system-initrd-modules os)
+ #:linux-extra-module-directories
+ (operating-system-kernel-loadable-modules os)
#:mapped-devices mapped-devices
#:keyboard-layout (operating-system-keyboard-layout os)))
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index dc08edc791..dab40dfe22 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -120,13 +120,20 @@ (define* (expression->initrd exp
`(#:references-graphs (("closure" ,init))))
"/initrd.cpio.gz"))
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory packages modules)
"Return a flat directory containing the Linux kernel modules listed in
-MODULES and taken from LINUX."
+MODULES and taken from PACKAGES."
(define imported-modules
(source-module-closure '((gnu build linux-modules)
(guix build utils))))
+ (define package-inputs
+ (map (lambda (p)
+ (match p
+ ((p o) (gexp-input p o))
+ (p (gexp-input p "out"))))
+ packages))
+
(define build-exp
(with-imported-modules imported-modules
(with-extensions (list guile-zlib guile-zstd)
@@ -138,8 +145,9 @@ (define (flat-linux-module-directory linux modules)
(srfi srfi-26)
(ice-9 match))
- (define module-dir
- (string-append #$linux "/lib/modules"))
+ (define module-dirs
+ (map (cut string-append <> "/lib/modules")
+ '#$package-inputs))
(define builtin-modules
(match (find-files module-dir (lambda (file stat)
@@ -157,7 +165,7 @@ (define (flat-linux-module-directory linux modules)
(lset-difference string=? '#$modules builtin-modules))
(define modules
- (let* ((lookup (cut find-module-file module-dir <>))
+ (let* ((lookup (cut find-module-file module-dirs <>))
(modules (map lookup modules-to-lookup)))
(append modules
(recursive-module-dependencies
@@ -192,6 +200,7 @@ (define* (raw-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(pre-mount #t)
(mapped-devices '())
(keyboard-layout #f)
@@ -199,15 +208,16 @@ (define* (raw-initrd file-systems
qemu-networking?
volatile-root?
(on-error 'debug))
- "Return as a file-like object a raw initrd, with kernel
-modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via 'root'. LINUX-MODULES is a list of kernel
-modules to be loaded at boot time. MAPPED-DEVICES is a list of device
-mappings to realize before FILE-SYSTEMS are mounted. PRE-MOUNT is a
-G-expression to evaluate before realizing MAPPED-DEVICES.
-HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include
-e2fsck/static or other packages needed by the initrd to check root partition.
+ "Return as a file-like object a raw initrd, with kernel modules taken from
+LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd,
+possibly in addition to the root file system specified on the kernel command
+line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at
+boot time. LINUX-EXTRA-MODULE-DIRECTORIES is a list of file-like objects which
+will be searched for modules in addition to the linux kernel. MAPPED-DEVICES
+is a list of device mappings to realize before FILE-SYSTEMS are mounted.
+HELPER-PACKAGES is a list of packages to be copied in the initrd. It may
+include e2fsck/static or other packages needed by the initrd to check root
+partition.
When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desired
console keyboard layout. This is done before MAPPED-DEVICES are set up and
@@ -243,7 +253,8 @@ (define* (raw-initrd file-systems
#~())))
(define kodir
- (flat-linux-module-directory linux linux-modules))
+ (flat-linux-module-directory (cons linux linux-extra-module-directories)
+ linux-modules))
(expression->initrd
(with-imported-modules (source-module-closure
@@ -390,6 +401,7 @@ (define* (base-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(mapped-devices '())
(keyboard-layout #f)
qemu-networking?
@@ -410,9 +422,10 @@ (define* (base-initrd file-systems
QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd.
The initrd is automatically populated with all the kernel modules necessary
-for FILE-SYSTEMS and for the given options. Additional kernel
-modules can be listed in LINUX-MODULES. They will be added to the initrd, and
-loaded at boot time in the order in which they appear."
+for FILE-SYSTEMS and for the given options. Additional kernel modules can be
+listed in LINUX-MODULES. Additional directories for modules can be listed in
+LINUX-EXTRA-MODULE-DIRECTORIES. They will be added to the initrd, and loaded
+at boot time in the order in which they appear."
(define linux-modules*
;; Modules added to the initrd and loaded from the initrd.
`(,@linux-modules
@@ -432,6 +445,7 @@ (define* (base-initrd file-systems
(raw-initrd file-systems
#:linux linux
#:linux-modules linux-modules*
+ #:linux-extra-module-directories linux-extra-module-directories
#:mapped-devices mapped-devices
#:helper-packages helper-packages
#:keyboard-layout keyboard-layout

base-commit: a8f223f91cf1170c85c0133e12856476e40a8288
--
2.47.1
Morgan Arnold wrote 1 months ago
[PATCH v5 2/3] doc: ‘initrd-modules’ will search ‘kernel-loadable-modules’.
(address . 55231@debbugs.gnu.org)(name . Brian Cully)(address . bjc@spork.org)
c4f63708fd32996cc76a3ec5eec6ad72e6438642.1739285590.git.morgan.arnold@proton.me
From: Brian Cully <bjc@spork.org>

---
doc/guix.texi | 15 +++++++++++++++
1 file changed, 15 insertions(+)

Toggle diff (28 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index bb5f29277f..2ca8bbda51 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43252,6 +43252,21 @@ Initial RAM Disk
(initrd-modules (cons "megaraid_sas" %base-initrd-modules)))
@end lisp
+If a module listed in @code{initrd-modules} is not included in the
+Linux-libre kernel, then the location to it must be added to the
+@code{kernel-loadable-modules} list.
+
+For example, if you need the driver for a Realtek RTL8821CE wireless
+network adapter for mounting the root filesystem over NFS, your
+configuration might include the following:
+
+@lisp
+(operating-system
+ ;; @dots{}
+ (initrd-modules (cons "8821ce" %base-initrd-modules))
+ (kernel-loadable-modules (list (list rtl8821ce-linux-module "module"))))
+@end lisp
+
@defvar %base-initrd-modules
This is the list of kernel modules included in the initrd by default.
@end defvar
--
2.47.1
Morgan Arnold wrote 1 months ago
[PATCH v5 3/3] Prevent possible copyright violations caused by initrd changes.
(address . 55231@debbugs.gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)
7658251299b5b223bb35ab6e23aa74c8e15c5a08.1739285590.git.morgan.arnold@proton.me
This commit changes the conditions under which derivations, as constructed by the `derivation` function, are made substitutable, to prevent potential copyright violations related to the construction of substitutable initrds including non-substitutable derivations (in particular, ZFS).

This change prevents such copyright violations by only marking a derivation as substitutable if it is marked substitutable and all of its inputs are marked as substitutable. This means that non-substitutable derivations have a "poisoning" effect, preventing derivations which take them as input from being substitutable.

Change-Id: I80ba4a371ee0c55a1294aff311d4e7b151055fac
---
guix/derivations.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (25 lines)
diff --git a/guix/derivations.scm b/guix/derivations.scm
index bef98cd26a..789e235eb8 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -868,6 +868,9 @@ (define* (derivation store name builder args
env-vars)
#f)))))
+ (define inputs-substitutable? (every substitutable-derivation?
+ (map derivation-input-derivation inputs)))
+
(define (user+system-env-vars)
;; Some options are passed to the build daemon via the env. vars of
;; derivations (urgh!). We hide that from our API, but here is the place
@@ -875,7 +878,7 @@ (define* (derivation store name builder args
(let ((env-vars `(,@(if local-build?
`(("preferLocalBuild" . "1"))
'())
- ,@(if (not substitutable?)
+ ,@(if (not (and substitutable? inputs-substitutable?)))
`(("allowSubstitutes" . "0"))
'())
,@(if allowed-references
--
2.47.1
Morgan Arnold wrote 1 months ago
Re: bug#55231: [PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . Andreas Enge)(address . andreas@enge.fr)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
iOT1aqNUX2hG8nPSfPERteM0XkN1mz1C-SoW2AYX_UjEEDIOe1FnHzWXnR5QlCYdU5rMpYEjwDCrJ8QofUff5U98_ohVR3sZtEjBpCSHeXE=@proton.me
Hi Maxim,

Thanks for the input. I think that I communicated the idea that I'm proposing poorly, although I'm not sure if what I'm proposing would actually work. I sent a new version of the patchset with the change that I'm proposing implemented, which should hopefully clarify what I mean. Of course, it's very possible that what I'm suggesting here is unacceptable for some reason that I haven't noticed.

Let me know if this doesn't adequately clarify things!

Best,

Morgan

On Tuesday, February 11th, 2025 at 14:09, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

Toggle quote (38 lines)
>
>
> Hi,
>
> Morgan Arnold morgan.arnold@proton.me writes:
>
> > Hi Andreas,
> >
> > Thanks for the clarification. If this is the case, and texlive is
> > unlikely to be used as a native input, it seems reasonable to me that
> > setting `allowSubstitutes = 0` if `(not (and substitutable? (every substitutable-derivation? inputs)))` would entirely eliminate the
> > possibility of ZFS-based copyviols, as any derivation depending on it
> > could not be substituted, and so neither Guix nor anyone using Guix
> > could commit a copyviol. A user who wishes to use ZFS will then
> > download the source code, compile the kernel module, and include it in
> > their initrd, and this initrd will not accidentally be distributed. To
> > the best of my non-lawyer understanding, this would not constitute any
> > kind of copyviol.
>
>
> I'm not sure exactly where in the daemon code this would be implemented?
> Would you have a pseudo-code draft of where it'd be done? Few of us are
> knowledgeable about the daemon code base.
>
> > This seems to me to implement a maximally conservative (in terms of
> > avoiding possible copyviols) approach to incorporating ZFS into
> > Guix. If this makes sense, I would be happy to include that change to
> > `derivation` in this patch set.
>
>
> The idea is logical to me, but the implementation, if it touches how a
> derivation is computed/changes its result, IIUC, would invalidate all
> past derivations ever computed by Nix/Guix, which would be highly
> undesirable/disruptive.
>
> --
> Thanks,
> Maxim
Morgan Arnold wrote 1 months ago
(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . Andreas Enge)(address . andreas@enge.fr)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
aOt786iZX9EVyqAJO1tCSe7ev0OcCN8c5NKIsOkoGUd95ljy7L9_V3QEmXdeD7tAKq-UMGWzJnvt5az51foPXPwHYODD3RNCCeyf8VB7EVU=@proton.me
Hi all,

Toggle quote (2 lines)
> I'm not sure if what I'm proposing would actually work.

How prophetic.

I did some more testing with the proposed change to `derivation`, and it seems to be causing a weird issue. I didn't think that propagating non-substitutability would be much of a problem, since there are very few non-substitutable packages, but I was surprised to find that this change makes almost all packages non-substitutable! I did some REPL-ing to find the culprit, and it when I traced it back, I found that all of my non-substitutable derivations appeared to be so because their dependency graph included a derivation called `#<derivation /gnu/store/qbrwrmdgnfx3p9gl499f5pyhv0fcnw0a-gcc-11.4.0.drv => /gnu/store/d69awcc5wahh71amx0dmgaimsdvvp2bg-gcc-11.4.0-lib 7fc7c9bb99b0>`.

Unfortunately, I cannot for the life of me figure out what this derivation is, or why it isn't substitutable (all of its inputs are substitutable, and I can't find any relevant package explicitly marked as non-substitutable). I wonder if maybe it has something to do with the `gnu-build-system`? It appears to be an input of `bash-minimal`, which is what leads me to that suspicion. If I could figure out what this derivation is and why it's non-substitutable, I think that the change that the proposed change to `derivation` would work (and, in some sense, implement what ought intuitively to be the default behaviour, as Brian noted).

Any and all relevant thoughts would be much appreciated.

Best,

Morgan
Leo Famulari wrote 4 weeks ago
Re: [bug#55231] Understanding #:substitutable? and #55231
(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(address . guix-devel@gnu.org)(address . 55231@debbugs.gnu.org)(name . Maxime Devos via Guix-patches via)(address . guix-patches@gnu.org)
Z65bYzVd7HwZBbNm@jasmine.lan
On Sun, Feb 09, 2025 at 08:27:59PM -0800, Felix Lechner wrote:
Toggle quote (7 lines)
> On Sun, Feb 09 2025, Leo Famulari wrote:
> > The violation of the licenses would only arise when distributing the
> > combined work to a 3rd party?
>
> That's also my understanding. Cloud images would be a problem, but Guix
> makes those unnecessary!

If it is the case, then I don't think that Guix needs to do anything
about this except prevent our CI infrastructure from building the ZFS
module. We wouldn't need to hardcode any restrictions into the Guix
codebase. We have created these kinds of CI restrictions in the past.

Already it's possible to create combinations of programs with
incompatible free software licenses, as a user. Is this particular
combination (ZFS and Linux) special in some way?
Morgan Arnold wrote 4 weeks ago
(name . Leo Famulari)(address . leo@famulari.name)(name . Ian Eure)(address . ian@retrospec.tv)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(address . guix-devel@gnu.org)(address . 55231@debbugs.gnu.org)(name . Maxime Devos via Guix-patches via)(address . guix-patches@gnu.org)
EeoPDHUUv2IQ_8_zXkbijLh9tHBiY0T_hIpjE-RaP3cZavCzvpiv_YCgNXneMdHqkW_ZPtrReuO-_BkepeoRmMMcDFNGOMOi3qiPSeEJAxY=@proton.me
Hi Leo,

Thanks for your interest!

Toggle quote (5 lines)
> If it is the case, then I don't think that Guix needs to do anything
> about this except prevent our CI infrastructure from building the ZFS
> module. We wouldn't need to hardcode any restrictions into the Guix
> codebase. We have created these kinds of CI restrictions in the past.

I think that Maxime has argued against the idea that this is a sufficient guardrail. To (hopefully accurately) summarize Maxime's position, the issue is not simply preventing Guix's CI infrastructure from serving the combined work, but that this change would make it easier for users of Guix to accidentally serve the combined work by use of `guix publish`. Maxime's position is, to the best of my understanding, that this change should not be introduced to Guix, as it makes it easier for an end user to accidentally commit a copyright violation. If I have misrepresented Maxime's position here, I would welcome a correction.

I personally believe that the odds of a user accidentally committing a copyright violation due to this change are sufficiently low that it would be acceptable to merge the patch as-is, but reasonable minds can and of course do differ on this point. My attempts to make `#:substitutable? #f` "poisoning" are an attempt to fix this, but I have found that my lack of experience has made it difficult for me to figure out how to test that this change is behaving appropriately. It currently seems that more packages than I expected are "poisoned" for reasons that I do not really understand. Any help with understanding this would be hugely appreciated.

Toggle quote (4 lines)
> Already it's possible to create combinations of programs with
> incompatible free software licenses, as a user. Is this particular
> combination (ZFS and Linux) special in some way?

As discussed (in particular by Ian), it is already very possible to commit copyright violations with Guix. Maxime's concern seems to me to be more about the fact that this change facilitates (and arguably encourages) the accidental commission of copyright violations. This issue is not necessarily specific to Linux+ZFS, but is the primary example being discussed because facilitating Linux+ZFS systems would be a major application of this patch.

Best,

Morgan

P.S. In my proposed patch to `derivation`, I accidentally fat-fingered an extra closing parenthesis at the end of the changed line. I haven't bothered to submit a v6 of the patch set which fixes this, since I'm not sure if the corrected version of the patch even works as intended (or, if it is working as intended, why so many more packages than expected seem to be poisoned).
Leo Famulari wrote 4 weeks ago
(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ian Eure)(address . ian@retrospec.tv)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(address . guix-devel@gnu.org)(address . 55231@debbugs.gnu.org)(name . Maxime Devos via Guix-patches via)(address . guix-patches@gnu.org)
Z6-IzkI8GPcXiVsb@jasmine.lan
On Fri, Feb 14, 2025 at 04:10:22PM +0000, Morgan Arnold wrote:
Toggle quote (7 lines)
> Maxime's concern seems to me to be more about the fact that this
> change facilitates (and arguably encourages) the accidental commission
> of copyright violations. This issue is not necessarily specific to
> Linux+ZFS, but is the primary example being discussed because
> facilitating Linux+ZFS systems would be a major application of this
> patch.

Thanks Morgan. I agree that if we are not understanding Maxime's point,
I hope we will be corrected.

If Maxime's concern is that Guix should not make it too easy for users
to distribute software for which they do not have the license, I hear
that concern, but I argue that we shouldn't go very far with it. Of
course, Guix itself should not do that kind of thing, but we shouldn't
go out of our way to prevent users from doing so.

Sure, let's not make a special variable "Linux with ZFS" that a user
only needs to tweak a single line in order to build and distribute.

But we shouldn't prevent users from adding kernel modules to their
initrd, because that is explicitly not a problem from a licensing
standpoint. And if users choose to redistribute the compiled result,
that is their mistake / decision, not ours.

Again, I don't see what is special with this combination, compared to
things like the incompatibility of the OpenSSL and GPL licenses. OpenSSL
could not be distributed linked with GPL code for many years of Guix,
and we didn't combine the licenses ourselves. But it was trivial for
users to do it, even on the command line by using package
transformations. That was okay, and I think this is a similar situation
that is also okay.

To all, remember, my earlier message clarified the distinction between
combination and distribution. I hope further discussion will keep that
distinction in mind, if it is correct. Of course copyright is only
concerned with "copying" and distribution.
Morgan Arnold wrote 4 weeks ago
(name . Leo Famulari)(address . leo@famulari.name)(name . Ian Eure)(address . ian@retrospec.tv)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(address . guix-devel@gnu.org)(address . 55231@debbugs.gnu.org)(name . Maxime Devos via Guix-patches via)(address . guix-patches@gnu.org)
kd65wIxbPtafUl8CYTzMz4JgKIOBh3MKKYbfXW01DFkv1_84iwpu7fE1lIusqmK9_AZgCl7nJUx-j7rbo0jVJyEItfOPcn2cx_rMQ_kugVU=@proton.me
Hi Leo,

Toggle quote (6 lines)
> If Maxime's concern is that Guix should not make it too easy for users
> to distribute software for which they do not have the license, I hear
> that concern, but I argue that we shouldn't go very far with it. Of
> course, Guix itself should not do that kind of thing, but we shouldn't
> go out of our way to prevent users from doing so.

I am inclined to agree with this point of view, but it is my understanding that Maxime does not, and it seems like (at a minimum) rather bad form to merge this patch over entirely reasonable objections, even if we happen to disagree with the reasoning behind those objections. This, of course, being subject to the assumption that I am interpreting Maxime's objections correctly. My hope in making `#:substitutable? #f` propagate to dependents was to resolve this issue by simply implementing user protection from any accidental copyright-violating distribution. This seems to me like the most feasible path to assembling a patch set which would satisfy the expressed concerns, and so the most feasible path to the merging of this patch set.

I would be very open to finding another way to address these concerns, but `#:substitutable? #f` propagation was the only solution which presented itself to me. There may be a simpler way to deal specifically with the case of initrds, since those are what are being changed here, but the only scheme which I was able to devise for implementation required working at the level of derivations (essentially, because one has to be able to access the inputs of the initrd as derivations to be able to speak of their substitutability, since substitutability is a property of derivations).

Best,

Morgan
Maxim Cournoyer wrote 4 weeks ago
(name . Leo Famulari)(address . leo@famulari.name)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(address . guix-devel@gnu.org)(address . 55231@debbugs.gnu.org)(name . Maxime Devos via Guix-patches via)(address . guix-patches@gnu.org)
87v7ta4b8c.fsf@gmail.com
Hi,

Leo Famulari <leo@famulari.name> writes:

Toggle quote (38 lines)
> On Fri, Feb 14, 2025 at 04:10:22PM +0000, Morgan Arnold wrote:
>> Maxime's concern seems to me to be more about the fact that this
>> change facilitates (and arguably encourages) the accidental commission
>> of copyright violations. This issue is not necessarily specific to
>> Linux+ZFS, but is the primary example being discussed because
>> facilitating Linux+ZFS systems would be a major application of this
>> patch.
>
> Thanks Morgan. I agree that if we are not understanding Maxime's point,
> I hope we will be corrected.
>
> If Maxime's concern is that Guix should not make it too easy for users
> to distribute software for which they do not have the license, I hear
> that concern, but I argue that we shouldn't go very far with it. Of
> course, Guix itself should not do that kind of thing, but we shouldn't
> go out of our way to prevent users from doing so.
>
> Sure, let's not make a special variable "Linux with ZFS" that a user
> only needs to tweak a single line in order to build and distribute.
>
> But we shouldn't prevent users from adding kernel modules to their
> initrd, because that is explicitly not a problem from a licensing
> standpoint. And if users choose to redistribute the compiled result,
> that is their mistake / decision, not ours.
>
> Again, I don't see what is special with this combination, compared to
> things like the incompatibility of the OpenSSL and GPL licenses. OpenSSL
> could not be distributed linked with GPL code for many years of Guix,
> and we didn't combine the licenses ourselves. But it was trivial for
> users to do it, even on the command line by using package
> transformations. That was okay, and I think this is a similar situation
> that is also okay.
>
> To all, remember, my earlier message clarified the distinction between
> combination and distribution. I hope further discussion will keep that
> distinction in mind, if it is correct. Of course copyright is only
> concerned with "copying" and distribution.

If I've followed correctly, I think Maxime's last reservation to this
change was that currently, even if the ZFS module is marked as
non-substitutable, after it gets embedded in a binary initrd via this
proposed change, it could become available as a binary substitute that
lacks any of the 'non-substitutable' metadata, as (I assume) the initrd
keeps no reference to the non-substitutable modules and Guix currently
has no other means to know.

Maxime's suggestion was to turn every initrd derivation into
non-substitutable, which would work around that, but it'd means that
everyone would also be building their initrd locally from source, which
doesn't sound too great as it makes the current experience worst to
satisfy a niche requirement (using out-of-tree kernel modules with
incompatible licenses).

Perhaps there could be some special case code that could be inserted at
the right place to do the right thing; it'd need to be investigated.

--
Thanks,
Maxim
Maxim Cournoyer wrote 4 weeks ago
Re: bug#55231: [PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ian Eure)(address . ian@retrospec.tv)(name . Brian Cully)(address . bjc@spork.org)(name . Maxime Devos)(address . maximedevos@telenet.be)(name . Leo Famulari)(address . leo@famulari.name)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(address . 55231@debbugs.gnu.org)
87r03y4a6u.fsf_-_@gmail.com
Hi Morgan, Brian and all,

Morgan Arnold <morgan.arnold@proton.me> writes:

Toggle quote (19 lines)
> From: Brian Cully <bjc@spork.org>
>
> With this patch, modules for ‘initrd-modules’ will not only be searched for in
> the in-tree Linux modules, but also any additional modules specified in
> ‘kernel-loadable-modules’.
>
> * gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument to
> DIRECTORIES. Now takes a list of directories to search, rather than a single
> one.
> * gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
> argument to PACKAGES. Now contains a list of file-likes to search for modules.
> (raw-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
> to (flat-linux-module-directory) along with the selected LINUX package.
> (base-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
> to (raw-initrd).
> * gnu/system.scm (operating-system-initrd-file): pass in operating system
> definition's kernel-loadable-modules into (make-initrd) as
> LINUX-EXTRA-MODULE-DIRECTORIES.

This change looks reasonable to me, *if* we can make the possible
copyright violation fix that Morgan is working on work correctly. I've
applied it locally and made the following small changes, also
normalizing the commit message a bit and squashing the documentation
change along the actual change commit:

Toggle snippet (53 lines)
modified doc/guix.texi
@@ -43414,11 +43414,11 @@ Initial RAM Disk
@end lisp
If a module listed in @code{initrd-modules} is not included in the
-Linux-libre kernel, then the location to it must be added to the
+Linux-libre kernel, then its location must be provided via the
@code{kernel-loadable-modules} list.
-For example, if you need the driver for a Realtek RTL8821CE wireless
-network adapter for mounting the root filesystem over NFS, your
+As an example, if you need the driver for a Realtek RTL8821CE wireless
+network adapter for mounting the root file system over NFS, your
configuration might include the following:
@lisp
modified gnu/build/linux-modules.scm
@@ -255,6 +255,9 @@ (define (find-module-file directories module)
module names usually (always?) use underscores as the inter-word separator,
whereas file names often, but not always, use hyphens. Examples:
\"usb-storage.ko\", \"serpent_generic.ko\"."
+ (define directories (if pair? directories
+ directories
+ (list directories))) ;for backward compatibility
(define names
;; List of possible file names. XXX: It would of course be cleaner to
;; have a database that maps module names to file names and vice versa,
@@ -270,7 +273,7 @@ (define (find-module-file directories module)
(match (append-map (lambda (directory)
(find-files directory
- (lambda (file _stat)
+ (lambda (file _)
(member (strip-extension
(basename file))
names))))
modified gnu/system/linux-initrd.scm
@@ -128,10 +128,9 @@ (define (flat-linux-module-directory packages modules)
(guix build utils))))
(define package-inputs
- (map (lambda (p)
- (match p
- ((p o) (gexp-input p o))
- (p (gexp-input p "out"))))
+ (map (match-lambda
+ ((p o) (gexp-input p o))
+ (p (gexp-input p "out")))
packages))
(define build-exp

I'll now take a look at the initrd substitutability issue/potential fix
from Morgan.

--
Thanks,
Maxim
Maxim Cournoyer wrote 4 weeks ago
(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . Andreas Enge)(address . andreas@enge.fr)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
87msem45um.fsf_-_@gmail.com
Hi Morgan,

Morgan Arnold <morgan.arnold@proton.me> writes:

Toggle quote (18 lines)
> Hi all,
>
>> I'm not sure if what I'm proposing would actually work.
>
> How prophetic.
>
> I did some more testing with the proposed change to `derivation`, and
> it seems to be causing a weird issue. I didn't think that propagating
> non-substitutability would be much of a problem, since there are very
> few non-substitutable packages, but I was surprised to find that this
> change makes almost all packages non-substitutable! I did some
> REPL-ing to find the culprit, and it when I traced it back, I found
> that all of my non-substitutable derivations appeared to be so because
> their dependency graph included a derivation called `#<derivation
> /gnu/store/qbrwrmdgnfx3p9gl499f5pyhv0fcnw0a-gcc-11.4.0.drv =>
> /gnu/store/d69awcc5wahh71amx0dmgaimsdvvp2bg-gcc-11.4.0-lib
> 7fc7c9bb99b0>`.

That's probably the GCC implicitly added by gnu-build-system, which is
listed in the %final-inputs variable.

Toggle quote (11 lines)
> Unfortunately, I cannot for the life of me figure out what this
> derivation is, or why it isn't substitutable (all of its inputs are
> substitutable, and I can't find any relevant package explicitly marked
> as non-substitutable). I wonder if maybe it has something to do with
> the `gnu-build-system`? It appears to be an input of `bash-minimal`,
> which is what leads me to that suspicion. If I could figure out what
> this derivation is and why it's non-substitutable, I think that the
> change that the proposed change to `derivation` would work (and, in
> some sense, implement what ought intuitively to be the default
> behaviour, as Brian noted).

I'm not sure what's wrong, but I think we could start by investigating
why this changes causes 29 new failures when running:

Toggle snippet (116 lines)
export SCM_LOG_DRIVER_FLAGS="--brief=no --errors-only=yes" VERBOSE=1
make check TESTS=tests/derivations.scm
$ make check TESTS=tests/derivations.scm
make check-recursive
make[1] : on entre dans le répertoire «Â /home/maxim/src/guix-spare »
Making check in po/guix
make[2] : on entre dans le répertoire «Â /home/maxim/src/guix-spare/po/guix »
make[2]: Rien à faire pour «Â check ».
make[2] : on quitte le répertoire «Â /home/maxim/src/guix-spare/po/guix »
Making check in po/packages
make[2] : on entre dans le répertoire «Â /home/maxim/src/guix-spare/po/packages »
make[2]: Rien à faire pour «Â check ».
make[2] : on quitte le répertoire «Â /home/maxim/src/guix-spare/po/packages »
make[2] : on entre dans le répertoire «Â /home/maxim/src/guix-spare »
Compiling Scheme modules...
Compiling Scheme modules...
Compiling Scheme modules...
Compiling Scheme modules...
Compiling Scheme modules...
Compiling Scheme modules...
Compiling Scheme modules...
Compiling Scheme modules...
make check-TESTS check-local
make[3] : on entre dans le répertoire «Â /home/maxim/src/guix-spare »
make[4] : on entre dans le répertoire «Â /home/maxim/src/guix-spare »
PASS: tests/derivations.scm - parse & export
PASS: tests/derivations.scm - add-to-store, flat
PASS: tests/derivations.scm - add-to-store, recursive
PASS: tests/derivations.scm - derivation with no inputs
PASS: tests/derivations.scm - build derivation with 1 source
FAIL: tests/derivations.scm - derivation fails but keep going
PASS: tests/derivations.scm - identical files are deduplicated
PASS: tests/derivations.scm - built-in-builders
PASS: tests/derivations.scm - unknown built-in builder
PASS: tests/derivations.scm - 'download' built-in builder
PASS: tests/derivations.scm - 'download' built-in builder, invalid hash
PASS: tests/derivations.scm - 'download' built-in builder, not found
PASS: tests/derivations.scm - 'download' built-in builder, not fixed-output
PASS: tests/derivations.scm - 'download' built-in builder, no fixed-output hash
PASS: tests/derivations.scm - 'download' built-in builder, check mode
PASS: tests/derivations.scm - 'git-download' built-in builder
PASS: tests/derivations.scm - 'git-download' built-in builder, invalid hash
PASS: tests/derivations.scm - 'git-download' built-in builder, invalid commit
PASS: tests/derivations.scm - 'git-download' built-in builder, not found
PASS: tests/derivations.scm - derivation-name
PASS: tests/derivations.scm - derivation-output-names
PASS: tests/derivations.scm - offloadable-derivation?
PASS: tests/derivations.scm - substitutable-derivation?
PASS: tests/derivations.scm - fixed-output-derivation?
PASS: tests/derivations.scm - fixed-output-derivation?, no hash
PASS: tests/derivations.scm - fixed-output derivation
PASS: tests/derivations.scm - fixed-output derivation: output paths are equal
PASS: tests/derivations.scm - fixed-output derivation, recursive
PASS: tests/derivations.scm - fixed-output derivation, invalid hash size
PASS: tests/derivations.scm - derivation with a fixed-output input
PASS: tests/derivations.scm - derivation with duplicate fixed-output inputs
PASS: tests/derivations.scm - derivation with equivalent fixed-output inputs
PASS: tests/derivations.scm - multiple-output derivation
PASS: tests/derivations.scm - multiple-output derivation, non-alphabetic order
PASS: tests/derivations.scm - read-derivation vs. derivation
PASS: tests/derivations.scm - read-derivation with hash = #f
PASS: tests/derivations.scm - multiple-output derivation, derivation-path->output-path
PASS: tests/derivations.scm - user of multiple-output derivation
PASS: tests/derivations.scm - derivation with #:references-graphs
PASS: tests/derivations.scm - derivation #:allowed-references, ok
PASS: tests/derivations.scm - derivation #:allowed-references, not allowed
PASS: tests/derivations.scm - derivation #:allowed-references, self allowed
PASS: tests/derivations.scm - derivation #:allowed-references, self not allowed
PASS: tests/derivations.scm - derivation #:disallowed-references, ok
PASS: tests/derivations.scm - derivation #:disallowed-references, not ok
PASS: tests/derivations.scm - derivation #:leaked-env-vars
PASS: tests/derivations.scm - build derivation with coreutils
PASS: tests/derivations.scm - build-expression->derivation and invalid module name
FAIL: tests/derivations.scm - build-expression->derivation and builder encoding
FAIL: tests/derivations.scm - build-expression->derivation and derivation-prerequisites
FAIL: tests/derivations.scm - derivation-prerequisites and valid-derivation-input?
FAIL: tests/derivations.scm - build-expression->derivation without inputs
FAIL: tests/derivations.scm - build-expression->derivation and max-silent-time
FAIL: tests/derivations.scm - build-expression->derivation and timeout
FAIL: tests/derivations.scm - build-derivations with specific output
FAIL: tests/derivations.scm - build-expression->derivation and derivation-build-plan
FAIL: tests/derivations.scm - derivation-build-plan when outputs already present
FAIL: tests/derivations.scm - derivation-build-plan and substitutes
FAIL: tests/derivations.scm - derivation-build-plan and substitutes, non-substitutable build
FAIL: tests/derivations.scm - derivation-build-plan and substitutes, non-substitutable dep
FAIL: tests/derivations.scm - derivation-build-plan and substitutes, local build
FAIL: tests/derivations.scm - derivation-build-plan in 'check' mode
FAIL: tests/derivations.scm - derivation-build-plan, topological ordering
FAIL: tests/derivations.scm - derivation-input-fold
FAIL: tests/derivations.scm - substitution-oracle and #:substitute? #f
FAIL: tests/derivations.scm - build-expression->derivation with expression returning #f
FAIL: tests/derivations.scm - build-expression->derivation with two outputs
FAIL: tests/derivations.scm - build-expression->derivation with one input
FAIL: tests/derivations.scm - build-expression->derivation with modules
FAIL: tests/derivations.scm - build-expression->derivation: same fixed-output path
FAIL: tests/derivations.scm - build-expression->derivation with a fixed-output input
FAIL: tests/derivations.scm - build-expression->derivation produces recursive fixed-output
FAIL: tests/derivations.scm - build-expression->derivation uses recursive fixed-output
FAIL: tests/derivations.scm - build-expression->derivation with #:references-graphs
FAIL: tests/derivations.scm - derivation-properties
FAIL: tests/derivations.scm - map-derivation
PASS: tests/derivations.scm - map-derivation, sources
===================================================
GNU Guix 1.3.0.77462-364394: ./test-suite.log
===================================================

# TOTAL: 77
# PASS: 48
# SKIP: 0
# XFAIL: 0
# FAIL: 29
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2
--
Thanks,
Maxim
Morgan Arnold wrote 4 weeks ago
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . Andreas Enge)(address . andreas@enge.fr)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
3o4_UDsLg_niP9tmlxooqmgL06jnuZUG-5XC0cVNmBFFSGzknqo57tPuquPbDyXojL1N8sBpu3fKFqDs5G703jNggTKMdPqWR3XH53wov4w=@proton.me
Hi Maxim,

Toggle quote (3 lines)
> That's probably the GCC implicitly added by gnu-build-system, which is
> listed in the %final-inputs variable.

I did figure out that this was the GCC implicitly added by `gnu-build-system`, although unfortunately examining this more carefully didn't help me a whole lot with understanding why it seemed to be non-substitutable.

Toggle quote (3 lines)
> I'm not sure what's wrong, but I think we could start by investigating
> why this changes causes 29 new failures when running:

I accidentally added an extra closing parenthesis to the changed line in `derivation`, but didn't bother submitting an updated patch set because even with that typo fixed, the change still didn't seem to work. You may have noticed and fixed this yourself. I had trouble running the test suite while working on the changes, as I was away from home and my laptop seemed to be somewhat underpowered for the purpose. I'm back at home with access to my PC now, so I'll try to have a look at why the tests are failing.

Best,

Morgan
Morgan Arnold wrote 4 weeks ago
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . Andreas Enge)(address . andreas@enge.fr)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
gUOjJoEMLHJSnQB8Fyy9i8r5aelAgRG4A5nomTvt0VKRk__JJfcFKkdNUWvlYiq71dtFmtqi3qTmKWJbs6QmYSTvZ2dyLj4hv0qwv4H7Edo=@proton.me
Hi Maxim,

I found the cause of these failed tests, although unfortunately it doesn't seem to resolve the problem with implicit inputs from `gnu-build-system` being non-substitutable. The failing tests pass a `derivation` as input to the derivations that they construct, rather than a `derivation-input`. My added code then fails upon attempting to apply `derivation-input-derivation` to something which is not `derivation-input?`. I think that this might arguably be a flaw in the tests, but it can be resolved by simply checking that an input is `derivation-input?` before attempting to apply `derivation-input-derivation`. I'll send over the patch in a moment.

Best,

Morgan
Morgan Arnold wrote 4 weeks ago
[PATCH] Prevent possible copyright violations caused by initrd changes.
(address . 55231@debbugs.gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)
04422036fe701cdb2a249819cdfb79284539026f.1739705251.git.morgan.arnold@proton.me
This commit changes the conditions under which derivations, as constructed by the `derivation` function, are made substitutable, to prevent potential copyright violations related to the construction of substitutable initrds including non-substitutable derivations (in particular, ZFS).

This change prevents such copyright violations by only marking a derivation as substitutable if it is marked substitutable and all of its inputs are marked as substitutable. This means that non-substitutable derivations have a "poisoning" effect, preventing derivations which take them as input from being substitutable.

Change-Id: I80ba4a371ee0c55a1294aff311d4e7b151055fac
---
guix/derivations.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (30 lines)
diff --git a/guix/derivations.scm b/guix/derivations.scm
index bef98cd..64b51d8 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -868,6 +868,10 @@ (define* (derivation store name builder args
env-vars)
#f)))))
+ (define inputs-substitutable? (every substitutable-derivation?
+ (map derivation-input-derivation
+ (filter derivation-input? inputs))))
+
(define (user+system-env-vars)
;; Some options are passed to the build daemon via the env. vars of
;; derivations (urgh!). We hide that from our API, but here is the place
@@ -875,7 +879,7 @@ (define* (derivation store name builder args
(let ((env-vars `(,@(if local-build?
`(("preferLocalBuild" . "1"))
'())
- ,@(if (not substitutable?)
+ ,@(if (not (and substitutable? inputs-substitutable?))
`(("allowSubstitutes" . "0"))
'())
,@(if allowed-references

base-commit: b30669e15d2e8c3d1b74b32f77e2095682aab4ca
prerequisite-patch-id: 45b81fb0e4b05258028b424c6faa9ce11db81572
prerequisite-patch-id: 73d157f088f6ec9e9feece25a7ba6a0c890d6343
--
2.47.1
Maxim Cournoyer wrote 4 weeks ago
[PATCH v6 1/4] Allow copying of out-of-tree modules to the Linux initrd.
(address . 55231@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Brian Cully)(address . bjc@spork.org)
353146a4da0938e592fa4333b601abf5b98d937d.1739710358.git.maxim.cournoyer@gmail.com
From: Brian Cully <bjc@spork.org>

With this patch, modules for ‘initrd-modules’ will not only be searched for in
the in-tree Linux modules, but also any additional modules specified in
‘kernel-loadable-modules’.

* gnu/build/linux-modules.scm (find-module-file): Change DIRECTORY argument to
DIRECTORIES. Now takes a list of directories to search, rather than a single
one.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
argument to PACKAGES. Now contains a list of file-like objects to search for
modules.
(raw-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (flat-linux-module-directory) along with the selected LINUX package.
(base-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (raw-initrd).
* gnu/system.scm (operating-system-initrd-file): Pass in operating system
definition's kernel-loadable-modules into (make-initrd) as
LINUX-EXTRA-MODULE-DIRECTORIES.
* doc/guix.texi (Initial RAM Disk): Document how out-of-tree modules can be
used.

Change-Id: Ic39f2abcfabc3ec34a71acce840038396bf9c82e
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
---
doc/guix.texi | 15 ++++++++++++
gnu/build/linux-modules.scm | 22 +++++++++++------
gnu/system.scm | 2 ++
gnu/system/linux-initrd.scm | 49 +++++++++++++++++++++++--------------
4 files changed, 62 insertions(+), 26 deletions(-)

Toggle diff (215 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 01e3a4edf0..a4c3743e50 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43413,6 +43413,21 @@ Initial RAM Disk
(initrd-modules (cons "megaraid_sas" %base-initrd-modules)))
@end lisp
+If a module listed in @code{initrd-modules} is not included in the
+Linux-libre kernel, then its location must be provided via the
+@code{kernel-loadable-modules} list.
+
+As an example, if you need the driver for a Realtek RTL8821CE wireless
+network adapter for mounting the root file system over NFS, your
+configuration might include the following:
+
+@lisp
+(operating-system
+ ;; @dots{}
+ (initrd-modules (cons "8821ce" %base-initrd-modules))
+ (kernel-loadable-modules (list (list rtl8821ce-linux-module "module"))))
+@end lisp
+
@defvar %base-initrd-modules
This is the list of kernel modules included in the initrd by default.
@end defvar
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 32baf6c525..24bbe087f5 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -246,8 +246,8 @@ (define (file-name->module-name file)
'.ko[.gz|.xz|.zst]' and normalizing it."
(normalize-module-name (strip-extension (basename file))))
-(define (find-module-file directory module)
- "Lookup module NAME under DIRECTORY, and return its absolute file name.
+(define (find-module-file directories module)
+ "Lookup module NAME under DIRECTORIES, and return its absolute file name.
NAME can be a file name with or without '.ko', or it can be a module name.
Raise an error if it could not be found.
@@ -255,6 +255,9 @@ (define (find-module-file directory module)
module names usually (always?) use underscores as the inter-word separator,
whereas file names often, but not always, use hyphens. Examples:
\"usb-storage.ko\", \"serpent_generic.ko\"."
+ (define directories (if (pair? directories)
+ directories
+ (list directories))) ;for backward compatibility
(define names
;; List of possible file names. XXX: It would of course be cleaner to
;; have a database that maps module names to file names and vice versa,
@@ -268,16 +271,19 @@ (define (find-module-file directory module)
(else chr)))
module))))
- (match (find-files directory
- (lambda (file stat)
- (member (strip-extension
- (basename file)) names)))
+ (match (append-map (lambda (directory)
+ (find-files directory
+ (lambda (file _)
+ (member (strip-extension
+ (basename file))
+ names))))
+ directories)
((file)
file)
(()
- (error "kernel module not found" module directory))
+ (error "kernel module not found" module directories))
((_ ...)
- (error "several modules by that name" module directory))))
+ (error "several modules by that name" module directories))))
(define* (recursive-module-dependencies files
#:key (lookup-module dot-ko))
diff --git a/gnu/system.scm b/gnu/system.scm
index 8df871f255..1921b60c25 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1373,6 +1373,8 @@ (define (operating-system-initrd-file os)
#:linux (operating-system-kernel os)
#:linux-modules
(operating-system-initrd-modules os)
+ #:linux-extra-module-directories
+ (operating-system-kernel-loadable-modules os)
#:mapped-devices mapped-devices
#:keyboard-layout (operating-system-keyboard-layout os)))
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index dc08edc791..a8df9056ec 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -120,13 +120,19 @@ (define* (expression->initrd exp
`(#:references-graphs (("closure" ,init))))
"/initrd.cpio.gz"))
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory packages modules)
"Return a flat directory containing the Linux kernel modules listed in
-MODULES and taken from LINUX."
+MODULES and taken from PACKAGES."
(define imported-modules
(source-module-closure '((gnu build linux-modules)
(guix build utils))))
+ (define package-inputs
+ (map (match-lambda
+ ((p o) (gexp-input p o))
+ (p (gexp-input p "out")))
+ packages))
+
(define build-exp
(with-imported-modules imported-modules
(with-extensions (list guile-zlib guile-zstd)
@@ -138,8 +144,9 @@ (define (flat-linux-module-directory linux modules)
(srfi srfi-26)
(ice-9 match))
- (define module-dir
- (string-append #$linux "/lib/modules"))
+ (define module-dirs
+ (map (cut string-append <> "/lib/modules")
+ '#$package-inputs))
(define builtin-modules
(match (find-files module-dir (lambda (file stat)
@@ -157,7 +164,7 @@ (define (flat-linux-module-directory linux modules)
(lset-difference string=? '#$modules builtin-modules))
(define modules
- (let* ((lookup (cut find-module-file module-dir <>))
+ (let* ((lookup (cut find-module-file module-dirs <>))
(modules (map lookup modules-to-lookup)))
(append modules
(recursive-module-dependencies
@@ -192,6 +199,7 @@ (define* (raw-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(pre-mount #t)
(mapped-devices '())
(keyboard-layout #f)
@@ -199,15 +207,16 @@ (define* (raw-initrd file-systems
qemu-networking?
volatile-root?
(on-error 'debug))
- "Return as a file-like object a raw initrd, with kernel
-modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via 'root'. LINUX-MODULES is a list of kernel
-modules to be loaded at boot time. MAPPED-DEVICES is a list of device
-mappings to realize before FILE-SYSTEMS are mounted. PRE-MOUNT is a
-G-expression to evaluate before realizing MAPPED-DEVICES.
-HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include
-e2fsck/static or other packages needed by the initrd to check root partition.
+ "Return as a file-like object a raw initrd, with kernel modules taken from
+LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd,
+possibly in addition to the root file system specified on the kernel command
+line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at
+boot time. LINUX-EXTRA-MODULE-DIRECTORIES is a list of file-like objects which
+will be searched for modules in addition to the linux kernel. MAPPED-DEVICES
+is a list of device mappings to realize before FILE-SYSTEMS are mounted.
+HELPER-PACKAGES is a list of packages to be copied in the initrd. It may
+include e2fsck/static or other packages needed by the initrd to check root
+partition.
When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desired
console keyboard layout. This is done before MAPPED-DEVICES are set up and
@@ -243,7 +252,8 @@ (define* (raw-initrd file-systems
#~())))
(define kodir
- (flat-linux-module-directory linux linux-modules))
+ (flat-linux-module-directory (cons linux linux-extra-module-directories)
+ linux-modules))
(expression->initrd
(with-imported-modules (source-module-closure
@@ -390,6 +400,7 @@ (define* (base-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(mapped-devices '())
(keyboard-layout #f)
qemu-networking?
@@ -410,9 +421,10 @@ (define* (base-initrd file-systems
QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd.
The initrd is automatically populated with all the kernel modules necessary
-for FILE-SYSTEMS and for the given options. Additional kernel
-modules can be listed in LINUX-MODULES. They will be added to the initrd, and
-loaded at boot time in the order in which they appear."
+for FILE-SYSTEMS and for the given options. Additional kernel modules can be
+listed in LINUX-MODULES. Additional directories for modules can be listed in
+LINUX-EXTRA-MODULE-DIRECTORIES. They will be added to the initrd, and loaded
+at boot time in the order in which they appear."
(define linux-modules*
;; Modules added to the initrd and loaded from the initrd.
`(,@linux-modules
@@ -432,6 +444,7 @@ (define* (base-initrd file-systems
(raw-initrd file-systems
#:linux linux
#:linux-modules linux-modules*
+ #:linux-extra-module-directories linux-extra-module-directories
#:mapped-devices mapped-devices
#:helper-packages helper-packages
#:keyboard-layout keyboard-layout

base-commit: af643735a546d9d3538113ebab4b5892f34c131a
--
2.48.1
Maxim Cournoyer wrote 4 weeks ago
[PATCH v6 2/4] derivations: Fix indentation.
(address . 55231@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
a9d8d189296eb348403c52f6e3d42b7383008317.1739710358.git.maxim.cournoyer@gmail.com
* guix/derivations.scm (derivation): Fix indentation.

Change-Id: I2407b59788ce335c21c181d9f9e3f26a359e9bf5
---
guix/derivations.scm | 46 ++++++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 23 deletions(-)

Toggle diff (71 lines)
diff --git a/guix/derivations.scm b/guix/derivations.scm
index bef98cd26a..ffa69e924c 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -841,30 +841,30 @@ (define* (derivation store name builder args
;; corresponding environment variable.
(match drv
(($ <derivation> outputs inputs sources
- system builder args env-vars)
+ system builder args env-vars)
(let* ((drv-hash (derivation-hash drv))
(outputs (map (match-lambda
- ((output-name . ($ <derivation-output>
- _ algo hash rec?))
- (let ((path
- (if hash
- (fixed-output-path name hash
- #:hash-algo algo
- #:output output-name
- #:recursive? rec?)
- (output-path output-name
- drv-hash name))))
- (cons output-name
- (make-derivation-output path algo
- hash rec?)))))
+ ((output-name . ($ <derivation-output>
+ _ algo hash rec?))
+ (let ((path
+ (if hash
+ (fixed-output-path name hash
+ #:hash-algo algo
+ #:output output-name
+ #:recursive? rec?)
+ (output-path output-name
+ drv-hash name))))
+ (cons output-name
+ (make-derivation-output path algo
+ hash rec?)))))
outputs)))
(make-derivation outputs inputs sources system builder args
(map (match-lambda
- ((name . value)
- (cons name
- (or (and=> (assoc-ref outputs name)
- derivation-output-path)
- value))))
+ ((name . value)
+ (cons name
+ (or (and=> (assoc-ref outputs name)
+ derivation-output-path)
+ value))))
env-vars)
#f)))))
@@ -910,10 +910,10 @@ (define* (derivation store name builder args
;; Return a variant of ENV-VARS where each OUTPUTS is associated with an
;; empty string, even outputs that do not appear in ENV-VARS.
(let ((e (map (match-lambda
- ((name . val)
- (if (member name outputs)
- (cons name "")
- (cons name val))))
+ ((name . val)
+ (if (member name outputs)
+ (cons name "")
+ (cons name val))))
env-vars)))
(fold (lambda (output-name env-vars)
(if (assoc output-name env-vars)
--
2.48.1
Maxim Cournoyer wrote 4 weeks ago
[PATCH v6 3/4] tests: Remove extraneous 'with-store' in derivations test.
(address . 55231@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
1c9a81869981a3281b6a3ef68bda73b336be2e5c.1739710358.git.maxim.cournoyer@gmail.com
* tests/derivations.scm ("derivation fails but keep going"): Remove extraneous
'with-store'.

Change-Id: If30c2d457504b8524cd167f1a145fbbea61b513c
---
tests/derivations.scm | 45 +++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 23 deletions(-)

Toggle diff (58 lines)
diff --git a/tests/derivations.scm b/tests/derivations.scm
index efcd21f324..72ea9aa9cc 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -150,29 +150,28 @@ (define* (directory-contents dir #:optional (slurp get-bytevector-all))
(test-assert "derivation fails but keep going"
;; In keep-going mode, 'build-derivations' should fail because of D1, but it
;; must return only after D2 has succeeded.
- (with-store store
- (let* ((d1 (derivation %store "fails"
- %bash `("-c" "false")
- #:sources (list %bash)))
- (d2 (build-expression->derivation %store "sleep-then-succeed"
- `(begin
- ,(random-text)
- ;; XXX: Hopefully that's long
- ;; enough that D1 has already
- ;; failed.
- (sleep 2)
- (mkdir %output)))))
- (set-build-options %store
- #:use-substitutes? #f
- #:keep-going? #t)
- (guard (c ((store-protocol-error? c)
- (and (= 100 (store-protocol-error-status c))
- (string-contains (store-protocol-error-message c)
- (derivation-file-name d1))
- (not (valid-path? %store (derivation->output-path d1)))
- (valid-path? %store (derivation->output-path d2)))))
- (build-derivations %store (list d1 d2))
- #f))))
+ (let* ((d1 (derivation %store "fails"
+ %bash `("-c" "false")
+ #:sources (list %bash)))
+ (d2 (build-expression->derivation %store "sleep-then-succeed"
+ `(begin
+ ,(random-text)
+ ;; XXX: Hopefully that's long
+ ;; enough that D1 has already
+ ;; failed.
+ (sleep 2)
+ (mkdir %output)))))
+ (set-build-options %store
+ #:use-substitutes? #f
+ #:keep-going? #t)
+ (guard (c ((store-protocol-error? c)
+ (and (= 100 (store-protocol-error-status c))
+ (string-contains (store-protocol-error-message c)
+ (derivation-file-name d1))
+ (not (valid-path? %store (derivation->output-path d1)))
+ (valid-path? %store (derivation->output-path d2)))))
+ (build-derivations %store (list d1 d2))
+ #f)))
(test-assert "identical files are deduplicated"
;; Note: DATA must be longer than %DEDUPLICATION-MINIMUM-SIZE.
--
2.48.1
Maxim Cournoyer wrote 4 weeks ago
[PATCH v6 4/4] Propagate non-substitutability of derivations.
(address . 55231@debbugs.gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
3a29ed41b52ef12aa92d31ff740b01777785e6c6.1739710358.git.maxim.cournoyer@gmail.com
From: Morgan Arnold <morgan.arnold@proton.me>

This commit changes the conditions under which derivations, as
constructed by the `derivation' procedure, are made substitutable, to
prevent potential copyright violations related to the construction of
substitutable initrds including non-substitutable derivations (in
particular, ZFS).

This change prevents such copyright violations by only marking a derivation as
substitutable if it is itself marked substitutable along all of its inputs.
This means that non-substitutable derivations propagate to other derivations
using them as input.

Change-Id: I80ba4a371ee0c55a1294aff311d4e7b151055fac
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
---
guix/derivations.scm | 53 +++++++++++++++++++++++--------------------
tests/derivations.scm | 16 +++++++------
2 files changed, 37 insertions(+), 32 deletions(-)

Toggle diff (104 lines)
diff --git a/guix/derivations.scm b/guix/derivations.scm
index ffa69e924c..f4e7c56981 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -868,33 +868,36 @@ (define* (derivation store name builder args
env-vars)
#f)))))
- (define (user+system-env-vars)
+ (define (user+system-env-vars inputs)
;; Some options are passed to the build daemon via the env. vars of
;; derivations (urgh!). We hide that from our API, but here is the place
;; where we kludgify those options.
- (let ((env-vars `(,@(if local-build?
- `(("preferLocalBuild" . "1"))
- '())
- ,@(if (not substitutable?)
- `(("allowSubstitutes" . "0"))
- '())
- ,@(if allowed-references
- `(("allowedReferences"
- . ,(string-join allowed-references)))
- '())
- ,@(if disallowed-references
- `(("disallowedReferences"
- . ,(string-join disallowed-references)))
- '())
- ,@(if leaked-env-vars
- `(("impureEnvVars"
- . ,(string-join leaked-env-vars)))
- '())
- ,@(match properties
- (() '())
- (lst `(("guix properties"
- . ,(object->string properties)))))
- ,@env-vars)))
+ (let* ((substitutable-inputs? (every substitutable-derivation?
+ (map derivation-input-derivation
+ inputs)))
+ (env-vars `(,@(if local-build?
+ `(("preferLocalBuild" . "1"))
+ '())
+ ,@(if (and substitutable? substitutable-inputs?)
+ '()
+ `(("allowSubstitutes" . "0")))
+ ,@(if allowed-references
+ `(("allowedReferences"
+ . ,(string-join allowed-references)))
+ '())
+ ,@(if disallowed-references
+ `(("disallowedReferences"
+ . ,(string-join disallowed-references)))
+ '())
+ ,@(if leaked-env-vars
+ `(("impureEnvVars"
+ . ,(string-join leaked-env-vars)))
+ '())
+ ,@(match properties
+ (() '())
+ (lst `(("guix properties"
+ . ,(object->string properties)))))
+ ,@env-vars)))
(match references-graphs
(((file . path) ...)
(let ((value (map (cut string-append <> " " <>)
@@ -967,7 +970,7 @@ (define* (derivation store name builder args
(filter-map input->derivation-input inputs))
derivation-input<?))
(env-vars (sort (env-vars-with-empty-outputs
- (user+system-env-vars))
+ (user+system-env-vars inputs))
(lambda (e1 e2)
(string<? (car e1) (car e2)))))
(drv-masked (make-derivation outputs inputs sources
diff --git a/tests/derivations.scm b/tests/derivations.scm
index 72ea9aa9cc..c157128f39 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -1105,14 +1105,16 @@ (define %coreutils
(let-values (((build download)
(derivation-build-plan store
(list (derivation-input drv2)))))
- ;; Although DRV2 is available as a substitute, we must build its
- ;; dependency, DRV1, due to #:substitutable? #f.
- (and (match download
- (((= substitutable-path item))
- (string=? item (derivation->output-path drv2))))
+ ;; DRV2 is *not* available as a substitute, since it has drv1 as
+ ;; input, and the non-substitutability is viral to avoid
+ ;; distributing non-substitutable items that could have become
+ ;; embedded, for example in an initrd.
+ (and (null? download)
(match build
- (((= derivation-file-name build))
- (string=? build (derivation-file-name drv1))))))))))
+ (((= derivation-file-name build1)
+ (= derivation-file-name build2))
+ (string=? build1 (derivation-file-name drv1))
+ (string=? build2 (derivation-file-name drv2))))))))))
(test-assert "derivation-build-plan and substitutes, local build"
(with-store store
--
2.48.1
Maxim Cournoyer wrote 4 weeks ago
Re: bug#55231: [PATCH v6] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . maximedevos@telenet.be)(address . maximedevos@telenet.be)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . Andreas Enge)(address . andreas@enge.fr)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
87frke3v6e.fsf_-_@gmail.com
Hi Morgan,

I needed to do some changes and adjust one test, but in v6 the
derivations tests now pass, and the regular operation of
Guix appears otherwise unaffected, which is good (I don't need to
rebuild say, Libreoffice).

Could you test?

--
Thanks,
Maxim
Maxim Cournoyer wrote 4 weeks ago
Re: Understanding #:substitutable? and #55231
(name . Maxime Devos)(address . maximedevos@telenet.be)(name . GNU Guix maintainers)(address . guix-maintainers@gnu.org)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(address . 55231@debbugs.gnu.org)
87bjv23t46.fsf@gmail.com
Hi Maxime,

Some of your replies in this thread are overly aggressive, in clear
violation of our Code of Conduct. Please refrain from singling out a
group of people and assigning labels to them, or calling out someone
specifically in a negative light.

Since this is not the first time this has happened and has been flagged
by the community, the Guix co-maintainers are putting you on a 2-week
temporary ban starting now and ending on *March 2nd, 14h00 UTC*. This
should give you ample time to re-read our Code of Conduct.

Please refrain from all interaction with the community during this
period, including sending mails to public Guix lists or the bug tracker,
or on the project IRC channels. This includes responding to any
messages that may (also) be addressed to you. Attempting to evade this
short ban will result in a longer one.

Maxim,
On behalf of the Guix co-maintainers.
Morgan Arnold wrote 4 weeks ago
Re: bug#55231: [PATCH v6] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . ludo@gnu.org)(address . ludo@gnu.org)(name . john.kehayias@protonmail.com)(address . john.kehayias@protonmail.com)(name . Andreas Enge)(address . andreas@enge.fr)(name . kaelyn.alexi@protonmail.com)(address . kaelyn.alexi@protonmail.com)(name . guix-devel@gnu.org)(address . guix-devel@gnu.org)(name . 55231@debbugs.gnu.org)(address . 55231@debbugs.gnu.org)
xuCxCqhMsfsl2QgR2gPQJ4Ou-cYLgOTv73lISH6TWDlNhQ_sXP_Wq1baCEfdomXPNtwePOflmD54JNNP7yFT5r05woVfDtVumVlT7sgZAxM=@proton.me
Hi Maxim,

Your help is much appreciated! The changes all look good, but there is one thing which is alarming me somewhat. Perhaps I am misunderstanding how the `substitutable-derivation?` function actually operates, but if I apply these patches and then run, say:

```
(use-modules (guix) (gnu) (gnu packages bash))
(define store (open-connection))
(display (substitutable-derivation? (package-derivation store bash-minimal)))
```

it prints `#f`, which seems quite contrary to what I would expect. Oddly enough, despite this, Guix still seems to fetch a substitute for `bash-minimal` from Cuirass. In this sense it doesn't cause a problem, but I don't understand why the above script prints `#f` despite Guix fetching a substitute.

Hopefully this is just a misunderstanding on my part and the changes are actually completely fine.

Best,

Morgan
Ludovic Courtès wrote 4 weeks ago
Re: bug#55231: [PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Josselin Poiret)(address . dev@jpoiret.xyz)(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Brian Cully)(address . bjc@spork.org)(name . Leo Famulari)(address . leo@famulari.name)(name . Andreas Enge)(address . andreas@enge.fr)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . Mathieu Othacehe)(address . othacehe@gnu.org)(name . John Kehayias)(address . john.kehayias@protonmail.com)(name . Christopher Baines)(address . guix@cbaines.net)(address . 55231@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
878qq5pz2x.fsf_-_@gnu.org
Hello,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (13 lines)
> From: Morgan Arnold <morgan.arnold@proton.me>
>
> This commit changes the conditions under which derivations, as
> constructed by the `derivation' procedure, are made substitutable, to
> prevent potential copyright violations related to the construction of
> substitutable initrds including non-substitutable derivations (in
> particular, ZFS).
>
> This change prevents such copyright violations by only marking a derivation as
> substitutable if it is itself marked substitutable along all of its inputs.
> This means that non-substitutable derivations propagate to other derivations
> using them as input.

Hmm.

Toggle quote (2 lines)
> + (define (user+system-env-vars inputs)

[...]

Toggle quote (4 lines)
> + (let* ((substitutable-inputs? (every substitutable-derivation?
> + (map derivation-input-derivation
> + inputs)))

This change doesn’t come for free. I didn’t follow the discussion, but
adding overhead to such a core component to accommodate ZFS sounds
questionable to me.

Toggle quote (5 lines)
> + ;; DRV2 is *not* available as a substitute, since it has drv1 as
> + ;; input, and the non-substitutability is viral to avoid
> + ;; distributing non-substitutable items that could have become
> + ;; embedded, for example in an initrd.

Who would distribute it though? A build farm building a ZFS-enabled
initrd, right? Is that a real use case? (Perhaps this has already been
answered before; please let me know what I should look at, it’s a long
discussion!)

Ludo’.
Morgan Arnold wrote 4 weeks ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Josselin Poiret)(address . dev@jpoiret.xyz)(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . Mathieu Othacehe)(address . othacehe@gnu.org)(name . Brian Cully)(address . bjc@spork.org)(name . Leo Famulari)(address . leo@famulari.name)(name . Andreas Enge)(address . andreas@enge.fr)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . John Kehayias)(address . john.kehayias@protonmail.com)(name . Christopher Baines)(address . guix@cbaines.net)(address . 55231@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
Z_R-GqCPE0Fil07ukiYc7ubqjVk39lZIheRItdeE-lJyIPG7MrFM9QBKomWR5mX72vDU5tIFJCmVwhYekOMTh0DlsHVA2KggPchBO2ChZ-o=@proton.me
Hi Ludo,

I'll try to (hopefully accurately) summarise the discussion.

Toggle quote (5 lines)
> Who would distribute it though? A build farm building a ZFS-enabled
> initrd, right? Is that a real use case? (Perhaps this has already been
> answered before; please let me know what I should look at, it’s a long
> discussion!)

As you note, the only person who would distribute such a pre-compiled initrd would be someone who built one and shared it, say with `guix publish`. A lot of the discussion essentially boils down to one question: is Guix responsible only for not committing copyright violations itself, say by not distributing such a pre-compiled initrd itself, or is Guix also responsible for putting in guardrails to prevent users from accidentally committing copyright violations? If you subscribe to the former view, then the original changes proposed by Brian are entirely acceptable as is. If, instead, you subscribe to the latter view, then this change may be unacceptable, as it facilitates the accidental commission of copyright violations by users of Guix. The changes made here to derivations are an attempt to allow users to create ZFS-compatible initrds in a manner which is compatible with the latter (more conservative, in some sense) view of the responsibilities of Guix.

Toggle quote (9 lines)
> > + (let* ((substitutable-inputs? (every substitutable-derivation?
> > + (map derivation-input-derivation
> > + inputs)))
>
>
> This change doesn’t come for free. I didn’t follow the discussion, but
> adding overhead to such a core component to accommodate ZFS sounds
> questionable to me.

I agree that this is quite a lot of overhead. However, if one subscribes to the second view regarding the responsibilities of Guix, then some change like this seems to me to be required if we are to support Guix on ZFS at all. It might be possible to have the best of both worlds, by introducing a new parameter to the `derivation` function which controls whether or not `#:substitutable? #f` has this propagating behaviour. We could then restrict these large-overhead computations over entire dependency graphs to initrds only, which I think would reduce the overhead to an acceptable level. If the consensus is that we ought to be preventing users from accidentally committing copyright violations, and that the level of overhead introduced by this change is unacceptable, then I think that the way forward is by implementing this new parameter, say `#:propagating-substitutable?` or similar.

Best,

Morgan
Leo Famulari wrote 4 weeks ago
Re: bug#55231: [PATCH v1] initrd: Allow extra search paths wit h ‘initrd-extra-module-paths’
(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Josselin Poiret)(address . dev@jpoiret.xyz)(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . Mathieu Othacehe)(address . othacehe@gnu.org)(name . Brian Cully)(address . bjc@spork.org)(name . Andreas Enge)(address . andreas@enge.fr)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . John Kehayias)(address . john.kehayias@protonmail.com)(name . Christopher Baines)(address . guix@cbaines.net)(address . 55231@debbugs.gnu.org)(name . zimoun)(address . zimon.toutoune@gmail.com)
fc0a8c3e-d5b8-43a2-80de-0232d0be4f1d@app.fastmail.com
On Sun, Feb 16, 2025, at 13:25, Morgan Arnold wrote:
Toggle quote (16 lines)
> As you note, the only person who would distribute such a pre-compiled
> initrd would be someone who built one and shared it, say with `guix
> publish`. A lot of the discussion essentially boils down to one
> question: is Guix responsible only for not committing copyright
> violations itself, say by not distributing such a pre-compiled initrd
> itself, or is Guix also responsible for putting in guardrails to
> prevent users from accidentally committing copyright violations? If you
> subscribe to the former view, then the original changes proposed by
> Brian are entirely acceptable as is. If, instead, you subscribe to the
> latter view, then this change may be unacceptable, as it facilitates
> the accidental commission of copyright violations by users of Guix. The
> changes made here to derivations are an attempt to allow users to
> create ZFS-compatible initrds in a manner which is compatible with the
> latter (more conservative, in some sense) view of the responsibilities
> of Guix.

Thanks for your work writing this summary, Morgan.

I think the latter point of view, the "conservative" view, actually represents a somewhat radical break from how the Guix project has organized itself thus far. We've always focused on the GNU "freedom zero": the freedom to use the software as one sees fit.


If we start hard-coding restrictions on how users can use Guix and the free software it provides, we are turning our back on that value.

Second, I think the discussion here is being clouded by the fact that ZFS is a cause célèbre in the world of copyleft licensing.

It's the same as if someone linked OpenSSL 1.0 with a GPL program for their own use. That was a useful thing to create, but the old OpenSSL license did not permit redistribution. Although Guix tried avoid creating these combinations in our packages, we would have never sought to prevent users from doing so.

To build on that scenario, I could link ZFS with Linux, build it on my offload server, and use it on the servers I control. That is, I'd be substituting it. But I would not be distributing it to a 3rd party, so the copyright licenses would not apply.

Leo
Maxim Cournoyer wrote 4 weeks ago
Re: bug#55231: [PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Josselin Poiret)(address . dev@jpoiret.xyz)(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Brian Cully)(address . bjc@spork.org)(name . Leo Famulari)(address . leo@famulari.name)(name . Andreas Enge)(address . andreas@enge.fr)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . Mathieu Othacehe)(address . othacehe@gnu.org)(name . John Kehayias)(address . john.kehayias@protonmail.com)(name . Christopher Baines)(address . guix@cbaines.net)(address . 55231@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
87eczx1f2w.fsf@gmail.com
Hi Ludo,

Ludovic Courtès <ludo@gnu.org> writes:

[...]

Toggle quote (8 lines)
>> + (let* ((substitutable-inputs? (every substitutable-derivation?
>> + (map derivation-input-derivation
>> + inputs)))
>
> This change doesn’t come for free. I didn’t follow the discussion, but
> adding overhead to such a core component to accommodate ZFS sounds
> questionable to me.

I've measured with strace -fc and time, and the difference appeared
negligible.

Toggle quote (10 lines)
>> + ;; DRV2 is *not* available as a substitute, since it has drv1 as
>> + ;; input, and the non-substitutability is viral to avoid
>> + ;; distributing non-substitutable items that could have become
>> + ;; embedded, for example in an initrd.
>
> Who would distribute it though? A build farm building a ZFS-enabled
> initrd, right? Is that a real use case? (Perhaps this has already been
> answered before; please let me know what I should look at, it’s a long
> discussion!)

It's that far fetch that substitute servers like berlin or third party
ones could want to use ZFS RAID 5/6 themselves to minimize disk usage
while having some redundancy, so yes, that's the most likely use case, I
think.

Then a downstream user of such build farm/substitute server could use
ZFS themselves and find themselves fetching ready-built initrd's binary
containing the ZFS module, which should not be happening due to the
license incompatibility between ZFS's CDDL and the Linux kernel GPL2
only.

--
Thanks,
Maxim
Maxim Cournoyer wrote 4 weeks ago
Re: [bug#55231] Understanding #:substitutable? and #55231
(name . Morgan Arnold via Development of GNU Guix and the GNU System distribution.)(address . guix-devel@gnu.org)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Leo Famulari)(address . leo@famulari.name)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(address . 55231@debbugs.gnu.org)
87tt8szte9.fsf@gmail.com
Hi Leo, Morgan, all,

Morgan Arnold via "Development of GNU Guix and the GNU System
distribution." <guix-devel@gnu.org> writes:

Toggle quote (8 lines)
> Hi Leo,
>
>> If Maxime's concern is that Guix should not make it too easy for users
>> to distribute software for which they do not have the license, I hear
>> that concern, but I argue that we shouldn't go very far with it. Of
>> course, Guix itself should not do that kind of thing, but we shouldn't
>> go out of our way to prevent users from doing so.

There is no copyright violation if the user combines ZFS and Linux
privately (no distribution). So ideally we should be able to define
'#:substitutable? #f' on the zfs package and obtain this outcome, but
that's currently fragile as any substitute server having an initrd with
zfs support in its cache would serve it in binary form, which is not
what the user nor what the substitute server administrator intended.

It's not good to surprise user expectations in such a way, especially if
it can expose them to legal problems (no matter how unlikely).

I hope that helps put a light on what the remaining issue is, which
should be fixed (in my opinion) before #55231 can be merged.

--
Thanks,
Maxim
Ludovic Courtès wrote 4 weeks ago
Re: bug#55231: [PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Josselin Poiret)(address . dev@jpoiret.xyz)(name . Ian Eure)(address . ian@retrospec.tv)(name . Brian Cully)(address . bjc@spork.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(name . Leo Famulari)(address . leo@famulari.name)(name . Andreas Enge)(address . andreas@enge.fr)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . Mathieu Othacehe)(address . othacehe@gnu.org)(name . John Kehayias)(address . john.kehayias@protonmail.com)(name . Christopher Baines)(address . guix@cbaines.net)(address . 55231@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
8734gcopqp.fsf_-_@gnu.org
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (15 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
> [...]
>
>>> + (let* ((substitutable-inputs? (every substitutable-derivation?
>>> + (map derivation-input-derivation
>>> + inputs)))
>>
>> This change doesn’t come for free. I didn’t follow the discussion, but
>> adding overhead to such a core component to accommodate ZFS sounds
>> questionable to me.
>
> I've measured with strace -fc and time, and the difference appeared
> negligible.

Not sure if that’s what you did, but I would time ‘guix build
libreoffice --no-grafts -d’ or something along these lines.

Toggle quote (16 lines)
>> Who would distribute it though? A build farm building a ZFS-enabled
>> initrd, right? Is that a real use case? (Perhaps this has already been
>> answered before; please let me know what I should look at, it’s a long
>> discussion!)
>
> It's that far fetch that substitute servers like berlin or third party
> ones could want to use ZFS RAID 5/6 themselves to minimize disk usage
> while having some redundancy, so yes, that's the most likely use case, I
> think.
>
> Then a downstream user of such build farm/substitute server could use
> ZFS themselves and find themselves fetching ready-built initrd's binary
> containing the ZFS module, which should not be happening due to the
> license incompatibility between ZFS's CDDL and the Linux kernel GPL2
> only.

Yes, I understand. But my point is, in practice, our build farms are
not going to publish such binaries. So really the use case is a
hypothetical build farm (or user running ‘guix publish --advertise’) who
happens to have a local ZFS+Linux build. It’s possible, but it’s
arguably pretty niche.

The cost/benefit ratio doesn’t look great to me.

Ludo’.
Ludovic Courtès wrote 4 weeks ago
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Josselin Poiret)(address . dev@jpoiret.xyz)(name . Ian Eure)(address . ian@retrospec.tv)(name . Brian Cully)(address . bjc@spork.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(name . Leo Famulari)(address . leo@famulari.name)(name . Andreas Enge)(address . andreas@enge.fr)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . Mathieu Othacehe)(address . othacehe@gnu.org)(name . John Kehayias)(address . john.kehayias@protonmail.com)(name . Christopher Baines)(address . guix@cbaines.net)(address . 55231@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
87mseknaus.fsf_-_@gnu.org
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (5 lines)
>>> + ;; DRV2 is *not* available as a substitute, since it has drv1 as
>>> + ;; input, and the non-substitutability is viral to avoid
>>> + ;; distributing non-substitutable items that could have become
>>> + ;; embedded, for example in an initrd.

Also, there are legitimate cases where the current semantics (where X is
not distributable but its dependents are) are what’s expected and relied
on.

We have some of these in HPC packages but also, more importantly, lots
of them in Guix proper: ‘imported-files/derivation’, ‘gexp->script’,
etc. produce non-substitutable derivations, but we definitely want its
dependents to be substitutable (otherwise ‘guix pull’ and large parts of
Guix System would not have substitutes, for instance.)

Ludo’.
Morgan Arnold wrote 4 weeks ago
[PATCH v7 1/4] Allow copying of out-of-tree modules to the Linux initrd.
(address . 55231@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Brian Cully)(address . bjc@spork.org)
ac97f3aba316e96247d42d5eb41b14b647462831.1739802789.git.morgan.arnold@proton.me
From: Brian Cully <bjc@spork.org>

With this patch, modules for ‘initrd-modules’ will not only be searched for in
the in-tree Linux modules, but also any additional modules specified in
‘kernel-loadable-modules’.

* gnu/build/linux-modules.scm (find-module-file): Change DIRECTORY argument to
DIRECTORIES. Now takes a list of directories to search, rather than a single
one.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
argument to PACKAGES. Now contains a list of file-like objects to search for
modules.
(raw-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (flat-linux-module-directory) along with the selected LINUX package.
(base-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
to (raw-initrd).
* gnu/system.scm (operating-system-initrd-file): Pass in operating system
definition's kernel-loadable-modules into (make-initrd) as
LINUX-EXTRA-MODULE-DIRECTORIES.
* doc/guix.texi (Initial RAM Disk): Document how out-of-tree modules can be
used.

Change-Id: Ic39f2abcfabc3ec34a71acce840038396bf9c82e
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
---
doc/guix.texi | 15 ++++++++++++
gnu/build/linux-modules.scm | 22 +++++++++++------
gnu/system.scm | 2 ++
gnu/system/linux-initrd.scm | 49 +++++++++++++++++++++++--------------
4 files changed, 62 insertions(+), 26 deletions(-)

Toggle diff (215 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index ce78068..3c7ece7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43346,6 +43346,21 @@ Initial RAM Disk
(initrd-modules (cons "megaraid_sas" %base-initrd-modules)))
@end lisp
+If a module listed in @code{initrd-modules} is not included in the
+Linux-libre kernel, then its location must be provided via the
+@code{kernel-loadable-modules} list.
+
+As an example, if you need the driver for a Realtek RTL8821CE wireless
+network adapter for mounting the root file system over NFS, your
+configuration might include the following:
+
+@lisp
+(operating-system
+ ;; @dots{}
+ (initrd-modules (cons "8821ce" %base-initrd-modules))
+ (kernel-loadable-modules (list (list rtl8821ce-linux-module "module"))))
+@end lisp
+
@defvar %base-initrd-modules
This is the list of kernel modules included in the initrd by default.
@end defvar
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 32baf6c..24bbe08 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -246,8 +246,8 @@ (define (file-name->module-name file)
'.ko[.gz|.xz|.zst]' and normalizing it."
(normalize-module-name (strip-extension (basename file))))
-(define (find-module-file directory module)
- "Lookup module NAME under DIRECTORY, and return its absolute file name.
+(define (find-module-file directories module)
+ "Lookup module NAME under DIRECTORIES, and return its absolute file name.
NAME can be a file name with or without '.ko', or it can be a module name.
Raise an error if it could not be found.
@@ -255,6 +255,9 @@ (define (find-module-file directory module)
module names usually (always?) use underscores as the inter-word separator,
whereas file names often, but not always, use hyphens. Examples:
\"usb-storage.ko\", \"serpent_generic.ko\"."
+ (define directories (if (pair? directories)
+ directories
+ (list directories))) ;for backward compatibility
(define names
;; List of possible file names. XXX: It would of course be cleaner to
;; have a database that maps module names to file names and vice versa,
@@ -268,16 +271,19 @@ (define (find-module-file directory module)
(else chr)))
module))))
- (match (find-files directory
- (lambda (file stat)
- (member (strip-extension
- (basename file)) names)))
+ (match (append-map (lambda (directory)
+ (find-files directory
+ (lambda (file _)
+ (member (strip-extension
+ (basename file))
+ names))))
+ directories)
((file)
file)
(()
- (error "kernel module not found" module directory))
+ (error "kernel module not found" module directories))
((_ ...)
- (error "several modules by that name" module directory))))
+ (error "several modules by that name" module directories))))
(define* (recursive-module-dependencies files
#:key (lookup-module dot-ko))
diff --git a/gnu/system.scm b/gnu/system.scm
index 8df871f..1921b60 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1373,6 +1373,8 @@ (define (operating-system-initrd-file os)
#:linux (operating-system-kernel os)
#:linux-modules
(operating-system-initrd-modules os)
+ #:linux-extra-module-directories
+ (operating-system-kernel-loadable-modules os)
#:mapped-devices mapped-devices
#:keyboard-layout (operating-system-keyboard-layout os)))
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index dc08edc..a8df905 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -120,13 +120,19 @@ (define* (expression->initrd exp
`(#:references-graphs (("closure" ,init))))
"/initrd.cpio.gz"))
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory packages modules)
"Return a flat directory containing the Linux kernel modules listed in
-MODULES and taken from LINUX."
+MODULES and taken from PACKAGES."
(define imported-modules
(source-module-closure '((gnu build linux-modules)
(guix build utils))))
+ (define package-inputs
+ (map (match-lambda
+ ((p o) (gexp-input p o))
+ (p (gexp-input p "out")))
+ packages))
+
(define build-exp
(with-imported-modules imported-modules
(with-extensions (list guile-zlib guile-zstd)
@@ -138,8 +144,9 @@ (define (flat-linux-module-directory linux modules)
(srfi srfi-26)
(ice-9 match))
- (define module-dir
- (string-append #$linux "/lib/modules"))
+ (define module-dirs
+ (map (cut string-append <> "/lib/modules")
+ '#$package-inputs))
(define builtin-modules
(match (find-files module-dir (lambda (file stat)
@@ -157,7 +164,7 @@ (define (flat-linux-module-directory linux modules)
(lset-difference string=? '#$modules builtin-modules))
(define modules
- (let* ((lookup (cut find-module-file module-dir <>))
+ (let* ((lookup (cut find-module-file module-dirs <>))
(modules (map lookup modules-to-lookup)))
(append modules
(recursive-module-dependencies
@@ -192,6 +199,7 @@ (define* (raw-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(pre-mount #t)
(mapped-devices '())
(keyboard-layout #f)
@@ -199,15 +207,16 @@ (define* (raw-initrd file-systems
qemu-networking?
volatile-root?
(on-error 'debug))
- "Return as a file-like object a raw initrd, with kernel
-modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specified
-on the kernel command line via 'root'. LINUX-MODULES is a list of kernel
-modules to be loaded at boot time. MAPPED-DEVICES is a list of device
-mappings to realize before FILE-SYSTEMS are mounted. PRE-MOUNT is a
-G-expression to evaluate before realizing MAPPED-DEVICES.
-HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include
-e2fsck/static or other packages needed by the initrd to check root partition.
+ "Return as a file-like object a raw initrd, with kernel modules taken from
+LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd,
+possibly in addition to the root file system specified on the kernel command
+line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at
+boot time. LINUX-EXTRA-MODULE-DIRECTORIES is a list of file-like objects which
+will be searched for modules in addition to the linux kernel. MAPPED-DEVICES
+is a list of device mappings to realize before FILE-SYSTEMS are mounted.
+HELPER-PACKAGES is a list of packages to be copied in the initrd. It may
+include e2fsck/static or other packages needed by the initrd to check root
+partition.
When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desired
console keyboard layout. This is done before MAPPED-DEVICES are set up and
@@ -243,7 +252,8 @@ (define* (raw-initrd file-systems
#~())))
(define kodir
- (flat-linux-module-directory linux linux-modules))
+ (flat-linux-module-directory (cons linux linux-extra-module-directories)
+ linux-modules))
(expression->initrd
(with-imported-modules (source-module-closure
@@ -390,6 +400,7 @@ (define* (base-initrd file-systems
#:key
(linux linux-libre)
(linux-modules '())
+ (linux-extra-module-directories '())
(mapped-devices '())
(keyboard-layout #f)
qemu-networking?
@@ -410,9 +421,10 @@ (define* (base-initrd file-systems
QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd.
The initrd is automatically populated with all the kernel modules necessary
-for FILE-SYSTEMS and for the given options. Additional kernel
-modules can be listed in LINUX-MODULES. They will be added to the initrd, and
-loaded at boot time in the order in which they appear."
+for FILE-SYSTEMS and for the given options. Additional kernel modules can be
+listed in LINUX-MODULES. Additional directories for modules can be listed in
+LINUX-EXTRA-MODULE-DIRECTORIES. They will be added to the initrd, and loaded
+at boot time in the order in which they appear."
(define linux-modules*
;; Modules added to the initrd and loaded from the initrd.
`(,@linux-modules
@@ -432,6 +444,7 @@ (define* (base-initrd file-systems
(raw-initrd file-systems
#:linux linux
#:linux-modules linux-modules*
+ #:linux-extra-module-directories linux-extra-module-directories
#:mapped-devices mapped-devices
#:helper-packages helper-packages
#:keyboard-layout keyboard-layout

base-commit: b30669e15d2e8c3d1b74b32f77e2095682aab4ca
--
2.47.1
Morgan Arnold wrote 4 weeks ago
[PATCH v7 2/4] derivations: Fix indentation.
(address . 55231@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
9e47b0e6cfb99f4d5cd4a3e4c4e1d6ac13973f4f.1739802789.git.morgan.arnold@proton.me
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>

* guix/derivations.scm (derivation): Fix indentation.

Change-Id: I2407b59788ce335c21c181d9f9e3f26a359e9bf5
---
guix/derivations.scm | 46 ++++++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 23 deletions(-)

Toggle diff (71 lines)
diff --git a/guix/derivations.scm b/guix/derivations.scm
index bef98cd..ffa69e9 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -841,30 +841,30 @@ (define* (derivation store name builder args
;; corresponding environment variable.
(match drv
(($ <derivation> outputs inputs sources
- system builder args env-vars)
+ system builder args env-vars)
(let* ((drv-hash (derivation-hash drv))
(outputs (map (match-lambda
- ((output-name . ($ <derivation-output>
- _ algo hash rec?))
- (let ((path
- (if hash
- (fixed-output-path name hash
- #:hash-algo algo
- #:output output-name
- #:recursive? rec?)
- (output-path output-name
- drv-hash name))))
- (cons output-name
- (make-derivation-output path algo
- hash rec?)))))
+ ((output-name . ($ <derivation-output>
+ _ algo hash rec?))
+ (let ((path
+ (if hash
+ (fixed-output-path name hash
+ #:hash-algo algo
+ #:output output-name
+ #:recursive? rec?)
+ (output-path output-name
+ drv-hash name))))
+ (cons output-name
+ (make-derivation-output path algo
+ hash rec?)))))
outputs)))
(make-derivation outputs inputs sources system builder args
(map (match-lambda
- ((name . value)
- (cons name
- (or (and=> (assoc-ref outputs name)
- derivation-output-path)
- value))))
+ ((name . value)
+ (cons name
+ (or (and=> (assoc-ref outputs name)
+ derivation-output-path)
+ value))))
env-vars)
#f)))))
@@ -910,10 +910,10 @@ (define* (derivation store name builder args
;; Return a variant of ENV-VARS where each OUTPUTS is associated with an
;; empty string, even outputs that do not appear in ENV-VARS.
(let ((e (map (match-lambda
- ((name . val)
- (if (member name outputs)
- (cons name "")
- (cons name val))))
+ ((name . val)
+ (if (member name outputs)
+ (cons name "")
+ (cons name val))))
env-vars)))
(fold (lambda (output-name env-vars)
(if (assoc output-name env-vars)
--
2.47.1
Morgan Arnold wrote 4 weeks ago
[PATCH v7 3/4] tests: Remove extraneous 'with-store' in derivations test.
(address . 55231@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
eaa4e9797601f1da7a63e637483c0bb8daa2b595.1739802789.git.morgan.arnold@proton.me
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>

* tests/derivations.scm ("derivation fails but keep going"): Remove extraneous
'with-store'.

Change-Id: If30c2d457504b8524cd167f1a145fbbea61b513c
---
tests/derivations.scm | 45 +++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 23 deletions(-)

Toggle diff (58 lines)
diff --git a/tests/derivations.scm b/tests/derivations.scm
index efcd21f..72ea9aa 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -150,29 +150,28 @@ (define* (directory-contents dir #:optional (slurp get-bytevector-all))
(test-assert "derivation fails but keep going"
;; In keep-going mode, 'build-derivations' should fail because of D1, but it
;; must return only after D2 has succeeded.
- (with-store store
- (let* ((d1 (derivation %store "fails"
- %bash `("-c" "false")
- #:sources (list %bash)))
- (d2 (build-expression->derivation %store "sleep-then-succeed"
- `(begin
- ,(random-text)
- ;; XXX: Hopefully that's long
- ;; enough that D1 has already
- ;; failed.
- (sleep 2)
- (mkdir %output)))))
- (set-build-options %store
- #:use-substitutes? #f
- #:keep-going? #t)
- (guard (c ((store-protocol-error? c)
- (and (= 100 (store-protocol-error-status c))
- (string-contains (store-protocol-error-message c)
- (derivation-file-name d1))
- (not (valid-path? %store (derivation->output-path d1)))
- (valid-path? %store (derivation->output-path d2)))))
- (build-derivations %store (list d1 d2))
- #f))))
+ (let* ((d1 (derivation %store "fails"
+ %bash `("-c" "false")
+ #:sources (list %bash)))
+ (d2 (build-expression->derivation %store "sleep-then-succeed"
+ `(begin
+ ,(random-text)
+ ;; XXX: Hopefully that's long
+ ;; enough that D1 has already
+ ;; failed.
+ (sleep 2)
+ (mkdir %output)))))
+ (set-build-options %store
+ #:use-substitutes? #f
+ #:keep-going? #t)
+ (guard (c ((store-protocol-error? c)
+ (and (= 100 (store-protocol-error-status c))
+ (string-contains (store-protocol-error-message c)
+ (derivation-file-name d1))
+ (not (valid-path? %store (derivation->output-path d1)))
+ (valid-path? %store (derivation->output-path d2)))))
+ (build-derivations %store (list d1 d2))
+ #f)))
(test-assert "identical files are deduplicated"
;; Note: DATA must be longer than %DEDUPLICATION-MINIMUM-SIZE.
--
2.47.1
Morgan Arnold wrote 4 weeks ago
[PATCH v7 4/4] Propagate non-substitutability of derivations.
(address . 55231@debbugs.gnu.org)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
5b9eb2560f2602e147d7c0d4d9ecf6582b1fe3f3.1739802789.git.morgan.arnold@proton.me
This commit changes the conditions under which derivations, as
constructed by the `derivation' procedure, are made substitutable, to
prevent potential copyright violations related to the construction of
substitutable initrds including non-substitutable derivations (in
particular, ZFS).

This change prevents such copyright violations by only marking a derivation as
substitutable if it is itself marked substitutable along all of its inputs.
This means that non-substitutable derivations propagate to other derivations
using them as input.

Change-Id: I80ba4a371ee0c55a1294aff311d4e7b151055fac
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
---
gnu/system/linux-initrd.scm | 3 +-
guix/derivations.scm | 59 +++++++++++++++++++++----------------
tests/derivations.scm | 16 +++++-----
3 files changed, 44 insertions(+), 34 deletions(-)

Toggle diff (138 lines)
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index a8df905..98a4c6e 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -117,7 +117,8 @@ (define* (expression->initrd exp
(file-append (computed-file name builder
#:options
- `(#:references-graphs (("closure" ,init))))
+ `(#:references-graphs (("closure" ,init))
+ #:propagating-substitutable? #t))
"/initrd.cpio.gz"))
(define (flat-linux-module-directory packages modules)
diff --git a/guix/derivations.scm b/guix/derivations.scm
index ffa69e9..7682c90 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -804,6 +804,7 @@ (define* (derivation store name builder args
allowed-references disallowed-references
leaked-env-vars local-build?
(substitutable? #t)
+ (propagating-substitutable? #f)
(properties '())
(%deprecation-warning? #t))
"Build a derivation with the given arguments, and return the resulting
@@ -832,7 +833,9 @@ (define* (derivation store name builder args
derivations where the costs of data transfers would outweigh the benefits.
When SUBSTITUTABLE? is false, declare that substitutes of the derivation's
-output should not be used.
+output should not be used. When PROPAGATING-SUBSTITUTABLE? is true, declare
+that substitutes of the derivation's output should not be used if any of the
+derivation's inputs are not substitutable.
PROPERTIES must be an association list describing \"properties\" of the
derivation. It is kept as-is, uninterpreted, in the derivation."
@@ -868,33 +871,37 @@ (define* (derivation store name builder args
env-vars)
#f)))))
- (define (user+system-env-vars)
+ (define (user+system-env-vars inputs)
;; Some options are passed to the build daemon via the env. vars of
;; derivations (urgh!). We hide that from our API, but here is the place
;; where we kludgify those options.
- (let ((env-vars `(,@(if local-build?
- `(("preferLocalBuild" . "1"))
- '())
- ,@(if (not substitutable?)
- `(("allowSubstitutes" . "0"))
- '())
- ,@(if allowed-references
- `(("allowedReferences"
- . ,(string-join allowed-references)))
- '())
- ,@(if disallowed-references
- `(("disallowedReferences"
- . ,(string-join disallowed-references)))
- '())
- ,@(if leaked-env-vars
- `(("impureEnvVars"
- . ,(string-join leaked-env-vars)))
- '())
- ,@(match properties
- (() '())
- (lst `(("guix properties"
- . ,(object->string properties)))))
- ,@env-vars)))
+ (let* ((substitutable-inputs? (every substitutable-derivation?
+ (map derivation-input-derivation
+ inputs)))
+ (env-vars `(,@(if local-build?
+ `(("preferLocalBuild" . "1"))
+ '())
+ ,@(if (and substitutable? (or (not propagating-substitutable?)
+ substitutable-inputs?))
+ '()
+ `(("allowSubstitutes" . "0")))
+ ,@(if allowed-references
+ `(("allowedReferences"
+ . ,(string-join allowed-references)))
+ '())
+ ,@(if disallowed-references
+ `(("disallowedReferences"
+ . ,(string-join disallowed-references)))
+ '())
+ ,@(if leaked-env-vars
+ `(("impureEnvVars"
+ . ,(string-join leaked-env-vars)))
+ '())
+ ,@(match properties
+ (() '())
+ (lst `(("guix properties"
+ . ,(object->string properties)))))
+ ,@env-vars)))
(match references-graphs
(((file . path) ...)
(let ((value (map (cut string-append <> " " <>)
@@ -967,7 +974,7 @@ (define* (derivation store name builder args
(filter-map input->derivation-input inputs))
derivation-input<?))
(env-vars (sort (env-vars-with-empty-outputs
- (user+system-env-vars))
+ (user+system-env-vars inputs))
(lambda (e1 e2)
(string<? (car e1) (car e2)))))
(drv-masked (make-derivation outputs inputs sources
diff --git a/tests/derivations.scm b/tests/derivations.scm
index 72ea9aa..c157128 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -1105,14 +1105,16 @@ (define %coreutils
(let-values (((build download)
(derivation-build-plan store
(list (derivation-input drv2)))))
- ;; Although DRV2 is available as a substitute, we must build its
- ;; dependency, DRV1, due to #:substitutable? #f.
- (and (match download
- (((= substitutable-path item))
- (string=? item (derivation->output-path drv2))))
+ ;; DRV2 is *not* available as a substitute, since it has drv1 as
+ ;; input, and the non-substitutability is viral to avoid
+ ;; distributing non-substitutable items that could have become
+ ;; embedded, for example in an initrd.
+ (and (null? download)
(match build
- (((= derivation-file-name build))
- (string=? build (derivation-file-name drv1))))))))))
+ (((= derivation-file-name build1)
+ (= derivation-file-name build2))
+ (string=? build1 (derivation-file-name drv1))
+ (string=? build2 (derivation-file-name drv2))))))))))
(test-assert "derivation-build-plan and substitutes, local build"
(with-store store
--
2.47.1
Morgan Arnold wrote 4 weeks ago
Re: [bug#55231] Understanding #:substitutable? and #55231
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Leo Famulari)(address . leo@famulari.name)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . Morgan Arnold via "Development of GNU Guix and the GNU System distribution.")(address . guix-devel@gnu.org)(address . 55231@debbugs.gnu.org)
hJk91AlZqpRt-5zXLGuK6mnSWVqWj-rO8Btsigf2D7Hu49IOViNUfnFgMhNE1yZ9Bapwx_F7x8YQTLKhGbBVkmBoJa8NP7aHRr9e0UBNz-o=@proton.me
Hi Maxim,

Toggle quote (6 lines)
> It's not good to surprise user expectations in such a way, especially if
> it can expose them to legal problems (no matter how unlikely).
>
> I hope that helps put a light on what the remaining issue is, which
> should be fixed (in my opinion) before #55231 can be merged.

I am inclined to agree with this view. I've attempted in this series of patches to address the issue in a manner which prevents this surprising of user expectations, as well as addressing Ludo's performance concerns by restricting the checks on dependency graphs to initrds only. This will still have some performance implications, of course, but should be much less than performing the checks on every single package. I would appreciate you and Ludo's opinions on this. In particular, if it addresses the user expectations concern for you, and if it addresses Ludo's performance concerns. I know that adding an extra parameter to `derivation` is not ideal, but it's the only way that I can see to avoid performing the check on every single derivation.

Best,

Morgan

P.S. My commit message should probably be modified, and I assume that there are some documentation changes that ought to be made that I'm missing here, I just wanted to solicit opinions on the functionality.
Ludovic Courtès wrote 3 weeks ago
Re: [bug#55231] [PATCH v6 3/4] tests: Remove extraneous 'with-store' in derivations test.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Brian Cully)(address . bjc@spork.org)(name . Maxime Devos)(address . maximedevos@telenet.be)(name . Leo Famulari)(address . leo@famulari.name)(name . Andreas Enge)(address . andreas@enge.fr)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . John Kehayias)(address . john.kehayias@protonmail.com)(address . 55231@debbugs.gnu.org)
87wmdjbo3y.fsf@gnu.org
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (5 lines)
> * tests/derivations.scm ("derivation fails but keep going"): Remove extraneous
> 'with-store'.
>
> Change-Id: If30c2d457504b8524cd167f1a145fbbea61b513c

LGTM!
Ludovic Courtès wrote 3 weeks ago
Re: [bug#55231] [PATCH v6 1/4] Allow copying of out-of-tree modules to the Linux initrd.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Brian Cully)(address . bjc@spork.org)(name . Maxime Devos)(address . maximedevos@telenet.be)(name . Leo Famulari)(address . leo@famulari.name)(name . Andreas Enge)(address . andreas@enge.fr)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . Wilko Meyer)(address . w@wmeyer.eu)(name . John Kehayias)(address . john.kehayias@protonmail.com)(address . 55231@debbugs.gnu.org)
87seo7bnzl.fsf@gnu.org
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (26 lines)
> From: Brian Cully <bjc@spork.org>
>
> With this patch, modules for ‘initrd-modules’ will not only be searched for in
> the in-tree Linux modules, but also any additional modules specified in
> ‘kernel-loadable-modules’.
>
> * gnu/build/linux-modules.scm (find-module-file): Change DIRECTORY argument to
> DIRECTORIES. Now takes a list of directories to search, rather than a single
> one.
> * gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
> argument to PACKAGES. Now contains a list of file-like objects to search for
> modules.
> (raw-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
> to (flat-linux-module-directory) along with the selected LINUX package.
> (base-initrd): Add LINUX-EXTRA-MODULE-DIRECTORIES keyword argument. Pass it
> to (raw-initrd).
> * gnu/system.scm (operating-system-initrd-file): Pass in operating system
> definition's kernel-loadable-modules into (make-initrd) as
> LINUX-EXTRA-MODULE-DIRECTORIES.
> * doc/guix.texi (Initial RAM Disk): Document how out-of-tree modules can be
> used.
>
> Change-Id: Ic39f2abcfabc3ec34a71acce840038396bf9c82e
> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>

I haven’t tried running system tests or anything but it looks great to
me!

Clearly it was a bug that ‘kernel-loadable-modules’ was not taken into
account.

BTW, I (and I think others) would usually use the “Co-authored-by” tag
rather than “Modified-by”.

Thanks,
Ludo’.
Maxim Cournoyer wrote 3 weeks ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(name . Ian Eure)(address . ian@retrospec.tv)(name . Morgan Arnold)(address . morgan.arnold@proton.me)(name . Brian Cully)(address . bjc@spork.org)(name . Leo Famulari)(address . leo@famulari.name)(name . Andreas Enge)(address . andreas@enge.fr)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)(name . Felix Lechner)(address . felix.lechner@lease-up.com)(name . Wilko Meyer)(address . w@wmeyer.eu)(name . John Kehayias)(address . john.kehayias@protonmail.com)(address . 55231@debbugs.gnu.org)
87tt8nv0aa.fsf@gmail.com
Hi Ludovic,

Ludovic Courtès <ludo@gnu.org> writes:

[...]

Toggle quote (13 lines)
>> Change-Id: Ic39f2abcfabc3ec34a71acce840038396bf9c82e
>> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
>> Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
>
> I haven’t tried running system tests or anything but it looks great to
> me!
>
> Clearly it was a bug that ‘kernel-loadable-modules’ was not taken into
> account.
>
> BTW, I (and I think others) would usually use the “Co-authored-by” tag
> rather than “Modified-by”.

I use Modified-by when my changes are non-substantial
(e.g. cosmetic/nitpicky adjustments), Co-authored-by otherwise, which I
assume exist for these purposes :-).

I'll persist a bit with the #:substitutable? thing, which would be nice
to resolve before this gets merged, as as been discussed before.

--
Thanks,
Maxim
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 55231@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 55231
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help