kernel plugin _make_initrd fails to add given modules
Metadata
Current evaluation
Closed. Fixed by updating the kernel plugin to call modprobe individually for each kernel-initrd-module rather than passing them all at once, ensuring all specified drivers are correctly included in the initrd.
Suggested action: —
No scores available.
Issue body
The kernel plugin does not add given modules to the initrd. In the given snapcraft.yaml "ahci" is not added to initrd. This happens because all kernel-initrd-modules are added the the commandline:
modprobe -n --show-depends -d /test/parts/kernel/install -S 4.4.5-test+ squashfs ahci
instead of running modprobe extra for each module:
modprobe -n --show-depends -d /test/parts/kernel/install -S 4.4.5-test+ squashfs
modprobe -n --show-depends -d /test/parts/kernel/install -S 4.4.5-test+ ahci
name: test-kernel
version: 4.4.0
summary: ubuntu xenial kernel
description: A standard kernel
type: kernel
parts:
kernel:
plugin: kernel
source: git://kernel.ubuntu.com/ubuntu/ubuntu-xenial.git
source-type: git
source-branch: Ubuntu-4.4.0-14.30
kdefconfig: [defconfig]
kconfigs:
- CONFIG_LOCALVERSION="-test"
- CONFIG_DEBUG_INFO=n
- CONFIG_SQUASHFS=m
- CONFIG_SQUASHFS_XZ=y
- CONFIG_USB_XHCI_HCD=y
- CONFIG_R8169=m
- CONFIG_SECURITY_APPARMOR=y
- CONFIG_SECURITY_APPARMOR_BOOTPARAM_VALUE=1
- CONFIG_SECURITY_APPARMOR_UNCONFINED_INIT=y
- CONFIG_SECURITY_APPARMOR_HASH=y
- CONFIG_SECURITY_APPARMOR_HASH_DEFAULT=y
- CONFIG_DEFAULT_SECURITY_APPARMOR=y
- CONFIG_DEFAULT_SECURITY="apparmor"
- CONFIG_ATA=y
- CONFIG_SATA_AHCI=m
- CONFIG_SATA_AHCI_PLATFORM=m
kernel-initrd-modules:
- squashfs
- ahci
Example resolution would be
FROM:
def _make_initrd(self):
logger.info('Generating driver initrd for kernel release: {}'.format(
self.kernel_release))
initrd_unpacked_path = self._unpack_generic_initrd()
if self.options.kernel_initrd_modules:
modprobe_out = self.run_output([
'modprobe', '-n', '--show-depends', '-d', self.installdir,
'-S', self.kernel_release] +
self.options.kernel_initrd_modules)
modprobe_outs = modprobe_out.split(os.linesep)
else:
modprobe_outs = []
TO:
def _make_initrd(self):
logger.info('Generating driver initrd for kernel release: {}'.format(
self.kernel_release))
initrd_unpacked_path = self._unpack_generic_initrd()
modprobe_outs = []
for initrd_module in self.options.kernel_initrd_modules:
modprobe_out = self.run_output([
'modprobe', '-n', '--show-depends', '-d', self.installdir,
'-S', self.kernel_release] + [initrd_module])
modprobe_outs.append(modprobe_out)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Closed. Fixed by updating the kernel plugin to call modprobe individually for each kernel-initrd-module rather than passing them all at once, ensuring all specified drivers are correctly included in the initrd. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The kernel plugin incorrectly passed all kernel-initrd-modules to a single modprobe command. A proposed fix to iterate through modules individually was provided but never merged. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #476 kernel plugin: iterate over modules to add to initrd | snapcraft | merged | Merged updates to the kernel plugin that iterate over modules for initrd inclusion. Approved by @kyrofa following successful tests. Resolves LP #1572118 with 36 additions and 6 deletions across two files. |