<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13419</bug_id>
          
          <creation_ts>2019-06-26 12:43:57 +0000</creation_ts>
          <short_desc>recipes that add users to groups cannot rely on other recipes creating those groups (when population from sstate happens)</short_desc>
          <delta_ts>2023-12-15 13:58:04 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>configuration</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.3 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexander Kanavin">alex.kanavin</reporter>
          <assigned_to name="Eilís Ní Fhlannagáin">pidge</assigned_to>
          <cc>jermain.horsman</cc>
    
    <cc>JPEWhacker</cc>
    
    <cc>louis.rannou</cc>
    
    <cc>niko.mauno</cc>
    
    <cc>pidge</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>tgamblin</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84317</commentid>
    <comment_count>0</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2019-06-26 12:43:57 +0000</bug_when>
    <thetext>Scenario:

recipe A creates a group some-group

recipe B depends on A and adds a user some-user that belongs to some-group


This works when building from scratch, but breaks down when both recipes are populated from sstate-cache, e.g. this way:

bitbake B
rm -rf tmp/
bitbake -c package B

will produce:

NOTE: Executing SetScene Tasks
ERROR: B-git-r0 do_package_setscene: B: useradd command did not succeed.
WARNING: Logfile for failed setscene task is /home/alexander/development/mbient/build-thud-jetson/tmp/work/aarch64-mbient-linux/B/git-r0/temp/log.do_package_setscene.43058
WARNING: Setscene task (/home/alexander/development/mbient/build-thud-jetson/../sources/meta-mbient/meta-mbient/recipes-media/B/B_git.bb:do_package_setscene) failed with exit code &apos;1&apos; - real task will be run instead

Adding setscene dependencies to B does not help, as sstate code actually overrides them, except for some basic packages (e.g. base-passwd and shadow).

A workaround is to re-create the needed groups from B, but this should also Just Work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85377</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-10-17 15:21:22 +0000</bug_when>
    <thetext>Adding a pseudo-native dependency to target recipes may resolve this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85701</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-12-04 13:59:16 +0000</bug_when>
    <thetext>Qqestion is whether http://git.yoctoproject.org/cgit.cgi/poky-contrib/commit/?id=911d784d9c838567dea40b94156e436d70b61c20 helps this at all or not. I now suspect not.

Do we have the full error from the failing command? I&apos;m wondering what exactly is missing...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85702</commentid>
    <comment_count>3</comment_count>
    <who name="Niko Mauno">niko.mauno</who>
    <bug_when>2019-12-04 14:57:41 +0000</bug_when>
    <thetext>I just tried http://git.yoctoproject.org/cgit.cgi/poky-contrib/commit/?id=911d784d9c838567dea40b94156e436d70b61c20 in thud (yocto-2.6.2) but still can every time reproduce the failure as thus far by resorting to

  rm -rf build/tmp-glibc
  bitbake -c package foobar

once sstate-cache has been populated. Relevant error message lines look like

  Running useradd commands...
  NOTE: foobar: Performing useradd with [--root .../foobar/1.0.0-r0/recipe-sysroot --home-dir / --gid foobar --groups foo1,foo2,foo3,upstream-recipe- 
 group1,upstream-recipe-group2 --system --shell /bin/false --uid 1234 foobar]
  useradd: group &apos;upstream-recipe-group1&apos; does not exist
  useradd: group &apos;upstream-recipe-group2&apos; does not exist
  ERROR: foobar: useradd command did not succeed.

for the record, for the time being as a workaround for this issue we&apos;re using following additional line in foobar recipe

  GROUPADD_PARAM_${PN}_append = &quot;;upstream-recipe-group1;upstream-recipe-group2&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96058</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-07-26 21:21:58 +0000</bug_when>
    <thetext>Bulk move of 64 bugs to 4.3 M3 after a quick review.
If a bug is actually fixed, please add a commit link and resolve it.
-- Randy for YP bug team.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96458</commentid>
    <comment_count>5</comment_count>
    <who name="Trevor Gamblin">tgamblin</who>
    <bug_when>2023-09-14 16:35:28 +0000</bug_when>
    <thetext>Moved to M4.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97180</commentid>
    <comment_count>6</comment_count>
    <who name="Eilís Ní Fhlannagáin">pidge</who>
    <bug_when>2023-11-02 13:10:23 +0000</bug_when>
    <thetext>This is an issue with the useradd.bbclass. We&apos;re not seeing this for users because we obviously have USERADD_PARAM and friends in a recipe (recipe B), but as we&apos;re relying on the GROUPADD_PARAM from recipe A, useradd_preinst doesn&apos;t find any GROUPADD_PARAM, doesn&apos;t add the groups and fails out of the setscene task and just runs do_package.

So, interestingly,

bitbake B
rm -rf tmp/
bitbake -c package B (Errors, but runs the actual do_package)

In the tests I&apos;m writing for this, my test recipe spits out (WARNING: Setscene task (/home/pidge/poky/meta-selftest/recipes-test/usergrouptests/creategroupdep.bb:do_package_setscene) failed with exit code &apos;1&apos; - real task will be run instead)

So, running &apos;bitbake -c package B&apos; immediately after the above without deleting tmp will succeed because the actual do_package ran and created the group.

The question here is how to fix this correctly. We could look at the USERADD_PARAM, see if a non-system group is specified, check if there is a GROUP_PARAM for that specific group and if not create the appropriate GROUP_PARAM, which is how I&apos;m leaning.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97183</commentid>
    <comment_count>7</comment_count>
    <who name="Jermain Horsman">jermain.horsman</who>
    <bug_when>2023-11-02 14:32:10 +0000</bug_when>
    <thetext>This has generally been my experience as well.

- from a certain sstate the warning &quot;WARNING: Setscene task (somerecipe.bb:do_package_setscene) failed with exit code &apos;1&apos; - real task will be run instead&quot; will occur
- bitbake will continue and finish building everything (successfully), but exit with an error due to the previous warning
- sstate is updated and a subsequent run will be fine</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97279</commentid>
    <comment_count>8</comment_count>
    <who name="Eilís Ní Fhlannagáin">pidge</who>
    <bug_when>2023-11-19 04:19:44 +0000</bug_when>
    <thetext>I have a patch for this that adds each dependancies do_populate_sysroot_setscene to USERADDSETSCENEDEPS (and selftests). 

This seems to fix it, however I want to see how this works with some of the suggested suggestions for https://bugzilla.yoctoproject.org/show_bug.cgi?id=15084 and https://bugzilla.yoctoproject.org/show_bug.cgi?id=13904 as these seem related or at least close enough to each other that I want to see how these all work together.

One thing mentioned in the other bug is the question of should a recipe that relies on anothers group have that recipe as a DEPENDS. I believe it should and we should document it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97581</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2023-12-15 13:58:04 +0000</bug_when>
    <thetext>Architecture list discussion:

https://lists.openembedded.org/g/openembedded-architecture/message/1873

Then related changes to the fix:

https://git.yoctoproject.org/poky/commit/?id=0f4fe4f7630b45228bcbb893f08a86e00109296c
https://git.yoctoproject.org/poky/commit/?id=ecef665062be55fcfa0915216335d08883aa86f7
https://git.yoctoproject.org/poky/commit/?id=f73e52dd71156ebcb5016f1241eebb889417e3e4</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>