RRECOMMENDS "masking" unsatisfiable IMAGE_INSTALL
I noticed that if I have an image recipe that says
IMAGE_INSTALL += "kernel-module-foo"
it fails as expected when the kernel hasn't been built with CONFIG_FOO=m.
However, if at the same time some other package which happens to get installed in the same image says
RRECOMMENDS_${PN} += "kernel-module-foo"
the image build silently succeeds, obviously without any foo.ko included. This doesn't seem right. [I'm well aware that the RRECOMMENDS line alone works as expected, this is about the case where both the above lines are in play.]
=====
So I discovered this while trying to figure out how to be able to say IMAGE_INSTALL += "kernel-module-ext4" , and have that succeed whenever ext4 is builtin or modular, and have it be a build time error if the kernel was built with EXT4=n - so the recommends approach is out. It obviously doesn't work out-of-the-box for the EXT4=y case. So now I'm contemplating doing
python kernel_base_provide_builtin () {
kname = d.getVar("KERNEL_PACKAGE_NAME") or "kernel" builtin = os.path.join(d.getVar("PKGD"), "lib/modules",d.getVar("KERNEL_VERSION"), "modules.builtin")
if not os.path.exists(builtin):
return
builtin_mods = []
with open(builtin) as f:
for mod in f:
mod = mod.strip()
mod = os.path.basename(mod)
if not mod.endswith(".ko"):
continue
mod = mod[:-3]
mod = mod.lower().replace("_", "-") builtin_mods.append("%s-module-%s" % (kname, mod))
basepkg = kname + "-base"
rprovides = (d.getVar("RPROVIDES_" + basepkg) or "").split() rprovides += builtin_mods
d.setVar("RPROVIDES_" + basepkg, " ".join(rprovides))
}
PACKAGESPLITFUNCS += "kernel_base_provide_builtin"
i.e., make sure that the kernel-base package is an rprovider of kernel-module-ext4 for the EXT4=y case [*]. That seems to work as expected in the cases I've tried (provided nobody rrecommends ext4, per above). Does anybody see anything wrong with that approach? EXT4 is just an example, I'm gonna use it for other modules/subsystems with more complicated dependencies that might not be satisfied in a base .config, so a fragment saying CONFIG_FOO=m might have been ignored due to that, and I'd prefer catching that no later than at image build time.
I'm not necessarily suggesting the above for oe-core, I can live with it in my own kernel recipes.
[*] kernel-base and not the package containing the actual kernel binary, because kernel-base contains the modules.builtin file which is what modprobe consults first to see if it actually has to do anything, so it makes sense to have kernel-module-ext4 pull in that file and the other /lib/modules/ metadata when EXT4=y. The kernel binary is as often as not not actually in the rootfs image, and wouldn't be useful to modprobe anyway.
Rasmus
Quoted 9 lines · Rasmus Villemoes via lists.openembedded.org
I noticed that if I have an image recipe that says
IMAGE_INSTALL+= "kernel-module-foo"it fails as expected when the kernel hasn't been built with
CONFIG_FOO=m.However, if at the same time some other package which happens to get installed in the same image says
Quoted 6 lines
RRECOMMENDS_${PN} += "kernel-module-foo"
the image build silently succeeds, obviously without any foo.ko included. This doesn't seem right. [I'm well aware that the RRECOMMENDS line alone works as expected, this is about the case where both the above lines are in play.]
Which package backend are you using and does this happen if you use a different one, particularly swapping ipk and rpm?
That might tell us if this is a package manager issue or a bitbake metadata one.
Cheers,
Richard
Quoted 17 lines · Richard Purdie
Quoted 9 lines · Rasmus Villemoes via lists.openembedded.org
I noticed that if I have an image recipe that says
IMAGE_INSTALL+= "kernel-module-foo"it fails as expected when the kernel hasn't been built with
CONFIG_FOO=m.However, if at the same time some other package which happens to get installed in the same image says
Quoted 6 lines
RRECOMMENDS_${PN} += "kernel-module-foo"
the image build silently succeeds, obviously without any foo.ko included. This doesn't seem right. [I'm well aware that the RRECOMMENDS line alone works as expected, this is about the case where both the above lines are in play.]
Quoted 5 lines
Which package backend are you using and does this happen if you use a different one, particularly swapping ipk and rpm?
That might tell us if this is a package manager issue or a bitbake metadata one.
I was using ipk. It seems to work as expected (i.e. fail the build) when using rpm.
Rasmus
Quoted 18 lines · Rasmus Villemoes
Quoted 17 lines · Richard Purdie
Quoted 15 lines · Rasmus Villemoes via lists.openembedded.org
I noticed that if I have an image recipe that says
IMAGE_INSTALL+= "kernel-module-foo"it fails as expected when the kernel hasn't been built with
CONFIG_FOO=m.However, if at the same time some other package which happens to get installed in the same image says
RRECOMMENDS_${PN} += "kernel-module-foo"
the image build silently succeeds, obviously without any foo.ko included. This doesn't seem right. [I'm well aware that the RRECOMMENDS line alone works as expected, this is about the case where both the above lines are in play.]
Quoted 8 lines
Quoted 5 lines
Which package backend are you using and does this happen if you use a different one, particularly swapping ipk and rpm?
That might tell us if this is a package manager issue or a bitbake metadata one.
I was using ipk. It seems to work as expected (i.e. fail the build) when using rpm.
That is probably a bug that needs opening against opkg in bugzilla then. Added Alex to Cc: (opkg maintainer).
Cheers,
Richard
Quoted 22 lines · Richard Purdie
Quoted 21 lines · Rasmus Villemoes
Quoted 20 lines · Richard Purdie
Quoted 9 lines · Rasmus Villemoes via lists.openembedded.org
I noticed that if I have an image recipe that says
IMAGE_INSTALL+= "kernel-module-foo"it fails as expected when the kernel hasn't been built with
CONFIG_FOO=m.However, if at the same time some other package which happens to get installed in the same image says
Quoted 6 lines
RRECOMMENDS_${PN} += "kernel-module-foo"
the image build silently succeeds, obviously without any foo.ko included. This doesn't seem right. [I'm well aware that the RRECOMMENDS line alone works as expected, this is about the case where both the above lines are in play.]
Which package backend are you using and does this happen if you use a different one, particularly swapping ipk and rpm?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
That might tell us if this is a package manager issue or a bitbake metadata one.
I was using ipk. It seems to work as expected (i.e. fail the build) when using rpm.
That is probably a bug that needs opening against opkg in bugzilla then. Added Alex to Cc: (opkg maintainer).
Indeed, thanks. Alex, do you have enough context from the above, or do I need to do anything explicitly to file a bug?
Rasmus
Quoted 26 lines · Rasmus Villemoes
Quoted 25 lines · Richard Purdie
Quoted 24 lines · Rasmus Villemoes
Quoted 22 lines · Richard Purdie
Quoted 9 lines · Rasmus Villemoes via lists.openembedded.org
I noticed that if I have an image recipe that says
IMAGE_INSTALL+= "kernel-module-foo"it fails as expected when the kernel hasn't been built with
CONFIG_FOO=m.However, if at the same time some other package which happens to get installed in the same image says
Quoted 6 lines
RRECOMMENDS_${PN} += "kernel-module-foo"
the image build silently succeeds, obviously without any foo.ko included. This doesn't seem right. [I'm well aware that the RRECOMMENDS line alone works as expected, this is about the case where both the above lines are in play.]
Which package backend are you using and does this happen if you use a different one, particularly swapping ipk and rpm?
That might tell us if this is a package manager issue or a bitbake metadata one.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I was using ipk. It seems to work as expected (i.e. fail the build) when using rpm.
That is probably a bug that needs opening against opkg in bugzilla then. Added Alex to Cc: (opkg maintainer).
Indeed, thanks. Alex, do you have enough context from the above, or do I need to do anything explicitly to file a bug?
Please open a bug in bugzilla: https://bugzilla.yoctoproject.org/
That way we ensure it is tracked and doesn't get lost.
Cheers,
Richard
Hey Rasmus,
Sorry for the delay; I was OOO for the holidays and I'm just now working through my inbox.
Quoted 7 lines · Rasmus Villemoes
Quoted 2 lines · Richard Purdie
That is probably a bug that needs opening against opkg in bugzilla then. Added Alex to Cc: (opkg maintainer).
Indeed, thanks. Alex, do you have enough context from the above, or do I need to do anything explicitly to file a bug?
Rasmus
Could you expand a bit on how OE is supposed to fail when the kernel module package is unsatisfiable? Does it propagate a opkg satisfaction error, or is the misconfiguration caught in the OE python modules?
I ask because it seems most likely to me that the inconsistency here is in the OE opkg interface modules, rather than opkg itself - which obviously has no concept of IMAGE_INSTALL or the kernel configuration.
Can you identify the set of packages that OE is requesting opkg to install, with and without the RRECOMMENDS? That would help to distinguish between an inconsistency in the OE PackageManager modules and a bug in opkg itself.
Thanks,
Signature · 5 lines
Alex Stewart Software Engineer - NI Real-Time OS NI (National Instruments) [email protected]
Quoted 18 lines · Alex Stewart
Hey Rasmus,
Sorry for the delay; I was OOO for the holidays and I'm just now working through my inbox.
Quoted 7 lines · Rasmus Villemoes
Quoted 2 lines · Richard Purdie
That is probably a bug that needs opening against opkg in bugzilla then. Added Alex to Cc: (opkg maintainer).
Indeed, thanks. Alex, do you have enough context from the above, or do I need to do anything explicitly to file a bug?
Rasmus
Could you expand a bit on how OE is supposed to fail when the kernel module package is unsatisfiable? Does it propagate a opkg satisfaction error, or is the misconfiguration caught in the OE python modules?
Quoted 8 lines
I ask because it seems most likely to me that the inconsistency here is in the OE opkg interface modules, rather than opkg itself - which obviously has no concept of
IMAGE_INSTALLor the kernel configuration.Can you identify the set of packages that OE is requesting opkg to install, with and without the RRECOMMENDS? That would help to distinguish between an inconsistency in the OE PackageManager modules and a bug in opkg itself.
Kernel modules can be:
a) not built at all
b) built into the kernel
c) built as separate packages
For OE, where something needs a kernel module, we suggest people:
RRECOMMEND_XXX += "kernel-module-xxx"
and the kernel recipe has PACKAGES_DYNAMIC = "kernel-module-*".
From bitbake's perspective, it builds the kernel (since the PACKAGES_DYNAMIC covers kernel-modules-xxx) and then hands off to the package manager.
In the case it was built in, the Recommends will be passed over by the package manager since it is just a suggestion. If the module is present, it would be included in the image.
The issue as described is that if someone has IMAGE_INSTALL containing kernel-module-xxx *and* some other package in the image RRECOMMENDS that module, it doesn't error if the package doesn't exist.
I have to admit I don't remember how IMAGE_INSTALL is being passed into opkg but the change in behaviour due to the addition of a RRECOMMENDS does not sound right to me. The rpm backend does not do that but errors consistently.
It sounds like the "Depends" from IMAGE_INSTALL is somehow being overruled by the Recommends from some sub package dependency.
If we're driving opkg incorrectly, we should fix that but I'm not sure where the issue is, I suspect opkg...
Cheers,
Richard
Quoted 19 lines · Richard Purdie
Kernel modules can be:
a) not built at all
b) built into the kernel3
c) built as separate packagesFor OE, where something needs a kernel module, we suggest people:
RRECOMMEND_XXX+= "kernel-module-xxx"and the kernel recipe has
PACKAGES_DYNAMIC= "kernel-module-*".From bitbake's perspective, it builds the kernel (since the
PACKAGES_DYNAMIC
covers kernel-modules-xxx) and then hands off to the package manager.In the case it was built in, the Recommends will be passed over by the package manager since it is just a suggestion. If the module is present, it would be included in the image.
Quoted 8 lines
The issue as described is that if someone has
IMAGE_INSTALLcontaining kernel-module-xxx *and* some other package in the image RRECOMMENDS that module, it doesn't error if the package doesn't exist.I have to admit I don't remember how
IMAGE_INSTALLis being passed into opkg but the change in behaviour due to the addition of a RRECOMMENDS does not sound right to me. The rpm backend does not do that but errors consistently.
Yep; I understand all of that and agree. My goal here is just to make sure that the bug is filed to the correct location. As it stands, the only description of the error is from OE's perspective, and I'd like to get some understanding of the interface between OE and opkg, for this special case.
Quoted 2 lines
It sounds like the "Depends" from
IMAGE_INSTALLis somehow being overruled by the Recommends from some sub package dependency.
I know that IMAGE_INSTALL gets consumed into PACKAGE_INSTALL, which gets pass off to the PM modules (iirc.) And I also recall there being a PACKAGE_INSTALL_ATTEMPTONLY variable[1]. I wonder if RRECOMMENDS are being ATTEMPTed (either through that variable, or a similar one), and the failed attempt is pre-empting the mandatory install attempt. Worth looking into.
[1] https://git.openembedded.org/openembedded-core/tree/meta/classes/image.bbclass#n79
Quoted 2 lines
If we're driving opkg incorrectly, we should fix that but I'm not sure where the issue is, I suspect opkg...
Why do you suspect opkg? The situation from its perspective is only that kernel-module-xxx is recommended by another package, but not available in the feeds. There's nothing invalid about that state that would cause opkg to throw an error.
Thanks,
Signature · 5 lines
Alex Stewart Software Engineer - NI Real-Time OS NI (National Instruments) [email protected]
Quoted 4 lines · Alex Stewart
Hey Rasmus,
Sorry for the delay; I was OOO for the holidays and I'm just now working through my inbox.
No need to apologize; as it happens I've just now returned from vacation.
Quoted 13 lines · Rasmus Villemoes
Quoted 7 lines · Richard Purdie
Quoted 2 lines
That is probably a bug that needs opening against opkg in bugzilla then. Added Alex to Cc: (opkg maintainer).
Indeed, thanks. Alex, do you have enough context from the above, or do I need to do anything explicitly to file a bug?
Rasmus
Could you expand a bit on how OE is supposed to fail when the kernel module package is unsatisfiable? Does it propagate a opkg satisfaction error, or is the misconfiguration caught in the OE python modules?
Quoted 6 lines
I ask because it seems most likely to me that the inconsistency here is in the OE opkg interface modules, rather than opkg itself - which obviously has no concept of
IMAGE_INSTALLor the kernel configuration.Can you identify the set of packages that OE is requesting opkg to install, with and without the RRECOMMENDS?
Looking at log.do_rootfs, it seems that opkg gets invoked in exactly the same way with and without the RRECOMMENDS in play:
With RRECOMMENDS, where the build succeeds:
NOTE: Installing the following packages: [...] glib-2.0 iproute2 kernel-image kernel-module-abcd less libgettextlib [...]
NOTE: [...]/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/opkg.conf -t [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/temp/ipktemp/ -o [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/rootfs --force_postinstall
--prefer-arch-to-version --add-ignore-recommends busybox-syslog
--add-ignore-recommends busybox-udhcpc --add-ignore-recommends kernel-vmlinux --add-ignore-recommends udev-cache install [...] glib-2.0 iproute2 kernel-image kernel-module-abcd less libgettextlib [...]
And no further mention of kernel-module-abcd.
Without the RRECOMMENDS:
NOTE: Installing the following packages: [...] glib-2.0 iproute2 kernel-image kernel-module-abcd less libgettextlib [...]
NOTE: [...]/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/opkg.conf -t [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/temp/ipktemp/ -o [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/rootfs --force_postinstall
--prefer-arch-to-version --add-ignore-recommends busybox-syslog
--add-ignore-recommends busybox-udhcpc --add-ignore-recommends kernel-vmlinux --add-ignore-recommends udev-cache install [...] glib-2.0 iproute2 kernel-image kernel-module-abcd less libgettextlib [...]
ERROR: Unable to install packages. Command '[...]/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/opkg.conf -t [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/temp/ipktemp/ -o [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/rootfs --force_postinstall
--prefer-arch-to-version --add-ignore-recommends busybox-syslog
--add-ignore-recommends busybox-udhcpc --add-ignore-recommends kernel-vmlinux --add-ignore-recommends udev-cache install [...] glib-2.0 iproute2 kernel-image kernel-module-abcd less libgettextlib [...]' returned 255:
* opkg_prepare_url_for_install: Couldn't find anything to satisfy
'kernel-module-abcd'.
So I assume the difference must be in some of the metadata files (opkg.conf or the ipktemp/ dir argument to the -t flag), but I know nothing about how opkg/ipk works internally or what to look for.
Thanks,
Rasmus
Quoted 34 lines · Rasmus Villemoes
Looking at log.do_rootfs, it seems that opkg gets invoked in exactly the same way with and without the RRECOMMENDS in play:
With RRECOMMENDS, where the build succeeds:
NOTE: Installing the following packages: [...] glib-2.0 iproute2 kernel-image kernel-module-abcd less libgettextlib [...]
NOTE: [...]/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/opkg.conf -t [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/temp/ipktemp/ -o [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/rootfs --force_postinstall
--prefer-arch-to-version --add-ignore-recommends busybox-syslog
--add-ignore-recommends busybox-udhcpc --add-ignore-recommends kernel-vmlinux --add-ignore-recommends udev-cache install [...] glib-2.0 iproute2 kernel-image kernel-module-abcd less libgettextlib [...]And no further mention of kernel-module-abcd.
Without the RRECOMMENDS:
NOTE: Installing the following packages: [...] glib-2.0 iproute2 kernel-image kernel-module-abcd less libgettextlib [...]
NOTE: [...]/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/opkg.conf -t [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/temp/ipktemp/ -o [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/rootfs --force_postinstall
--prefer-arch-to-version --add-ignore-recommends busybox-syslog
--add-ignore-recommends busybox-udhcpc --add-ignore-recommends kernel-vmlinux --add-ignore-recommends udev-cache install [...] glib-2.0 iproute2 kernel-image kernel-module-abcd less libgettextlib [...]
ERROR: Unable to install packages. Command '[...]/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/opkg.conf -t [...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/temp/ipktemp/ -o
Quoted 8 lines
[...]/work/rpi3-oe-linux/pil-rootfs/1.0-r0/rootfs --force_postinstall
--prefer-arch-to-version --add-ignore-recommends busybox-syslog
--add-ignore-recommends busybox-udhcpc --add-ignore-recommends kernel-vmlinux --add-ignore-recommends udev-cache install [...] glib-2.0 iproute2 kernel-image kernel-module-abcd less libgettextlib [...]' returned 255:
*opkg_prepare_url_for_install: Couldn't find anything to satisfy
'kernel-module-abcd'.
That's helpful info; thanks. I'll paste it to the bug in the opkg bugzilla and we can continue tracking there.
Signature · 5 lines
Alex Stewart Software Engineer - NI Real-Time OS NI (National Instruments) [email protected]