Subject: bug#55909: linux-libre-arm64-generic with %base-initrd-module => kernel module not found "ahci"

From: Tom Fitzhenry <[email-masked]>
Date: Sun, 12 Jun 2022 00:13:52 +1000

When building linux-libre-arm64-generic with %base-initrd-modules, the
linux-modules derivation fails with `kernel module not found "ahci"'.

Here's the steps to reproduce:

--8<---------------cut here---------------start------------->8---
$ cat minimal.scm
(use-modules
 (gnu packages linux)
 (gnu bootloader)
 (gnu bootloader grub)
 (gnu system file-systems))

(operating-system
  (host-name "foobar")
  (timezone "Australia/Sydney")
  (locale "en_AU.utf8")
  (bootloader (bootloader-configuration
               (bootloader grub-efi-removable-bootloader)
               (targets '("/boot/efi"))))
  (kernel linux-libre-arm64-generic)
  (file-systems (cons* (file-system
                         (device (file-system-label "my-root"))
                         (mount-point "/")
                         (type "ext4"))
                       (file-system
                         (device (file-system-label "boot"))
                         (mount-point "/boot/efi")
                         (type "vfat"))
                       %base-file-systems)))
$ guix time-machine --commit=a99015c8783eb5281618173779a0550b15a79617 --
  system reconfigure minimal.scm
$ zcat /var/log/guix/drvs/f3/2ljaayhsdlza6napn6d62ra1x5cm5f-linux-modules.drv.gz
Backtrace:
           5 (primitive-load "/gnu/store/bpaj7mfbws69b7pfwrdl7dw5pzs?")
In ice-9/eval.scm:
    619:8  4 (_ #f)
   626:19  3 (_ #<directory (guile-user) 5ebc80>)
   293:34  2 (_ #(#<directory (guile-user) 5ebc80> #<procedure loo?>))
In srfi/srfi-1.scm:
   586:17  1 (map1 ("ahci" "usb-storage" "uas" "usbhid" "hid-gene?" ?))
In gnu/build/linux-modules.scm:
    257:5  0 (_)

gnu/build/linux-modules.scm:257:5: kernel module not found "ahci" "/gnu/store/lvdihzd96kwqf31gs37n2b8ykdv1jp07-linux-libre-arm64-generic-5.17.14/lib/modules"
--8<---------------cut here---------------end--------------->8---

This fails beacuse %base-initrd-modules expects the "ahci" module, but
linux-libre-arm64-generic has that built in[0].

Workarounds for users include:

* use linux-libre-5.17, which has the disadvantage that
  linux-libre-5.17 is built from aux-files/linux-libre/*.conf rather
  than defconfig, thus making it less clear how much linux-libre-5.17
  has deviated from mainline's defconfig.
* don't use %base-initrd-modules, which has the disadvantage that users
  have to figure out which modules should be in their initrd
* disabling the check (?), which has the disadvantage that the check can be useful

Ideally users could use linux-libre-arm64-generic with
%base-initrd-modules. To do this, we could:

* replace "CONFIG_SATA_AHCI=m" with "CONFIG_SATA_AHCI=y" in
  gnu/packages/aux-files/linux-libre/*.conf .
* remove "ahci" from %base-initrd-modules

This amounts to converging aux-files/linux-libre/* towards the mainline
defconfigs. Is this a goal?

Thoughts?

0. CONFIG_SATA_AHCI=y, https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm64/configs/defconfig?h=v5.17.14#n291