Add user to group that's created in other recipe
Hi,
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?
Best regards,
Sven
Quoted 26 lines · Sven via lists.yoctoproject.org
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"
Quoted 6 lines
Every now and then I get and error in recipe_b's
do_package_setscenetask where useradd complains that one of the groups provided byrecipe_adoes 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
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.
Quoted 62 lines · Richard Purdie
Quoted 26 lines · Sven via lists.yoctoproject.org
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"Quoted 6 lines
Every now and then I get and error in recipe_b's
do_package_setscenetask where useradd complains that one of the groups provided byrecipe_adoes 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 (#58687):
https://lists.yoctoproject.org/g/yocto/message/58687
Mute This Topic: https://lists.yoctoproject.org/mt/95359282/924729
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 35 lines · Richard Purdie
Quoted 26 lines · Sven via lists.yoctoproject.org
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"Quoted 6 lines
Every now and then I get and error in recipe_b's
do_package_setscenetask where useradd complains that one of the groups provided byrecipe_adoes 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?
Quoted 6 lines
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.
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13904 is one of the bugs I think.
Quoted 7 lines · Martin Jansa
Quoted 4 lines
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.
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13904 is one of the bugs I think.
This is another:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13419
Workarounds are not difficult, but the issue occurring for the first time must be very disorienting.
Alex
Hi all,
Thanks for the pointers. I'm actually on kirkstone-4.0. I'll try the work-arounds.
Best regards,
Sven