Bug 11882

Summary: iwlwifi: packaging error
Product: [Build System, Metadata & Runtime] BSPs Reporter: Patrick Ohly <patrick.ohly>
Component: bsps-meta-intelAssignee: Saul Wold <sgw>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: Medium+ CC: jussi.laako, mikko.ylinen, ross.burton, sgw
Version: unspecified   
Target Milestone: 2.4 M3   
Hardware: x86   
OS: Multiple   
See Also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=11894
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Patrick Ohly 2017-08-01 17:00:35 UTC
Distro: refkit (= https://github.com/pohly/intel-iot-refkit/tree/updates2)
meta-intel: da5f7e708166ad2ecc5

ERROR: iwlwifi-30-r0 do_package: QA Issue: iwlwifi: Files/directories were installed but not shipped in any package:
  /etc
  /etc/modprobe.d
  /etc/modprobe.d/iwlwifi.conf
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
iwlwifi: 3 installed and not shipped files. [installed-vs-shipped]
ERROR: iwlwifi-30-r0 do_package: Fatal QA errors found, failing task.
ERROR: iwlwifi-30-r0 do_package: Function failed: do_package
ERROR: Logfile of failure stored in: /fast/build/refkit/pr/tmp-glibc/work/corei7-64-intel-common-refkit-linux/iwlwifi/30-r0/temp/log.do_package.17453
ERROR: Task (/fast/work/intel-iot-refkit-pr/openembedded-core/../meta-intel/common/recipes-kernel/iwlwifi/iwlwifi_git.bb:do_package) failed with exit code '1'

Jussi also mentioned another error once that is fixed: "nothing provides kernel-module-cfg80211-4.9.30-yocto-standard needed by kernel-module-ath9k-common-4.9.30-yocto-standard-4.9.30+git0+299f12a06c_22a3e39758-r0.corei7-64-intel-common"

This happens when the distro uses linux-intel.
Comment 1 Patrick Ohly 2017-08-02 15:20:20 UTC
According to Saul, this works for him. We need to investigate why it fails in Refkit. Jussi, can you do that? If in doubt, build iwlwifi in Poky+meta-intel and compare.
Comment 2 Jussi Laako 2017-08-03 12:18:41 UTC
meta-instal "works" if I build for example linux-yocto-rt 4.10 as kernel, because iwlwifi is not pulled in. But when kernel is linux-intel 4.9 it pulls in iwlwifi package as dependency and then build fails.
Comment 3 Jussi Laako 2017-08-03 13:31:56 UTC
On poky, with "core-image-minimal" the build seems to work.
Comment 4 Ross Burton 2017-08-03 14:58:12 UTC
If it works in Poky but fails in refkit then that suggests that refkit is doing something, via a bbappend or distro config, to break it.

If there are no bbappends then my hunch is usrmerge interacting badly with the rm ${D}/usr in do_install.
Comment 5 Jussi Laako 2017-08-04 07:45:33 UTC
I didn't find any bbappends or distro features that would be likely source of breaking it.

I don't know how to debug this further. I also find it strange that it doesn't fail on poky about the missing FILES_${PN} for the iwlwifi.conf from do_install_append(). I think it should fail there too. With my fix to the iwlwifi recipe to add the iwlwifi.conf to FILES_${PN} that error goes away and the package itself is built OK on both refkit and poky.

However, still the other error about missing kernel-module-cfg80211 remains on refkit, but doesn't appear on poky.

Based on what I checked, this is brought in through intel-common-drivers.scc. Manually pulling in that in the local.conf of both and get some warnings about unrelated config options that didn't end up in final config, refkit giving one warning more than poky while we shouldn't have any kernel config mods?


ERROR: refkit-image-common-1.0-r0 do_rootfs: Unable to install packages. Command '/scratch/jlaako/build/tmp-glibc/work/intel_corei7_64-refkit-linux/refkit-image-common/1.0-r0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /scratch/jlaako/build/tmp-glibc/work/intel_corei7_64-refkit-linux/refkit-image-common/1.0-r0/opkg.conf -t /scratch/jlaako/build/tmp-glibc/work/intel_corei7_64-refkit-linux/refkit-image-common/1.0-r0/temp/ipktemp/ -o /scratch/jlaako/build/tmp-glibc/work/intel_corei7_64-refkit-linux/refkit-image-common/1.0-r0/rootfs  --force_postinstall --prefer-arch-to-version   install connman-tools packagegroup-core-boot alsa-state lms8 rmc weston-init linux-firmware packagegroup-core-ssh-openssh pciutils kernel-modules run-postinsts packagegroup-common-test connman-client weston alsa-utils packagegroup-core-connectivity' returned 1:
Collected errors:
 * Solver encountered 1 problem(s):
 * Problem 1/1:
 *   - nothing provides kernel-module-cfg80211-4.9.30-yocto-standard needed by kernel-module-ath9k-common-4.9.30-yocto-standard-4.9.30+git0+299f12a06c_22a3e39758-r0.corei7-64-intel-common
 *
 * Solution 1:
 *   - do not ask to install a package providing kernel-modules

 * opkg_finalize_intercepts: Failed to open dir /scratch/jlaako/build/tmp-glibc/work/intel_corei7_64-refkit-linux/refkit-image-common/1.0-r0/temp/ipktemp//opkg-mSKt9Y/opkg-intercept-Bf14Wq: No such file or directory.
 * rm_r: Failed to open dir /scratch/jlaako/build/tmp-glibc/work/intel_corei7_64-refkit-linux/refkit-image-common/1.0-r0/temp/ipktemp//opkg-mSKt9Y/opkg-intercept-Bf14Wq: No such file or directory.
 * rm_r: Failed to open dir /scratch/jlaako/build/tmp-glibc/work/intel_corei7_64-refkit-linux/refkit-image-common/1.0-r0/temp/ipktemp//opkg-mSKt9Y: No such file or directory.
Comment 6 Ross Burton 2017-08-04 09:25:12 UTC
FWIW I tried building iwlwifi to look at this and can't even get past compile.
Comment 7 Patrick Ohly 2017-08-04 18:41:00 UTC
(In reply to comment #6)
> FWIW I tried building iwlwifi to look at this and can't even get past
> compile.

Were you using MACHINE=intel-corei7-64 and linux-intel?

The easiest way to reproduce this should be by checking out the intel-iot-refkit branch that I had mentioned in the description.

(In reply to comment #5)
> I don't know how to debug this further. I also find it strange that it
> doesn't fail on poky about the missing FILES_${PN} for the iwlwifi.conf from
> do_install_append(). I think it should fail there too.

The recipe uses modules.bbclass, which does some automatic packaging of the installed files. I find it likely that this packaging fails due to usrmerge in refkit, due to a /lib/modules vs. /usr/lib/modules mismatch somewhere.

Someone needs to check whether the class or do_install do it wrong.
Comment 8 Saul Wold 2017-08-07 22:54:57 UTC
So I can absolutely reproduce this in Poky/OE-Core with just enabling the usrmerge DISTRO_FEATURE, so there is something going on that I don't believe is correct, since it should not change that packaging behavior.

I also seems to loose the modules-load.d directory which MODULE_AUTOLOAD sets up, it's in the image, but does not get packaged either.  I see them getting installed into the image directory, but not packaged.

More digging is required.
Comment 9 Saul Wold 2017-08-08 02:03:34 UTC
Further refined the issue to the bitbake.conf root_prefix changing to base_prefix ("") from exec_prefix ("/usr") in usrmerge mode, so next digging is to what that breaks in the kernel-module class, I think that's the issue now.
Comment 10 Saul Wold 2017-08-08 15:38:38 UTC
Found the issue in iwlwifi is removing the /usr which is where usrmerge puts everything, so that was wrong.
Comment 12 Jussi Laako 2017-08-09 13:02:30 UTC
Thank you! Now the build succeeds on RefKit too!
Comment 13 Mikko Ylinen 2017-08-09 17:30:47 UTC
(In reply to comment #12)
> Thank you! Now the build succeeds on RefKit too!

I confirm it builds locally for me too but Refkit CI has this problem in do_install:

2017-08-09 10:24:17 | modinfo: ERROR: Module alias mac80211 not found.
2017-08-09 10:24:17 | depmod will prefer updates/ over kernel/ -- OK!
2017-08-09 10:24:17 | make[1]: /sbin/depmod: Command not found
2017-08-09 10:24:17 | Makefile.real:104: recipe for target 'install' failed
2017-08-09 10:24:17 | make[1]: *** [install] Error 127
2017-08-09 10:24:17 | Makefile:40: recipe for target 'install' failed
2017-08-09 10:24:17 | make: *** [install] Error 2
2017-08-09 10:24:17 | ERROR: oe_runmake failed
Comment 14 Saul Wold 2017-08-09 22:16:06 UTC
Ok, so I agree, my local build of refkit with all the images mentioned in the CI build set:

bitbake refkit-image-minimal refkit-image-computervision refkit-image-gateway refkit-image-industrial refkit-installer-image swtpm-wrappers-native ovmf 

and it succeeded for all of these, I tried to run the iot_test_export task, but something is missing in some setup, and it's not clear to me what.
Comment 15 Saul Wold 2017-08-10 00:34:46 UTC
I reviewed the log file from https://intel-iot-refkit.01.org/job/intel-iot-refkit_pull-requests/272/console

I can see the do_install() calls the make install and there are 6 modules installed, including both the mac80211 and cfg80211 modules, but some how it fails to find the mac80211 module and possibly depmod itself, altough I wonder if that is an artifact of not finding the kernel module.

Not sure what the CI does differently with setup in local.conf/auto.conf?  Since I see there is at least the iot_test task that does not run by default, I am missing some vital information.
Comment 16 Mikko Ylinen 2017-08-10 11:53:39 UTC
(In reply to comment #15)


> 
> I can see the do_install() calls the make install and there are 6 modules
> installed, including both the mac80211 and cfg80211 modules, but some how it
> fails to find the mac80211 module and possibly depmod itself, altough I
> wonder if that is an artifact of not finding the kernel module.

I've root caused the problem and the reason is iwlwifi's make install leaks to host paths. The build works on hosts that have mac80211.ko available but fails in CI because it does not have it.

A closer look to the .sh scripts in 'install:' (Makefile.real) tells me they're relevant only if iwlwifi gets installed to your PC directly.

For our case we can probably skip them. Here's a trivial "patch" to, e.g., iwlwifi_git.bb's do_configure():

sed -i -e '/blacklist.sh/,/update-initramfs.sh/ d' ${S}/Makefile.real

(delete lines between blacklist.sh and update-initramfs.sh)