[yocto] useradd and one sysroot per recipe in pyro

Andersen, Christian c.andersen at kostal.com
Tue Jun 13 09:10:10 PDT 2017


currently I am trying the newest Yocto release (pyro). It seems I have a problem with useradd and the new concept of one sysroot per recipe.

I have a base recipe (let's call it my-base.bb) which inherits useradd and creates a new user (let's call him myuser):

inherit useradd

    --uid 1200 \
    --gid 1200 \
    --system \
    --shell /bin/bash \
    --create-home \
    --home-dir /home/myuser \
    --groups mygroup,video,input \
GROUPADD_PARAM_${PN} = "-g 1200 mygroup"

do_install () {
install -d ${D}/home/myuser
            chown -R myuser:mygroup ${D}/home/myuser

Other recipes depend on this base recipe (via DEPENDS and RDEPENDS), because they require this user, e.g. in recipe my-appl.bb (in this case python only, so no configure or compile):

DEPENDS = "puck-base"
RDEPENDS_${PN} = "puck-base python3-dbus python3-sqlite3 python3-netclient python3-requests"

do_configure[noexec] = "1"
do_compile[noexec] = "1"

do_install () {

install -d ${D}${sysconfdir}/myappl
            chown -R myuser:mygroup ${D}${sysconfdir}/myappl

install -d ${D}${localstatedir}/lib/myappl
            chown -R myuser:mygroup ${D}${localstatedir}/lib/myappl

Unfortunately I get an error when building the recipe my-appl.bb

| chown: invalid user: 'myuser:mygroup'
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_install (log file is located at ...)
ERROR: Task (.../my-appl.bb:do_install) failed with exit code '1'

In morty the user was created in the shared sysroot. But using pyro the user is not created in the recipe-sysroot.

What am I doing wrong and is there a way to solve this?

Thanks in advance!

Kind regards

KOSTAL Industrie Elektrik GmbH

Christian Andersen
IE1.3 Entwicklung Desktop-/Webanwendungen

Lange Eck 11, 58099 Hagen
Telefon: +49 2331 8040 - 634
Telefax: +49 2331 8040 - 660
E-Mail: c.andersen at kostal.com<mailto:c.andersen at kostal.com>

Internet: http://www.kostal-industrie-elektrik.com<http://www.kostal-industrie-elektrik.com/>

KOSTAL Industrie Elektrik GmbH - Sitz Lüdenscheid, Registergericht Iserlohn HRB 3924 - USt-Id-Nr./Vat No.: DE 813742170
Postanschrift: An der Bellmerei 10, D-58513 Lüdenscheid * Telefon: +49  2351 16-0 * Telefax: +49  2351 16-2400
Werksanschrift: Lange Eck 11, D-58099 Hagen * Tel. +49 2331 8040-601 * Fax +49 2331 8040-602
Geschäftsführung: Axel Zimmermann, Dipl.-Ing. Marwin Kinzl, Dipl.-Oec. Andreas Kostal

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20170613/15263443/attachment.html>

More information about the yocto mailing list