From: Henning Schild <henning.schild@siemens.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH] buildchroot: Align UID and GID of builder user with caller
Date: Mon, 12 Nov 2018 10:16:48 +0100 [thread overview]
Message-ID: <20181112101648.051ce0ed@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <0ec8a678-7297-4ad9-4a9b-49d87f504061@web.de>
I am afraid that this is not correct. The ids you are taking from the
"host" might be taken inside the chroot. As a result creating the
user/group would fail. Chances might be low ... This also assumes that
ids/hosts will never change and breaks migrating a build to another
host.
If the host fails to remove/overwrite the files, we will have to use
sudo on the host.
Henning
Am Sat, 10 Nov 2018 08:52:38 +0100
schrieb Jan Kiszka <jan.kiszka@web.de>:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This fixes EPERM on rebuild and also some clean builds: We have to
> align the IDs of the builder user with the user in the host
> environment. Otherwise, files and directories can become unaccessible
> during the build.
>
> Fixes: be291cd991bd ("buildchroot: build debian packages as "builder"
> not "root"") Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> meta/recipes-devtools/buildchroot/buildchroot.inc | 4 +++-
> meta/recipes-devtools/buildchroot/files/configscript.sh | 4 ++--
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.inc
> b/meta/recipes-devtools/buildchroot/buildchroot.inc index
> 7dd909e..2c44db9 100644 ---
> a/meta/recipes-devtools/buildchroot/buildchroot.inc +++
> b/meta/recipes-devtools/buildchroot/buildchroot.inc @@ -36,7 +36,9 @@
> do_build() {
> # Configure root filesystem
> sudo install -m 755 ${WORKDIR}/configscript.sh ${BUILDCHROOT_DIR}
> - sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
> + USER_ID=$(id -u)
> + GROUP_ID=$(id -g)
> + sudo chroot ${BUILDCHROOT_DIR} /configscript.sh $USER_ID
> $GROUP_ID
> sudo mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
> }
> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
> b/meta/recipes-devtools/buildchroot/files/configscript.sh index
> 30660e7..7e49385 100644 ---
> a/meta/recipes-devtools/buildchroot/files/configscript.sh +++
> b/meta/recipes-devtools/buildchroot/files/configscript.sh @@ -10,6
> +10,6 @@ locales locales/locales_to_be_generated multiselect
> en_US.UTF-8 UTF-8 locales locales/default_environment_locale select
> en_US.UTF-8 END
> -addgroup --quiet --system builder
> -useradd --system --gid builder --no-create-home --home /home/builder
> --no-user-group --comment "Isar buildchroot build user" builder
> +addgroup --quiet --system builder --gid $2 +useradd --system --uid
> $1 --gid builder --no-create-home --home /home/builder
> --no-user-group --comment "Isar buildchroot build user" builder chown
> -R builder:builder /home/builder
next prev parent reply other threads:[~2018-11-12 9:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-10 7:52 Jan Kiszka
2018-11-12 9:16 ` Henning Schild [this message]
2018-11-12 9:19 ` Jan Kiszka
2018-11-12 9:42 ` Henning Schild
2018-11-12 9:52 ` Jan Kiszka
2018-11-12 10:06 ` Henning Schild
2018-11-12 10:09 ` Jan Kiszka
2018-11-12 11:58 ` Henning Schild
2018-11-12 12:11 ` Jan Kiszka
2018-11-12 12:27 ` Jan Kiszka
2018-11-12 13:37 ` Henning Schild
2018-11-12 12:34 ` Henning Schild
2018-11-12 12:33 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181112101648.051ce0ed@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox