Bug 15287

Summary: package in RDEPENDS is not being pulled as dependency before main package
Product: [Yocto Project Subprojects] opkg Reporter: Piotr Łobacz <p.lobacz>
Component: opkgAssignee: Alex Stewart <alex.stewart>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Undecided    
Version: 0.5   
Target Milestone: ---   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
log.do_rootfs none

Description Piotr Łobacz 2023-11-20 20:41:56 UTC
Hi all,
I have recently noticed a strange case. Generally I have been working with 
some implementation on feature branch in which I switched from package_deb to 
package_ipk and building the image was working without any problems until I 
have rebased this branch to our master with some additional changes. For 
unknown reason an installation of package was failing due to missing user 
which should be added by completly different package but actually this RDEPENDS 
package was not being pulled...

So I started to dig and tried first to work with the master branch on which 
building was without any issues. I decided to create a new branch on top of it 
and check all commits from feature branch by cherry picking one by one and to 
my supprise it has occured that the change from package_deb to package_ipk was 
causing the issue. I started comparing do_rootfs logs for package_deb and 
package_ipk and voilá, another discovery. In case of deb packages all 
dependent packages were being pulled at the begining of installation which was 
not happening in ipk case. In addition we are using packagegroups for 
combining packages and then using them in IMAGE_INSTALL and this is also not 
working with ipk. I mean all packages actually are being pulled but in case 
RDEPENDS that needs to be installed before for in example GROUPMEMS_PARAM call
it will not work.

There is an ugly solution to this case which honestly I would like to avoid. 
Namely I have added the RDEPENDS package directly to IMAGE_INSTALL and that's 
it but you see my point it's ugly hack...

Does anybody have met with such thing?

BR
Piotr
Comment 1 Alex Stewart 2023-11-28 17:43:25 UTC
Hey Piotr,

So, if I'm parsing this correctly:
* pkg_a depends on pkg_b, because B sets up a user account that A requires.
* In OE, recipe_a RDEPENDS on recipe_b. And both should be installed via a packagegroup. But do_rootfs fails when installing pkg_a - presumably due to the user account not existing.
* do_rootfs succeeds, if you specify pkg_b as a separate IMAGE_INSTALL element.


1. Can you share the details of the installation error? Does opkg fail during a package postinst, or at another step?
2. Can you share the package recipes? I think the details of how they are configured will be relevant here.
3. How is pkg_b setting up the user account? In a postinst?
4. As a sanity-check: You're using the libsolv backend; correct?


> In case of deb packages all dependent packages were being pulled at the begining of installation which was not happening in ipk case.

What do you mean "pulled"? Was pkg_b not being installed at all in the IPK case?


>I mean all packages actually are being pulled but in case RDEPENDS that needs to be installed before for in example GROUPMEMS_PARAM call it will not work.

I'm not sure what you mean here.
Comment 2 Piotr Łobacz 2023-11-29 09:01:00 UTC
Hi Alex,

(In reply to Alex Stewart from comment #1)
> Hey Piotr,
> 
> So, if I'm parsing this correctly:
> * pkg_a depends on pkg_b, because B sets up a user account that A requires.
> * In OE, recipe_a RDEPENDS on recipe_b. And both should be installed via a
> packagegroup. But do_rootfs fails when installing pkg_a - presumably due to
> the user account not existing.
> * do_rootfs succeeds, if you specify pkg_b as a separate IMAGE_INSTALL
> element.
> 
In short, yes.
> 
> 1. Can you share the details of the installation error? Does opkg fail
> during a package postinst, or at another step?
Yes. I can even share the whole log file but for that I need to reproduce the issue again.
> 2. Can you share the package recipes? I think the details of how they are
> configured will be relevant here.
Yes.
> 3. How is pkg_b setting up the user account? In a postinst?
With USERADD_PARAM from yocto.
> 4. As a sanity-check: You're using the libsolv backend; correct?
I do not know I would need to check for that.
> 
> 
> > In case of deb packages all dependent packages were being pulled at the begining of installation which was not happening in ipk case.
> 
> What do you mean "pulled"? Was pkg_b not being installed at all in the IPK
> case?
It was but not before but after.
> 
> 
> >I mean all packages actually are being pulled but in case RDEPENDS that needs to be installed before for in example GROUPMEMS_PARAM call it will not work.
> 
> I'm not sure what you mean here.

Ok I will explain it to you once again with real example. I have a package of my own communication.bb which has in it's body a code for user creation:

USERADD_PACKAGES = "${PN}"
USERADD_PARAM:${PN} += "--system -g mgmtd --groups docker,network,zmq --shell /bin/nologin --home /home/composed composed;"
USERADD_PARAM:${PN} += "--system -g mgmtd --groups network,zmq --shell /bin/nologin --home /usr/lib/mgmtd mgmtd;"
USERADD_PARAM:${PN} += "--system -g zmq --shell /bin/nologin --home /usr/lib/zmq zmq;"

GROUPADD_PARAM:${PN} += "--system mgmtd;--system zmq;--system network;"

and in addition I'm using meta-iotedge given by microsoft. For some purpouse I need to add in my bbappend of aziot-edged this part of code:

GROUPMEMS_PARAM:${PN} = "-a composed -g iotedge"

which will fail even that I have this added communication:

RDEPENDS:${PN}:append = " aziotctl communication"

And it will fail with the error which i will give you later to the answer for 1.
Comment 3 Piotr Łobacz 2023-11-29 10:50:55 UTC
Created attachment 4993 [details]
log.do_rootfs

This file contains the error for do_rootfs mentioned in 1.