Bug 15084

Summary: For some reason using of same user in two recipes does not work properly
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Piotr Łobacz <p.lobacz>
Component: oe-core otherAssignee: Unassigned <unassigned>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: pavel, randy.macleod
Version: 4.0.9   
Target Milestone: 5.2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
Fix user add temporarily none

Description Piotr Łobacz 2023-03-29 08:11:29 UTC
First of all I know that this is not a place to discuss problems regarding issues to different meta-layers but I am recently working with meta-iotedge layer for kirkstone and I have noticed strange behavior, which may be touching core functionalities of oe-core. Maybe I'm wrong I dunno, but I would be pleased if somebody might help me solve this riddle :)

Namely I wanted to make some code clean up of this meta layer because the dependencies and their order where done a little bit wrong. This is my testing repository https://github.com/Dvergatal/meta-iotedge/tree/welotec on which this strange behavior is observed.

Generally the build order is supposed to be like that aziotd, iotedge, aziotctl and than aziot-edged. We do not consider aziot-keys as this is just a run dependency. Now first two aziotd and iotedge are building without any issued but than aziotctl and aziot-edged (this one does not build due to aziotctl error) fails. The weird behavior is noticed on aziotctl install process. The error is regarding install: invalid user ‘iotedge’, but aziotd and iotedge packages are installed to aziotctl sysroot. What I have noticed is that in file `build/tmp-glibc/work/core2-64-WelotecGmbH-linux/aziotctl/1.4.3.AUTOINC+cfa39b58ec-r0/recipe-sysroot/etc/passwd` this iotedge user is actually missing and this is odd because it should be there....
Comment 1 Piotr Łobacz 2023-03-29 12:36:43 UTC
OK I have gladly been able to reproduce this issue without usage of this meta-iotedge meta layer and finally I know when it happens.

BTW. Randy I'm sorry for adding you to CC list but I do not know if anybody has seen this bug, but I need some help so we could investigate it as it is related strictly to creation of sysroot on recipe build.

Namely whenever we are appending a package name - which is adding new user and group which depends from another user(s) from different recipe(s) - to DEPENDS variable in our recipe, for some reason this user is not being created at all which is of course a bug probably in meta/classes/sstate.bbclass, but I haven't verified it yet. I have only seen that there was already a bug https://lore.kernel.org/all/fa38064e-eea8-8301-cb78-5e846b1341f2@emagii.com/T/ but it is already fixed.
Comment 2 Piotr Łobacz 2023-03-29 12:51:41 UTC
Generally the chain looks like this:
Recipe A DEPENDS on recipe B, which DEPENDS alike but on recipe C and creates user and group to which is being added user from recipe C
Comment 3 Randy MacLeod 2023-03-30 14:47:47 UTC
Known issue that may be related to:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13419
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13279

Pavel may take a look.
Comment 4 Piotr Łobacz 2023-03-31 12:02:21 UTC
Randy I have already found where it is and what is the cause of it I have written it on https://bugzilla.yoctoproject.org/show_bug.cgi?id=13904
Comment 5 Piotr Łobacz 2023-03-31 12:06:35 UTC
Additionally we will try in Welotec team to solve this, because this issue is on one side trivial and on the other difficult. The difficulty in it is how to pass the proper order of executin these scripts into this for loop in basepasswd_sysroot_postinst bash script...
Comment 6 Randy MacLeod 2023-03-31 18:48:11 UTC
Piotr, I'll leave to to you and Pavel to work out and set the ownership of the bug.
Thanks for explaining what your plans are.
Comment 7 Piotr Łobacz 2023-04-01 19:51:22 UTC
Yeah, sounds great:) Pavel if it's possible please contact me and we can discuss the issue.
Comment 8 Piotr Łobacz 2023-08-31 09:29:34 UTC
Created attachment 4972 [details]
Fix user add temporarily

Correct order of posinsts execution passwd db

Run user add scripts in three passes, first for adding groups,
then users and at the end group memberships.
Comment 9 Pavel Zhukov 2024-01-15 20:41:29 UTC
There were some changes in useradd recently. Need to check if the bug is still valid. Moving to M3
Comment 10 Piotr Łobacz 2024-01-18 20:47:16 UTC
The issue is still valid as Richard has fixed only one part of it and it has been even discussed with him.
Comment 11 Piotr Łobacz 2024-03-19 09:05:23 UTC
I think that after this patch https://git.openembedded.org/openembedded-core/commit/?id=322ef726132a47d977d2c6ee41de5358f1e85994 merged to master, the bug is fixed, but I still need to test it with master release, which I haven't done yet...
Comment 12 Randy MacLeod 2024-10-31 15:09:24 UTC
Bulk move of 5.1 bugs to 5.2. -- YP bug review (Randy)
Comment 13 Randy MacLeod 2025-06-05 15:10:46 UTC
Seems to be resolved by:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15084#c11