One way I have gotten around this is by using an .inc file to create the
users/groups and then the recipes that need the user/group require/include
that .inc file.

On Wed, Nov 30, 2022 at 3:05 PM Richard Purdie <
richard.pur...@linuxfoundation.org> wrote:

> On Wed, 2022-11-30 at 06:55 -0800, Sven via lists.yoctoproject.org
> wrote:
> > I have intermittent problems with a recipe that creates a user that
> > is member of groups that are created by a different recipe. This is
> > the recipe that creates the groups:
> >
> > # recipe-a.bb
> > inherit useradd
> > USERADD_PACKAGES = "${PN}"
> > GROUPADD_PARAM:${PN} = "--system gpio;--system i2c"
> >
> > This is the recipe that creates the user:
> >
> > # recipe-b.bb
> > inherit useradd
> > USERADD_PACKAGES = "${PN}"
> > GROUPADD_PARAM:${PN} = "--system mygroup"
> > GROUPS = "dialout,mygroup,gpio,i2c"
> > USERADD_PARAM:${PN} = "--system --no-create-home --shell /bin/false -
> > -no-user-group --groups ${GROUPS} myuser"
> > DEPENDS = "recipe-a"
> >
> > I guess it's also worth pointing out, that I use useradd-static:
> > USERADDEXTENSION = "useradd-staticids"
> > USERADD_ERROR_DYNAMIC = "error"
> > USERADD_UID_TABLES = "files/passwd"
> > USERADD_GID_TABLES = "files/group"
> >
> > Every now and then I get and error in recipe_b's do_package_setscene
> > task where useradd complains that one of the groups provided by
> > recipe_a does not exist. This appears to be a race condition since
> > most of the times, this works OK. I was under the impression that
> > specifying DEPENDS="recipe-a" in recipe_b.bb would be enough to
> > declare this dependency. What am I doing wrong?
>
> Just to confirm, this is with master?
>
> I think there are some open bugs for useradd issues like this. It is
> supposed to work but sounds like there are races. If there isn't a bug
> open for it, there probably should be.
>
> Sadly we don't have many people interested in working on issues like
> this so I can't say when it might get fixed, we do our best!
>
> Cheers,
>
> Richard
>
>
>
>
> 
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#58688): https://lists.yoctoproject.org/g/yocto/message/58688
Mute This Topic: https://lists.yoctoproject.org/mt/95359282/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to