kernel plugin _make_initrd fails to add given modules

Bug #1572118 reported by Gunther Laure
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
High
Sergio Schvezov

Bug Description

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)

Oliver Grawert (ogra)
Changed in snapcraft:
status: New → Confirmed
Changed in snapcraft:
importance: Undecided → High
assignee: nobody → Sergio Schvezov (sergiusens)
milestone: none → 2.8.4
Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Changed in snapcraft:
status: Confirmed → In Progress
Changed in snapcraft:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.