[yocto] How to use same user in two recipes?

Burton, Ross ross.burton at intel.com
Wed Oct 11 02:13:52 PDT 2017


Looks like the useradd-example recipe isn't working properly. Check the
contents of the files in the sysroot to see if it did the right thing, and
for errors in the recipe's logs.

On 11 October 2017 at 10:10, Fabien Lahoudere <
fabien.lahoudere at collabora.co.uk> wrote:

> Thanks Ross
>
> The problem is that it fails with Pyro and also with oe-core master:
>
> I use recipe in meta-skeleton/recipes-skeleton/useradd/ to create users
> and the following testuser.bb:
>
> --------------------------------------------------------
> testuser.bb--------------------------------------------------------
> SUMMARY = ""
> DESCRIPTION = ""
> PR = "r1"
> LICENSE = "MIT"
> LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=
> 3da9cfbcb788c80a0384361b4de20420"
>
> DEPENDS += " useradd-example "
>
> SRC_URI = " "
>
> S = "${WORKDIR}"
>
> do_install () {
> install -d -m 755 ${D}${datadir}/testuser1
> echo hello > ${D}${datadir}/testuser1/file
> chown -R user1 ${D}${datadir}/testuser1
> }
>
> FILES_${PN} = "${datadir}/testuser1/* "
> ------------------------------------------------------------
> ---------------------------------------------------------------
>
> and I have the following error and users are not populated in testuser
> recipe-sysroot/etc/passwd
>
> ERROR: testuser-1.0-r1 do_install: Function failed: do_install (log file
> is located at /home/aragua/src/oe-core/build/tmp-glibc/work/
> cortexa9hf-neon-oe-linux-gnueabi/testuser/1.0-r1/temp/
> log.do_install.26924)
> ERROR: Logfile of failure stored in: /home/aragua/src/oe-core/
> build/tmp-glibc/work/cortexa9hf-neon-oe-linux-
> gnueabi/testuser/1.0-r1/temp/log.do_install.26924
> Log data follows:
> | DEBUG: Executing python function extend_recipe_sysroot
> | NOTE: Direct dependencies are ['/home/aragua/src/oe-core/
> build/../meta-coerd/recipes-test/useradd/useradd-example.bb:do_populate_sysroot',
> 'virtual:native:/home/aragua/src/oe-core/meta/recipes-
> devtools/pseudo/pseudo_1.8.2.bb:do_populate_sysroot',
> '/home/aragua/src/oe-core/meta/recipes-core/glibc/glibc_2.26.bb:do_populate_sysroot',
> '/home/aragua/src/oe-core/meta/recipes-devtools/gcc/gcc-runtime_7.2.bb:
> do_populate_sysroot', '/home/aragua/src/oe-core/
> meta/recipes-devtools/quilt/quilt-native_0.65.bb:do_populate_sysroot',
> '/home/aragua/src/oe-core/meta/recipes-devtools/gcc/gcc-cross_7.2.bb:
> do_populate_sysroot']
> | NOTE: Installed into sysroot: ['pseudo-native']
> | NOTE: Skipping as already exists in sysroot: ['useradd-example',
> 'glibc', 'gcc-runtime', 'quilt-native', 'gcc-cross-arm', 'shadow',
> 'base-files', 'base-passwd', 'shadow-sysroot', 'linux-libc-headers',
> 'libgcc', 'xz-native', 'texinfo-dummy-native', 'binutils-cross-arm',
> 'gmp-native', 'libtool-native', 'zlib-native', 'libmpc-native',
> 'gnu-config-native', 'automake-native', 'mpfr-native', 'autoconf-native',
> 'opkg-utils', 'attr', 'gettext-minimal-native', 'flex-native',
> 'bison-native', 'm4-native']
> | DEBUG: Python function extend_recipe_sysroot finished
> | DEBUG: Executing shell function do_install
> | chown: invalid user: ‘user1’
> | WARNING: exit code 1 from a shell command.
> | ERROR: Function failed: do_install (log file is located at
> /home/aragua/src/oe-core/build/tmp-glibc/work/cortexa9hf-neon-oe-linux-
> gnueabi/testuser/1.0-r1/temp/log.do_install.26924)
>
> Thanks
>
>
> On Wed, 2017-10-11 at 09:54 +0100, Burton, Ross wrote:
>
> Both of your recipes will need to depend on the user-creating recipe.
>
> Ross
>
> On 11 October 2017 at 07:45, Fabien Lahoudere <fabien.lahoudere at collabora.
> co.uk> wrote:
>
> On Tue, 2017-10-10 at 15:31 -0700, Aaron_Wright at selinc.com wrote:
>
> > Hi
> >
> > I want to use the same user in two different recipe.
> > I create the user in recipe A.bb and it works fine.
> > Now I want to use the same user in B.bb so I add DEPENDS = "A"
> > thinking that sysroot will be
> > populated with A.bb users.
> >
> > But when I bitbake the recipe, user is not found.
> > I conclude that I have to use USERADD_* in each recipe, right?
> >
> > What happen if I use different USERADD_PARAM_${PN} in each recipe?
> >
> > I also try to use EXTRA_USERS_PARAMS but without success?
> >
> > Is there a way to populate sysroot with users?
> >
> > Thanks
> >
> > --
> > Fabien
> > --
>
> When I have this issue I just make a separate recipe that creates the
> user, and have all the other recipes depend on it.
> That way the user is always created with the same parameters, without
> possibility of getting out of sync.
>
>
> Thanks Aaron
>
> Yes it is exactly what we do before with morty but now we use pyro and the
> sysroot is per recipe and not common to all recipe.
> And I search in the sysroot and the users created in recipe A are not
> applied to /etc/passwd.
>
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>
>
> --
>
> Fabien
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20171011/1f38edc1/attachment.html>


More information about the yocto mailing list