Re: User configuration & host contamination


Jeffrey Simons
 

On Thu, Nov 11, 2021 at 03:34 PM, Jeffrey Simons wrote:
Hi Manuel,

Subject: Re: [yocto] User configuration & host contamination

Hi Jeffrey,

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.

Hope this helps,
Manuel
Thank you for your reply and suggestion.
I already have a dependency on the user-configuration script, see the below snippet from my recipe.

# Compile-time dependencies for testapp
DEPENDS = "user-configuration"

# Run-time dependencies for testapp
RDEPENDS_${PN} += "rsyslog \

Unfortunately that did not work, I have seen some suggestions on stack-overflow where they added the user multiple times per recipe by using extrauseradd (I believe).
That seems a bit weird to me to add every time the same user, also the drawback is that if the user changes then I have to adjust all recipes that rely on that specific user.
What I did today to circumvent the issue is to assign the user by reference of UID and GID, but I'm not sure if this is the intended Yocto way. As you stated before
Yocto presents you with a pristine environment with all information present, so I would expect that my user is there. Perhaps I did not include the user-configuration
correctly?
I did include the user-configuration by adding it into our distribution description, see the next coding snippet.

#
# Usernames that will be used within the distro.
# Can be changed when desired, each recipe must use this user for the application.
#
TEST_USER = "testuser"
TEST_USER_UID = "1200"

DISTRO_EXTRA_RDEPENDS += "user-configuration"

Can you or any one else clarify if this is the correct way or not?

Thank you in advance.

Jeffrey Simons

Software Engineer
Royal Boon Edam International B.V.
Hi All,

Can anyone elaborate on my fix if this is the correct way, or point me in the correct direction.

With kind regards,
Jeffrey Simons

Software Engineer
Royal Boon Edam International B.V.

Join {yocto@lists.yoctoproject.org to automatically receive all group messages.