Adding and using user in more than one recipe


Greg Wilson-Lindberg <gwilson@...>
 

Hello list,

I’m trying to understand how the extrauser and adduser packages are used and interact in kirkstone.

 

I need to add a user and I would like to also use this user in another recipe. This had been working in our previous builds using version of Yocto up to hardnot. We are in the process of updating to kirkstone and the user stuff has now broken and I am not making any sense out of the documentation.

 

How do I create a user in one recipe and then use that user in another recipe? Can I even do that, or do I need to create the user in more than one recipe with a hard coded UID, GID?

 

Regards,

Greg Wilson-LIndberg

 


Khem Raj
 

On Fri, Jul 22, 2022 at 5:23 PM Greg Wilson-Lindberg
<gwilson@...> wrote:

Hello list,

I’m trying to understand how the extrauser and adduser packages are used and interact in kirkstone.



I need to add a user and I would like to also use this user in another recipe. This had been working in our previous builds using version of Yocto up to hardnot. We are in the process of updating to kirkstone and the user stuff has now broken and I am not making any sense out of the documentation.



How do I create a user in one recipe and then use that user in another recipe? Can I even do that, or do I need to create the user in more than one recipe with a hard coded UID, GID?

you can do it in image recipe

inherit extrausers

IMAGE_FEATURES:remove = "debug-tweaks"

EXTRA_USERS_PARAMS += "\
useradd scribbledeedoo; \
usermod -p '$(openssl passwd -6 diddleDoo5)' scribbledeedoo; \
usermod -a -G adm scribbledeedoo; \
usermod -a -G video scribbledeedoo; \
usermod -a -G audio scribbledeedoo; \
usermod -a -G systemd-journal scribbledeedoo; \
"

HTH

-Khem



Regards,

Greg Wilson-LIndberg






Greg Wilson-Lindberg <gwilson@...>
 

Hi Khem,
That's originally what I had, but for some reason I hadn't put in the useradd line. I'm assuming that then because this is at the beginning of the image generation, I can then use the new user in any other recipe. Is there anything that I need to do to inherit the new user, or is it just there?

Thanks,
Greg

-----Original Message-----
From: Khem Raj <raj.khem@...>
Sent: Friday, July 22, 2022 17:38
To: Greg Wilson-Lindberg <GWilson@...>
Cc: yocto@...
Subject: Re: [yocto] Adding and using user in more than one recipe

On Fri, Jul 22, 2022 at 5:23 PM Greg Wilson-Lindberg
<gwilson@...> wrote:

Hello list,

I’m trying to understand how the extrauser and adduser packages are used
and interact in kirkstone.



I need to add a user and I would like to also use this user in another recipe.
This had been working in our previous builds using version of Yocto up to
hardnot. We are in the process of updating to kirkstone and the user stuff
has now broken and I am not making any sense out of the documentation.



How do I create a user in one recipe and then use that user in another
recipe? Can I even do that, or do I need to create the user in more than one
recipe with a hard coded UID, GID?

you can do it in image recipe

inherit extrausers

IMAGE_FEATURES:remove = "debug-tweaks"

EXTRA_USERS_PARAMS += "\
useradd scribbledeedoo; \
usermod -p '$(openssl passwd -6 diddleDoo5)' scribbledeedoo; \
usermod -a -G adm scribbledeedoo; \
usermod -a -G video scribbledeedoo; \
usermod -a -G audio scribbledeedoo; \
usermod -a -G systemd-journal scribbledeedoo; \ "

HTH

-Khem



Regards,

Greg Wilson-LIndberg






Greg Wilson-Lindberg <gwilson@...>
 

Hello Khem,
I've added in the useradd line in my image recipe:
EXTRA_USERS_PARAMS = "\
    useradd -d /home/${SAKURA_USER} -r -s /bin/bash -U ${SAKURA_USER}; \
    usermod -p '${SAKURA_PASS}' ${SAKURA_USER}; \
    usermod -a -G sudo,dialout,video,input,audio,disk,shutdown,datetime ${SAKURA_USER}; \
    "
But I am still getting errors in the two recipes that I try to use the new user. How do I tell them that I need to inherit the added user, do I add a DEPEND or RDEPEND on the top level image recipe? Is there some other way?

I saw a previous thread somewhere that suggested making a separate recipe to create the user in and then making the recipes that use that user DEPEND on the creation recipe.

Regards,
Greg


From: yocto@... <yocto@...> on behalf of Greg Wilson-Lindberg <gwilson@...>
Sent: Saturday, July 23, 2022 8:03 AM
To: Khem Raj <raj.khem@...>
Cc: yocto@... <yocto@...>
Subject: Re: [yocto] Adding and using user in more than one recipe
 
Hi Khem,
That's originally what I had, but for some reason I hadn't put in the useradd line. I'm assuming that then because this is at the beginning of the image generation, I can then use the new user in any other recipe. Is there anything that I need to do to inherit the new user, or is it just there?

Thanks,
Greg

> -----Original Message-----
> From: Khem Raj <raj.khem@...>
> Sent: Friday, July 22, 2022 17:38
> To: Greg Wilson-Lindberg <GWilson@...>
> Cc: yocto@...
> Subject: Re: [yocto] Adding and using user in more than one recipe
>
> On Fri, Jul 22, 2022 at 5:23 PM Greg Wilson-Lindberg
> <gwilson@...> wrote:
> >
> > Hello list,
> >
> > I’m trying to understand how the extrauser and adduser packages are used
> and interact in kirkstone.
> >
> >
> >
> > I need to add a user and I would like to also use this user in another recipe.
> This had been working in our previous builds using version of Yocto up to
> hardnot. We are in the process of updating to kirkstone and the user stuff
> has now broken and I am not making any sense out of the documentation.
> >
> >
> >
> > How do I create a user in one recipe and then use that user in another
> recipe? Can I even do that, or do I need to create the user in more than one
> recipe with a hard coded UID, GID?
> >
> >
>
> you can do it in image recipe
>
> inherit extrausers
>
> IMAGE_FEATURES:remove = "debug-tweaks"
>
> EXTRA_USERS_PARAMS += "\
>     useradd scribbledeedoo; \
>     usermod -p '$(openssl passwd -6 diddleDoo5)' scribbledeedoo; \
>     usermod -a -G adm scribbledeedoo; \
>     usermod -a -G video scribbledeedoo; \
>     usermod -a -G audio scribbledeedoo; \
>     usermod -a -G systemd-journal scribbledeedoo; \ "
>
> HTH
>
> -Khem
>
>
> >
> > Regards,
> >
> > Greg Wilson-LIndberg
> >
> >
> >
> >
> >
> >


Khem Raj
 

On Mon, Jul 25, 2022 at 2:08 PM Greg Wilson-Lindberg
<GWilson@...> wrote:

Hello Khem,
I've added in the useradd line in my image recipe:

EXTRA_USERS_PARAMS = "\
useradd -d /home/${SAKURA_USER} -r -s /bin/bash -U ${SAKURA_USER}; \
usermod -p '${SAKURA_PASS}' ${SAKURA_USER}; \
usermod -a -G sudo,dialout,video,input,audio,disk,shutdown,datetime ${SAKURA_USER}; \
"

But I am still getting errors in the two recipes that I try to use the new user. How do I tell them that I need to inherit the added user, do I add a DEPEND or RDEPEND on the top level image recipe? Is there some other way?

I saw a previous thread somewhere that suggested making a separate recipe to create the user in and then making the recipes that use that user DEPEND on the creation recipe.
if you need it in a recipe then perhaps that maybe a good approach.

Regards,
Greg
________________________________
From: yocto@... <yocto@...> on behalf of Greg Wilson-Lindberg <gwilson@...>
Sent: Saturday, July 23, 2022 8:03 AM
To: Khem Raj <raj.khem@...>
Cc: yocto@... <yocto@...>
Subject: Re: [yocto] Adding and using user in more than one recipe

Hi Khem,
That's originally what I had, but for some reason I hadn't put in the useradd line. I'm assuming that then because this is at the beginning of the image generation, I can then use the new user in any other recipe. Is there anything that I need to do to inherit the new user, or is it just there?

Thanks,
Greg

-----Original Message-----
From: Khem Raj <raj.khem@...>
Sent: Friday, July 22, 2022 17:38
To: Greg Wilson-Lindberg <GWilson@...>
Cc: yocto@...
Subject: Re: [yocto] Adding and using user in more than one recipe

On Fri, Jul 22, 2022 at 5:23 PM Greg Wilson-Lindberg
<gwilson@...> wrote:

Hello list,

I’m trying to understand how the extrauser and adduser packages are used
and interact in kirkstone.



I need to add a user and I would like to also use this user in another recipe.
This had been working in our previous builds using version of Yocto up to
hardnot. We are in the process of updating to kirkstone and the user stuff
has now broken and I am not making any sense out of the documentation.



How do I create a user in one recipe and then use that user in another
recipe? Can I even do that, or do I need to create the user in more than one
recipe with a hard coded UID, GID?

you can do it in image recipe

inherit extrausers

IMAGE_FEATURES:remove = "debug-tweaks"

EXTRA_USERS_PARAMS += "\
useradd scribbledeedoo; \
usermod -p '$(openssl passwd -6 diddleDoo5)' scribbledeedoo; \
usermod -a -G adm scribbledeedoo; \
usermod -a -G video scribbledeedoo; \
usermod -a -G audio scribbledeedoo; \
usermod -a -G systemd-journal scribbledeedoo; \ "

HTH

-Khem



Regards,

Greg Wilson-LIndberg