Am Do, 4. Nov 2021, um 11:00, schrieb Jeffrey Simons:
Hi all,
I'm having some difficulty with setting up users and the respective application user assignments. I have a generic recipe which inherits useradd and sets a user, this works great for my purpose without one exception. I can't assign the user in my other recipe where the application is build.
Snippet from my user add (based on the useradd-example): USERADD_PARAM_${PN} = "--uid 1200 \ --home-dir /home/user1 \ --groups dialout \ --user-group \ --password '********' \ --shell /bin/bash user1"
Snippet from my application which wants to assign the user1: do_install () { chown -R user1 ${D}/usr/local/bin/test_app/ } It fails with the message: "WARNING: test_app-1.0-12-r0 do_package_qa: QA Issue: test_app: /usr/local/bin/test_app/some_script.py is owned by uid 1000, which is the same as the user running bitbake. This may be due to host contamination"
Any pointers/thoughts in how I can resolve this issue?
Does the recipe which builds the application DEPEND on the recipe which sets up the user? This is what I would try. If I understand things correctly, Yocto/Bitbake provides every recipe a pristine environment unnaffected from other recipes going into the same image. For example, if you want to link your application against some libraries provided by other recipes, you need to add them to DEPENDS. That populates your build environment with that other recipes output. I'm not sure this applies to user accounts as well, but I guess it's worth a try.
Please note I probably used the termins "recipe" and "package" incorrectly.