[yocto] extrausers working from image file .bb but not from .bbappend

Chris Morgan chmorgan at gmail.com
Wed Apr 22 05:12:23 PDT 2015


On Wed, Apr 22, 2015 at 7:03 AM, Paul Eggleton
<paul.eggleton at linux.intel.com> wrote:
> On Wednesday 22 April 2015 07:00:50 Chris Morgan wrote:
>> On Wed, Apr 22, 2015 at 4:10 AM, Paul Eggleton
>>
>> <paul.eggleton at linux.intel.com> wrote:
>> > On Tuesday 21 April 2015 18:54:29 Khem Raj wrote:
>> >> Hi Chris
>> >>
>> >> > On Apr 21, 2015, at 6:27 PM, Chris Morgan <chmorgan at gmail.com> wrote:
>> >> >
>> >> > Hello.
>> >> >
>> >> > Based on
>> >> > http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#ref
>> >> > -c
>> >> > lasses-extrausers and the .bbclass file I've added this to a .bbappend,
>> >> > pulseaudio_%.bbappend actually so root user can use pactl when
>> >> > pulseaudio is running in system mode:
>> >> >
>> >> > inherit extrausers
>> >> > EXTRA_USERS_PARAMS = "\
>> >> >
>> >> >        usermod -a -G audio root \
>> >> >
>> >> > "
>> >> >
>> >> >
>> >> > From the .bbappend this isn't working. If instead I add it to our
>> >> > custom image file recipe (image-blah.bb) it does work.
>> >>
>> >> its a image level config so thats right behavior.
>> >>
>> >> > I'm not sure how to debug or why it isn't working from the .bbappend.
>> >> > Thoughts?
>> >> >
>> >> >
>> >> >
>> >> > Also, the documentation in the .bbclass seems out of date but wanted to
>> >> > confirm:
>> >> >
>> >> > http://git.yoctoproject.org/cgit.cgi/poky/plain/meta/classes/extrausers
>> >> > .bb
>> >> > class
>> >> >
>> >> > shows:
>> >> >
>> >> > Below is an example showing how to use this functionality.
>> >> > # INHERIT += "extrausers"
>> >> > # EXTRA_USERS_PARAMS = "\
>> >> > # useradd -p '' tester; \
>> >> > # groupadd developers; \
>> >> > # userdel nobody; \
>> >> > # groupdel -g video; \
>> >> > # groupmod -g 1020 developers; \
>> >> > # usermod -s /bin/sh tester; \
>> >> > # "
>> >> >
>> >> > This INHERIT vs. inherit seems like it could be something that changed
>> >> > in bitbake in the past but was left over in the .bbclass.
>> >>
>> >> its correct because its assuming you are adding it to config metadata and
>> >> not recipe metadata may be location is not right. Send a patch
>> >
>> > It should work either in the image recipe (with inherit) or at the
>> > configuration level (with INHERIT +=), but I agree extrausers not intended
>> > to work from individual recipes, we have useradd for that.
>>
>> Looked at useradd source and documentation and skeleton example but I
>> don't see a way to add another specific user to a group.
>>
>> I had been looking to use extrausers with 'usermod' in the
>> pulseaudio_%.bbappend because the pulseaudio.inc base recipe file is
>> the one creating the 'audio' group and adding the 'pulse' user to it.
>> So it seemed like an appropriate recipe to add to to also add root to
>> the 'audio' group.
>>
>> Am I missing some way of doing this with useradd or should I just be
>> modifying the top level image recipe to resolve this issue?
>
> I don't believe useradd.bbclass can be used to solve this, no. You probably
> need to use extrausers.bbclass from the image recipe.


Hmm. Alright. Appreciate the help Paul, and you too Khem.

For pulseaudio as a system service it would be handy if root could use
pactl. While I'm not working on adding support like this upstream at
the moment, I'm not sure how one might do so if each image had to add
the extrausers entries to adjust groups. It looks like the group
approach isn't the correct one in this case but I'm also not sure what
other approaches would work.

Chris



More information about the yocto mailing list