* [PATCH 0/2] mounts for buildchroot
@ 2018-02-05 16:43 Alexander Smirnov
2018-02-05 16:43 ` [PATCH 1/2] buildchroot: Do not call 'apt-get update' Alexander Smirnov
2018-02-05 16:43 ` [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc' Alexander Smirnov
0 siblings, 2 replies; 19+ messages in thread
From: Alexander Smirnov @ 2018-02-05 16:43 UTC (permalink / raw)
To: isar-users; +Cc: Alexander Smirnov
Hi all,
this series introduces my vision, how virtual filsystems (dev, sys, proc)
should be provided to buildchroot.
Currently we use several mounts around some pieces of code, but this
approach can't guarantee that adding new package or feature will not
also require these mounts. So I propose to have permanently mounted the
following systems in buildchroot:
- /sys
- /proc
- /dev (--bind)
Mount is performed very early, the umount is dome via event BuildCompleted.
This approach frees us from handling build fails cases, because this event
occured anytime bitbake finished it's execution.
Alex
Alexander Smirnov (2):
buildchroot: Do not call 'apt-get update'
buildchroot: Permanently mount '/dev', '/sys' and '/proc'
meta/classes/isar-events.bbclass | 3 +++
meta/recipes-devtools/buildchroot/buildchroot.bb | 21 +++++++--------------
.../buildchroot/files/configscript.sh | 5 -----
.../buildchroot/files/download_dev-random | 13 -------------
4 files changed, 10 insertions(+), 32 deletions(-)
delete mode 100644 meta/recipes-devtools/buildchroot/files/download_dev-random
--
2.1.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/2] buildchroot: Do not call 'apt-get update'
2018-02-05 16:43 [PATCH 0/2] mounts for buildchroot Alexander Smirnov
@ 2018-02-05 16:43 ` Alexander Smirnov
2018-02-05 16:51 ` Jan Kiszka
2018-02-05 16:43 ` [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc' Alexander Smirnov
1 sibling, 1 reply; 19+ messages in thread
From: Alexander Smirnov @ 2018-02-05 16:43 UTC (permalink / raw)
To: isar-users; +Cc: Alexander Smirnov
We should not do this to avoid local Packages.gz update.
Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
meta/recipes-devtools/buildchroot/files/configscript.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh b/meta/recipes-devtools/buildchroot/files/configscript.sh
index 9813c9a..458c94b 100644
--- a/meta/recipes-devtools/buildchroot/files/configscript.sh
+++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
@@ -44,5 +44,4 @@ mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
#configuring packages
dpkg --configure -a
-apt-get update
umount /dev
--
2.1.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-05 16:43 [PATCH 0/2] mounts for buildchroot Alexander Smirnov
2018-02-05 16:43 ` [PATCH 1/2] buildchroot: Do not call 'apt-get update' Alexander Smirnov
@ 2018-02-05 16:43 ` Alexander Smirnov
2018-02-05 16:53 ` Jan Kiszka
1 sibling, 1 reply; 19+ messages in thread
From: Alexander Smirnov @ 2018-02-05 16:43 UTC (permalink / raw)
To: isar-users; +Cc: Alexander Smirnov
Mount these folders permanently before creating buildchroot. Mounts are
performed in dedicated task do_prepare, so it will also work if you run
build with already existing buildchroot.
BuildCompleted event is used for clean up, so we should not take care
about this manually.
Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
meta/classes/isar-events.bbclass | 3 +++
meta/recipes-devtools/buildchroot/buildchroot.bb | 21 +++++++--------------
.../buildchroot/files/configscript.sh | 4 ----
.../buildchroot/files/download_dev-random | 13 -------------
4 files changed, 10 insertions(+), 31 deletions(-)
delete mode 100644 meta/recipes-devtools/buildchroot/files/download_dev-random
diff --git a/meta/classes/isar-events.bbclass b/meta/classes/isar-events.bbclass
index 55fc106..9f581a6 100644
--- a/meta/classes/isar-events.bbclass
+++ b/meta/classes/isar-events.bbclass
@@ -15,6 +15,9 @@ python isar_handler () {
# Clean up buildchroot
subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/isar-apt || /bin/true', stdout=devnull, stderr=devnull, shell=True)
+ subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/dev || /bin/true', stdout=devnull, stderr=devnull, shell=True)
+ subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/proc || /bin/true', stdout=devnull, stderr=devnull, shell=True)
+ subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/sys || /bin/true', stdout=devnull, stderr=devnull, shell=True)
devnull.close()
}
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index 0044a71..b8aaf28 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -12,7 +12,6 @@ FILESPATH =. "${LAYERDIR_core}/recipes-devtools/buildchroot/files:"
SRC_URI = "file://multistrap.conf.in \
file://configscript.sh \
file://setup.sh \
- file://download_dev-random \
file://build.sh"
PV = "1.0"
@@ -32,16 +31,21 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
do_prepare[nostamp] = "1"
-do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt"
+do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt \
+ ${BUILDCHROOT_DIR}/dev \
+ ${BUILDCHROOT_DIR}/proc \
+ ${BUILDCHROOT_DIR}/sys"
do_prepare() {
sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
+ sudo mount --bind /dev ${BUILDCHROOT_DIR}/dev
+ sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
+ sudo mount -t sysfs none ${BUILDCHROOT_DIR}/sys
}
addtask prepare before do_build after do_unpack
do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
-do_build[dirs] = "${WORKDIR}/hooks_multistrap"
do_build[depends] = "isar-apt:do_cache_config"
do_build() {
@@ -49,7 +53,6 @@ do_build() {
chmod +x "${WORKDIR}/setup.sh"
chmod +x "${WORKDIR}/configscript.sh"
- install -m 755 "${WORKDIR}/download_dev-random" "${WORKDIR}/hooks_multistrap/"
# Multistrap accepts only relative path in configuration files, so get it:
cd ${TOPDIR}
@@ -68,15 +71,6 @@ do_build() {
-e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
"${WORKDIR}/multistrap.conf.in" > "${WORKDIR}/multistrap.conf"
- [ ! -d ${BUILDCHROOT_DIR}/proc ] && install -d -m 555 ${BUILDCHROOT_DIR}/proc
- sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
- _do_build_cleanup() {
- ret=$?
- sudo umount ${BUILDCHROOT_DIR}/proc 2>/dev/null || true
- (exit $ret) || bb_exit_handler
- }
- trap '_do_build_cleanup' EXIT
-
# Create root filesystem
sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f "${WORKDIR}/multistrap.conf"
@@ -85,5 +79,4 @@ do_build() {
# Configure root filesystem
sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
- _do_build_cleanup
}
diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh b/meta/recipes-devtools/buildchroot/files/configscript.sh
index 458c94b..a5942b5 100644
--- a/meta/recipes-devtools/buildchroot/files/configscript.sh
+++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
@@ -39,9 +39,5 @@ export LC_ALL=C LANGUAGE=C LANG=C
#run pre installation script
/var/lib/dpkg/info/dash.preinst install
-# apt-get http method, gpg require /dev/null
-mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
-
#configuring packages
dpkg --configure -a
-umount /dev
diff --git a/meta/recipes-devtools/buildchroot/files/download_dev-random b/meta/recipes-devtools/buildchroot/files/download_dev-random
deleted file mode 100644
index 5b5b96b..0000000
--- a/meta/recipes-devtools/buildchroot/files/download_dev-random
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-set -e
-
-readonly ROOTFS="$1"
-
-mknod "${ROOTFS}/dev/random" c 1 8
-chmod 640 "${ROOTFS}/dev/random"
-chown 0:0 "${ROOTFS}/dev/random"
-
-mknod "${ROOTFS}/dev/urandom" c 1 9
-chmod 640 "${ROOTFS}/dev/urandom"
-chown 0:0 "${ROOTFS}/dev/urandom"
--
2.1.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] buildchroot: Do not call 'apt-get update'
2018-02-05 16:43 ` [PATCH 1/2] buildchroot: Do not call 'apt-get update' Alexander Smirnov
@ 2018-02-05 16:51 ` Jan Kiszka
2018-02-05 17:06 ` Alexander Smirnov
0 siblings, 1 reply; 19+ messages in thread
From: Jan Kiszka @ 2018-02-05 16:51 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-05 17:43, Alexander Smirnov wrote:
> We should not do this to avoid local Packages.gz update.
>
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> ---
> meta/recipes-devtools/buildchroot/files/configscript.sh | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh b/meta/recipes-devtools/buildchroot/files/configscript.sh
> index 9813c9a..458c94b 100644
> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
> @@ -44,5 +44,4 @@ mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>
> #configuring packages
> dpkg --configure -a
> -apt-get update
> umount /dev
>
Can you also explain why we (no longer?) need this? Just to ensure that
there are no subtle issues waiting to be surfaced.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-05 16:43 ` [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc' Alexander Smirnov
@ 2018-02-05 16:53 ` Jan Kiszka
2018-02-05 17:16 ` Alexander Smirnov
0 siblings, 1 reply; 19+ messages in thread
From: Jan Kiszka @ 2018-02-05 16:53 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-05 17:43, Alexander Smirnov wrote:
> Mount these folders permanently before creating buildchroot. Mounts are
> performed in dedicated task do_prepare, so it will also work if you run
> build with already existing buildchroot.
>
> BuildCompleted event is used for clean up, so we should not take care
> about this manually.
>
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> ---
> meta/classes/isar-events.bbclass | 3 +++
> meta/recipes-devtools/buildchroot/buildchroot.bb | 21 +++++++--------------
> .../buildchroot/files/configscript.sh | 4 ----
> .../buildchroot/files/download_dev-random | 13 -------------
> 4 files changed, 10 insertions(+), 31 deletions(-)
> delete mode 100644 meta/recipes-devtools/buildchroot/files/download_dev-random
>
> diff --git a/meta/classes/isar-events.bbclass b/meta/classes/isar-events.bbclass
> index 55fc106..9f581a6 100644
> --- a/meta/classes/isar-events.bbclass
> +++ b/meta/classes/isar-events.bbclass
> @@ -15,6 +15,9 @@ python isar_handler () {
>
> # Clean up buildchroot
> subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/isar-apt || /bin/true', stdout=devnull, stderr=devnull, shell=True)
> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/dev || /bin/true', stdout=devnull, stderr=devnull, shell=True)
> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/proc || /bin/true', stdout=devnull, stderr=devnull, shell=True)
> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/sys || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>
> devnull.close()
> }
> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
> index 0044a71..b8aaf28 100644
> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
> @@ -12,7 +12,6 @@ FILESPATH =. "${LAYERDIR_core}/recipes-devtools/buildchroot/files:"
> SRC_URI = "file://multistrap.conf.in \
> file://configscript.sh \
> file://setup.sh \
> - file://download_dev-random \
> file://build.sh"
> PV = "1.0"
>
> @@ -32,16 +31,21 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
> WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>
> do_prepare[nostamp] = "1"
> -do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt"
> +do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt \
> + ${BUILDCHROOT_DIR}/dev \
> + ${BUILDCHROOT_DIR}/proc \
> + ${BUILDCHROOT_DIR}/sys"
>
> do_prepare() {
> sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
> + sudo mount --bind /dev ${BUILDCHROOT_DIR}/dev
> + sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
> + sudo mount -t sysfs none ${BUILDCHROOT_DIR}/sys
> }
>
> addtask prepare before do_build after do_unpack
>
> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
> -do_build[dirs] = "${WORKDIR}/hooks_multistrap"
> do_build[depends] = "isar-apt:do_cache_config"
>
> do_build() {
> @@ -49,7 +53,6 @@ do_build() {
>
> chmod +x "${WORKDIR}/setup.sh"
> chmod +x "${WORKDIR}/configscript.sh"
> - install -m 755 "${WORKDIR}/download_dev-random" "${WORKDIR}/hooks_multistrap/"
>
> # Multistrap accepts only relative path in configuration files, so get it:
> cd ${TOPDIR}
> @@ -68,15 +71,6 @@ do_build() {
> -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
> "${WORKDIR}/multistrap.conf.in" > "${WORKDIR}/multistrap.conf"
>
> - [ ! -d ${BUILDCHROOT_DIR}/proc ] && install -d -m 555 ${BUILDCHROOT_DIR}/proc
> - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
> - _do_build_cleanup() {
> - ret=$?
> - sudo umount ${BUILDCHROOT_DIR}/proc 2>/dev/null || true
> - (exit $ret) || bb_exit_handler
> - }
> - trap '_do_build_cleanup' EXIT
> -
> # Create root filesystem
> sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f "${WORKDIR}/multistrap.conf"
>
> @@ -85,5 +79,4 @@ do_build() {
>
> # Configure root filesystem
> sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
> - _do_build_cleanup
> }
> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh b/meta/recipes-devtools/buildchroot/files/configscript.sh
> index 458c94b..a5942b5 100644
> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
> @@ -39,9 +39,5 @@ export LC_ALL=C LANGUAGE=C LANG=C
> #run pre installation script
> /var/lib/dpkg/info/dash.preinst install
>
> -# apt-get http method, gpg require /dev/null
> -mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
> -
> #configuring packages
> dpkg --configure -a
> -umount /dev
> diff --git a/meta/recipes-devtools/buildchroot/files/download_dev-random b/meta/recipes-devtools/buildchroot/files/download_dev-random
> deleted file mode 100644
> index 5b5b96b..0000000
> --- a/meta/recipes-devtools/buildchroot/files/download_dev-random
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -#!/bin/sh
> -
> -set -e
> -
> -readonly ROOTFS="$1"
> -
> -mknod "${ROOTFS}/dev/random" c 1 8
> -chmod 640 "${ROOTFS}/dev/random"
> -chown 0:0 "${ROOTFS}/dev/random"
> -
> -mknod "${ROOTFS}/dev/urandom" c 1 9
> -chmod 640 "${ROOTFS}/dev/urandom"
> -chown 0:0 "${ROOTFS}/dev/urandom"
>
That should finally obsolete my /dev/null fix. But after the problem
with my bind-mount attempt for /dev, I'd like to validate. What is the
baseline this patch should go upon?
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] buildchroot: Do not call 'apt-get update'
2018-02-05 16:51 ` Jan Kiszka
@ 2018-02-05 17:06 ` Alexander Smirnov
2018-02-05 17:25 ` Jan Kiszka
0 siblings, 1 reply; 19+ messages in thread
From: Alexander Smirnov @ 2018-02-05 17:06 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/05/2018 07:51 PM, Jan Kiszka wrote:
> On 2018-02-05 17:43, Alexander Smirnov wrote:
>> We should not do this to avoid local Packages.gz update.
>>
>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>> ---
>> meta/recipes-devtools/buildchroot/files/configscript.sh | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh b/meta/recipes-devtools/buildchroot/files/configscript.sh
>> index 9813c9a..458c94b 100644
>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>> @@ -44,5 +44,4 @@ mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>
>> #configuring packages
>> dpkg --configure -a
>> -apt-get update
>> umount /dev
>>
>
> Can you also explain why we (no longer?) need this? Just to ensure that
> there are no subtle issues waiting to be surfaced.
Multistrap calls 'apt-get install' for the list of packages, so at this
point the '/var/lib/apt' folder is created. So the upstream state used
to generate buildchroot is cached.
The line I removed in this patch, is called *after* rootfs generation,
so upstream state in cache could be possibly updated, do we need that?
Alex
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-05 16:53 ` Jan Kiszka
@ 2018-02-05 17:16 ` Alexander Smirnov
2018-02-05 17:30 ` Jan Kiszka
0 siblings, 1 reply; 19+ messages in thread
From: Alexander Smirnov @ 2018-02-05 17:16 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/05/2018 07:53 PM, Jan Kiszka wrote:
> On 2018-02-05 17:43, Alexander Smirnov wrote:
>> Mount these folders permanently before creating buildchroot. Mounts are
>> performed in dedicated task do_prepare, so it will also work if you run
>> build with already existing buildchroot.
>>
>> BuildCompleted event is used for clean up, so we should not take care
>> about this manually.
>>
>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>> ---
>> meta/classes/isar-events.bbclass | 3 +++
>> meta/recipes-devtools/buildchroot/buildchroot.bb | 21 +++++++--------------
>> .../buildchroot/files/configscript.sh | 4 ----
>> .../buildchroot/files/download_dev-random | 13 -------------
>> 4 files changed, 10 insertions(+), 31 deletions(-)
>> delete mode 100644 meta/recipes-devtools/buildchroot/files/download_dev-random
>>
>> diff --git a/meta/classes/isar-events.bbclass b/meta/classes/isar-events.bbclass
>> index 55fc106..9f581a6 100644
>> --- a/meta/classes/isar-events.bbclass
>> +++ b/meta/classes/isar-events.bbclass
>> @@ -15,6 +15,9 @@ python isar_handler () {
>>
>> # Clean up buildchroot
>> subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/isar-apt || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/dev || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/proc || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/sys || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>
>> devnull.close()
>> }
>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
>> index 0044a71..b8aaf28 100644
>> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
>> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
>> @@ -12,7 +12,6 @@ FILESPATH =. "${LAYERDIR_core}/recipes-devtools/buildchroot/files:"
>> SRC_URI = "file://multistrap.conf.in \
>> file://configscript.sh \
>> file://setup.sh \
>> - file://download_dev-random \
>> file://build.sh"
>> PV = "1.0"
>>
>> @@ -32,16 +31,21 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>> WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>>
>> do_prepare[nostamp] = "1"
>> -do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt"
>> +do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt \
>> + ${BUILDCHROOT_DIR}/dev \
>> + ${BUILDCHROOT_DIR}/proc \
>> + ${BUILDCHROOT_DIR}/sys"
>>
>> do_prepare() {
>> sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
>> + sudo mount --bind /dev ${BUILDCHROOT_DIR}/dev
>> + sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>> + sudo mount -t sysfs none ${BUILDCHROOT_DIR}/sys
>> }
>>
>> addtask prepare before do_build after do_unpack
>>
>> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>> -do_build[dirs] = "${WORKDIR}/hooks_multistrap"
>> do_build[depends] = "isar-apt:do_cache_config"
>>
>> do_build() {
>> @@ -49,7 +53,6 @@ do_build() {
>>
>> chmod +x "${WORKDIR}/setup.sh"
>> chmod +x "${WORKDIR}/configscript.sh"
>> - install -m 755 "${WORKDIR}/download_dev-random" "${WORKDIR}/hooks_multistrap/"
>>
>> # Multistrap accepts only relative path in configuration files, so get it:
>> cd ${TOPDIR}
>> @@ -68,15 +71,6 @@ do_build() {
>> -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
>> "${WORKDIR}/multistrap.conf.in" > "${WORKDIR}/multistrap.conf"
>>
>> - [ ! -d ${BUILDCHROOT_DIR}/proc ] && install -d -m 555 ${BUILDCHROOT_DIR}/proc
>> - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>> - _do_build_cleanup() {
>> - ret=$?
>> - sudo umount ${BUILDCHROOT_DIR}/proc 2>/dev/null || true
>> - (exit $ret) || bb_exit_handler
>> - }
>> - trap '_do_build_cleanup' EXIT
>> -
>> # Create root filesystem
>> sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f "${WORKDIR}/multistrap.conf"
>>
>> @@ -85,5 +79,4 @@ do_build() {
>>
>> # Configure root filesystem
>> sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
>> - _do_build_cleanup
>> }
>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh b/meta/recipes-devtools/buildchroot/files/configscript.sh
>> index 458c94b..a5942b5 100644
>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>> @@ -39,9 +39,5 @@ export LC_ALL=C LANGUAGE=C LANG=C
>> #run pre installation script
>> /var/lib/dpkg/info/dash.preinst install
>>
>> -# apt-get http method, gpg require /dev/null
>> -mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>> -
>> #configuring packages
>> dpkg --configure -a
>> -umount /dev
>> diff --git a/meta/recipes-devtools/buildchroot/files/download_dev-random b/meta/recipes-devtools/buildchroot/files/download_dev-random
>> deleted file mode 100644
>> index 5b5b96b..0000000
>> --- a/meta/recipes-devtools/buildchroot/files/download_dev-random
>> +++ /dev/null
>> @@ -1,13 +0,0 @@
>> -#!/bin/sh
>> -
>> -set -e
>> -
>> -readonly ROOTFS="$1"
>> -
>> -mknod "${ROOTFS}/dev/random" c 1 8
>> -chmod 640 "${ROOTFS}/dev/random"
>> -chown 0:0 "${ROOTFS}/dev/random"
>> -
>> -mknod "${ROOTFS}/dev/urandom" c 1 9
>> -chmod 640 "${ROOTFS}/dev/urandom"
>> -chown 0:0 "${ROOTFS}/dev/urandom"
>>
>
> That should finally obsolete my /dev/null fix. But after the problem
> with my bind-mount attempt for /dev, I'd like to validate. What is the
> baseline this patch should go upon?
>
Rebased patch to the latest 'next', please try 'asmirnov/devel' branch.
Also it would be helpful if you could test double ^C and broken build.
It would be perfect if it works :-)
NOTE: umounts are done within next 2-3 seconds after your build stopped
It seems this time is needed to stop bitbake server context.
Alex
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] buildchroot: Do not call 'apt-get update'
2018-02-05 17:06 ` Alexander Smirnov
@ 2018-02-05 17:25 ` Jan Kiszka
2018-02-06 9:12 ` Alexander Smirnov
0 siblings, 1 reply; 19+ messages in thread
From: Jan Kiszka @ 2018-02-05 17:25 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-05 18:06, Alexander Smirnov wrote:
> On 02/05/2018 07:51 PM, Jan Kiszka wrote:
>> On 2018-02-05 17:43, Alexander Smirnov wrote:
>>> We should not do this to avoid local Packages.gz update.
>>>
>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>> ---
>>> meta/recipes-devtools/buildchroot/files/configscript.sh | 1 -
>>> 1 file changed, 1 deletion(-)
>>>
>>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>> b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>> index 9813c9a..458c94b 100644
>>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>> @@ -44,5 +44,4 @@ mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>> #configuring packages
>>> dpkg --configure -a
>>> -apt-get update
>>> umount /dev
>>>
>>
>> Can you also explain why we (no longer?) need this? Just to ensure that
>> there are no subtle issues waiting to be surfaced.
>
> Multistrap calls 'apt-get install' for the list of packages, so at this
> point the '/var/lib/apt' folder is created. So the upstream state used
> to generate buildchroot is cached.
>
> The line I removed in this patch, is called *after* rootfs generation,
> so upstream state in cache could be possibly updated, do we need that?
As we are heading for a single update run, no. I just wanted to ensure
that it's clear why we do not need it - and ideally also why we once
thought we need it.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-05 17:16 ` Alexander Smirnov
@ 2018-02-05 17:30 ` Jan Kiszka
2018-02-05 17:32 ` Jan Kiszka
0 siblings, 1 reply; 19+ messages in thread
From: Jan Kiszka @ 2018-02-05 17:30 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-05 18:16, Alexander Smirnov wrote:
> On 02/05/2018 07:53 PM, Jan Kiszka wrote:
>> On 2018-02-05 17:43, Alexander Smirnov wrote:
>>> Mount these folders permanently before creating buildchroot. Mounts are
>>> performed in dedicated task do_prepare, so it will also work if you run
>>> build with already existing buildchroot.
>>>
>>> BuildCompleted event is used for clean up, so we should not take care
>>> about this manually.
>>>
>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>> ---
>>> meta/classes/isar-events.bbclass | 3 +++
>>> meta/recipes-devtools/buildchroot/buildchroot.bb | 21
>>> +++++++--------------
>>> .../buildchroot/files/configscript.sh | 4 ----
>>> .../buildchroot/files/download_dev-random | 13 -------------
>>> 4 files changed, 10 insertions(+), 31 deletions(-)
>>> delete mode 100644
>>> meta/recipes-devtools/buildchroot/files/download_dev-random
>>>
>>> diff --git a/meta/classes/isar-events.bbclass
>>> b/meta/classes/isar-events.bbclass
>>> index 55fc106..9f581a6 100644
>>> --- a/meta/classes/isar-events.bbclass
>>> +++ b/meta/classes/isar-events.bbclass
>>> @@ -15,6 +15,9 @@ python isar_handler () {
>>> # Clean up buildchroot
>>> subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>> '/isar-apt || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>> '/dev || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>> '/proc || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>> '/sys || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>> devnull.close()
>>> }
>>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>> b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>> index 0044a71..b8aaf28 100644
>>> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>> @@ -12,7 +12,6 @@ FILESPATH =.
>>> "${LAYERDIR_core}/recipes-devtools/buildchroot/files:"
>>> SRC_URI = "file://multistrap.conf.in \
>>> file://configscript.sh \
>>> file://setup.sh \
>>> - file://download_dev-random \
>>> file://build.sh"
>>> PV = "1.0"
>>> @@ -32,16 +31,21 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>>> WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>>> do_prepare[nostamp] = "1"
>>> -do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt"
>>> +do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt \
>>> + ${BUILDCHROOT_DIR}/dev \
>>> + ${BUILDCHROOT_DIR}/proc \
>>> + ${BUILDCHROOT_DIR}/sys"
>>> do_prepare() {
>>> sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO}
>>> ${BUILDCHROOT_DIR}/isar-apt
>>> + sudo mount --bind /dev ${BUILDCHROOT_DIR}/dev
>>> + sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>> + sudo mount -t sysfs none ${BUILDCHROOT_DIR}/sys
>>> }
>>> addtask prepare before do_build after do_unpack
>>> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>>> -do_build[dirs] = "${WORKDIR}/hooks_multistrap"
>>> do_build[depends] = "isar-apt:do_cache_config"
>>> do_build() {
>>> @@ -49,7 +53,6 @@ do_build() {
>>> chmod +x "${WORKDIR}/setup.sh"
>>> chmod +x "${WORKDIR}/configscript.sh"
>>> - install -m 755 "${WORKDIR}/download_dev-random"
>>> "${WORKDIR}/hooks_multistrap/"
>>> # Multistrap accepts only relative path in configuration
>>> files, so get it:
>>> cd ${TOPDIR}
>>> @@ -68,15 +71,6 @@ do_build() {
>>> -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
>>> "${WORKDIR}/multistrap.conf.in" >
>>> "${WORKDIR}/multistrap.conf"
>>> - [ ! -d ${BUILDCHROOT_DIR}/proc ] && install -d -m 555
>>> ${BUILDCHROOT_DIR}/proc
>>> - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>> - _do_build_cleanup() {
>>> - ret=$?
>>> - sudo umount ${BUILDCHROOT_DIR}/proc 2>/dev/null || true
>>> - (exit $ret) || bb_exit_handler
>>> - }
>>> - trap '_do_build_cleanup' EXIT
>>> -
>>> # Create root filesystem
>>> sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f
>>> "${WORKDIR}/multistrap.conf"
>>> @@ -85,5 +79,4 @@ do_build() {
>>> # Configure root filesystem
>>> sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
>>> - _do_build_cleanup
>>> }
>>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>> b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>> index 458c94b..a5942b5 100644
>>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>> @@ -39,9 +39,5 @@ export LC_ALL=C LANGUAGE=C LANG=C
>>> #run pre installation script
>>> /var/lib/dpkg/info/dash.preinst install
>>> -# apt-get http method, gpg require /dev/null
>>> -mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>> -
>>> #configuring packages
>>> dpkg --configure -a
>>> -umount /dev
>>> diff --git
>>> a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>> b/meta/recipes-devtools/buildchroot/files/download_dev-random
>>> deleted file mode 100644
>>> index 5b5b96b..0000000
>>> --- a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>> +++ /dev/null
>>> @@ -1,13 +0,0 @@
>>> -#!/bin/sh
>>> -
>>> -set -e
>>> -
>>> -readonly ROOTFS="$1"
>>> -
>>> -mknod "${ROOTFS}/dev/random" c 1 8
>>> -chmod 640 "${ROOTFS}/dev/random"
>>> -chown 0:0 "${ROOTFS}/dev/random"
>>> -
>>> -mknod "${ROOTFS}/dev/urandom" c 1 9
>>> -chmod 640 "${ROOTFS}/dev/urandom"
>>> -chown 0:0 "${ROOTFS}/dev/urandom"
>>>
>>
>> That should finally obsolete my /dev/null fix. But after the problem
>> with my bind-mount attempt for /dev, I'd like to validate. What is the
>> baseline this patch should go upon?
>>
>
> Rebased patch to the latest 'next', please try 'asmirnov/devel' branch.
> Also it would be helpful if you could test double ^C and broken build.
>
> It would be perfect if it works :-)
>
> NOTE: umounts are done within next 2-3 seconds after your build stopped
> It seems this time is needed to stop bitbake server context.
Will run a couple of tests (I'm particularly good generating broken one)
and let you know. On first glance, it works as designed. Even ^C^C
followed by an immediate restart work fine (the second run waits for the
first to finish and does not complain about any dangling mounts).
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-05 17:30 ` Jan Kiszka
@ 2018-02-05 17:32 ` Jan Kiszka
2018-02-05 17:50 ` Jan Kiszka
0 siblings, 1 reply; 19+ messages in thread
From: Jan Kiszka @ 2018-02-05 17:32 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-05 18:30, [ext] Jan Kiszka wrote:
> On 2018-02-05 18:16, Alexander Smirnov wrote:
>> On 02/05/2018 07:53 PM, Jan Kiszka wrote:
>>> On 2018-02-05 17:43, Alexander Smirnov wrote:
>>>> Mount these folders permanently before creating buildchroot. Mounts are
>>>> performed in dedicated task do_prepare, so it will also work if you run
>>>> build with already existing buildchroot.
>>>>
>>>> BuildCompleted event is used for clean up, so we should not take care
>>>> about this manually.
>>>>
>>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>>> ---
>>>> meta/classes/isar-events.bbclass | 3 +++
>>>> meta/recipes-devtools/buildchroot/buildchroot.bb | 21
>>>> +++++++--------------
>>>> .../buildchroot/files/configscript.sh | 4 ----
>>>> .../buildchroot/files/download_dev-random | 13 -------------
>>>> 4 files changed, 10 insertions(+), 31 deletions(-)
>>>> delete mode 100644
>>>> meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>
>>>> diff --git a/meta/classes/isar-events.bbclass
>>>> b/meta/classes/isar-events.bbclass
>>>> index 55fc106..9f581a6 100644
>>>> --- a/meta/classes/isar-events.bbclass
>>>> +++ b/meta/classes/isar-events.bbclass
>>>> @@ -15,6 +15,9 @@ python isar_handler () {
>>>> # Clean up buildchroot
>>>> subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>> '/isar-apt || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>> '/dev || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>> '/proc || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>> '/sys || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>> devnull.close()
>>>> }
>>>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>> b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>> index 0044a71..b8aaf28 100644
>>>> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>> @@ -12,7 +12,6 @@ FILESPATH =.
>>>> "${LAYERDIR_core}/recipes-devtools/buildchroot/files:"
>>>> SRC_URI = "file://multistrap.conf.in \
>>>> file://configscript.sh \
>>>> file://setup.sh \
>>>> - file://download_dev-random \
>>>> file://build.sh"
>>>> PV = "1.0"
>>>> @@ -32,16 +31,21 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>>>> WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>>>> do_prepare[nostamp] = "1"
>>>> -do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt"
>>>> +do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt \
>>>> + ${BUILDCHROOT_DIR}/dev \
>>>> + ${BUILDCHROOT_DIR}/proc \
>>>> + ${BUILDCHROOT_DIR}/sys"
>>>> do_prepare() {
>>>> sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO}
>>>> ${BUILDCHROOT_DIR}/isar-apt
>>>> + sudo mount --bind /dev ${BUILDCHROOT_DIR}/dev
>>>> + sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>>> + sudo mount -t sysfs none ${BUILDCHROOT_DIR}/sys
>>>> }
>>>> addtask prepare before do_build after do_unpack
>>>> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>>>> -do_build[dirs] = "${WORKDIR}/hooks_multistrap"
>>>> do_build[depends] = "isar-apt:do_cache_config"
>>>> do_build() {
>>>> @@ -49,7 +53,6 @@ do_build() {
>>>> chmod +x "${WORKDIR}/setup.sh"
>>>> chmod +x "${WORKDIR}/configscript.sh"
>>>> - install -m 755 "${WORKDIR}/download_dev-random"
>>>> "${WORKDIR}/hooks_multistrap/"
>>>> # Multistrap accepts only relative path in configuration
>>>> files, so get it:
>>>> cd ${TOPDIR}
>>>> @@ -68,15 +71,6 @@ do_build() {
>>>> -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
>>>> "${WORKDIR}/multistrap.conf.in" >
>>>> "${WORKDIR}/multistrap.conf"
>>>> - [ ! -d ${BUILDCHROOT_DIR}/proc ] && install -d -m 555
>>>> ${BUILDCHROOT_DIR}/proc
>>>> - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>>> - _do_build_cleanup() {
>>>> - ret=$?
>>>> - sudo umount ${BUILDCHROOT_DIR}/proc 2>/dev/null || true
>>>> - (exit $ret) || bb_exit_handler
>>>> - }
>>>> - trap '_do_build_cleanup' EXIT
>>>> -
>>>> # Create root filesystem
>>>> sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f
>>>> "${WORKDIR}/multistrap.conf"
>>>> @@ -85,5 +79,4 @@ do_build() {
>>>> # Configure root filesystem
>>>> sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
>>>> - _do_build_cleanup
>>>> }
>>>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>> b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>> index 458c94b..a5942b5 100644
>>>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>> @@ -39,9 +39,5 @@ export LC_ALL=C LANGUAGE=C LANG=C
>>>> #run pre installation script
>>>> /var/lib/dpkg/info/dash.preinst install
>>>> -# apt-get http method, gpg require /dev/null
>>>> -mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>>> -
>>>> #configuring packages
>>>> dpkg --configure -a
>>>> -umount /dev
>>>> diff --git
>>>> a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>> b/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>> deleted file mode 100644
>>>> index 5b5b96b..0000000
>>>> --- a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>> +++ /dev/null
>>>> @@ -1,13 +0,0 @@
>>>> -#!/bin/sh
>>>> -
>>>> -set -e
>>>> -
>>>> -readonly ROOTFS="$1"
>>>> -
>>>> -mknod "${ROOTFS}/dev/random" c 1 8
>>>> -chmod 640 "${ROOTFS}/dev/random"
>>>> -chown 0:0 "${ROOTFS}/dev/random"
>>>> -
>>>> -mknod "${ROOTFS}/dev/urandom" c 1 9
>>>> -chmod 640 "${ROOTFS}/dev/urandom"
>>>> -chown 0:0 "${ROOTFS}/dev/urandom"
>>>>
>>>
>>> That should finally obsolete my /dev/null fix. But after the problem
>>> with my bind-mount attempt for /dev, I'd like to validate. What is the
>>> baseline this patch should go upon?
>>>
>>
>> Rebased patch to the latest 'next', please try 'asmirnov/devel' branch.
>> Also it would be helpful if you could test double ^C and broken build.
>>
>> It would be perfect if it works :-)
>>
>> NOTE: umounts are done within next 2-3 seconds after your build stopped
>> It seems this time is needed to stop bitbake server context.
>
> Will run a couple of tests (I'm particularly good generating broken one)
> and let you know. On first glance, it works as designed. Even ^C^C
> followed by an immediate restart work fine (the second run waits for the
> first to finish and does not complain about any dangling mounts).
>
OK, something that was not yet addressed: Unmounting of the workdir from
the buildchroot on ^C^C. I suppose that is doable in an analogous way,
right?
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-05 17:32 ` Jan Kiszka
@ 2018-02-05 17:50 ` Jan Kiszka
2018-02-05 18:03 ` Jan Kiszka
2018-02-05 18:03 ` Alexander Smirnov
0 siblings, 2 replies; 19+ messages in thread
From: Jan Kiszka @ 2018-02-05 17:50 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-05 18:32, Jan Kiszka wrote:
> On 2018-02-05 18:30, [ext] Jan Kiszka wrote:
>> On 2018-02-05 18:16, Alexander Smirnov wrote:
>>> On 02/05/2018 07:53 PM, Jan Kiszka wrote:
>>>> On 2018-02-05 17:43, Alexander Smirnov wrote:
>>>>> Mount these folders permanently before creating buildchroot. Mounts are
>>>>> performed in dedicated task do_prepare, so it will also work if you run
>>>>> build with already existing buildchroot.
>>>>>
>>>>> BuildCompleted event is used for clean up, so we should not take care
>>>>> about this manually.
>>>>>
>>>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>>>> ---
>>>>> meta/classes/isar-events.bbclass | 3 +++
>>>>> meta/recipes-devtools/buildchroot/buildchroot.bb | 21
>>>>> +++++++--------------
>>>>> .../buildchroot/files/configscript.sh | 4 ----
>>>>> .../buildchroot/files/download_dev-random | 13 -------------
>>>>> 4 files changed, 10 insertions(+), 31 deletions(-)
>>>>> delete mode 100644
>>>>> meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>
>>>>> diff --git a/meta/classes/isar-events.bbclass
>>>>> b/meta/classes/isar-events.bbclass
>>>>> index 55fc106..9f581a6 100644
>>>>> --- a/meta/classes/isar-events.bbclass
>>>>> +++ b/meta/classes/isar-events.bbclass
>>>>> @@ -15,6 +15,9 @@ python isar_handler () {
>>>>> # Clean up buildchroot
>>>>> subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>> '/isar-apt || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>> '/dev || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>> '/proc || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>> '/sys || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>> devnull.close()
>>>>> }
>>>>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>> b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>> index 0044a71..b8aaf28 100644
>>>>> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>> @@ -12,7 +12,6 @@ FILESPATH =.
>>>>> "${LAYERDIR_core}/recipes-devtools/buildchroot/files:"
>>>>> SRC_URI = "file://multistrap.conf.in \
>>>>> file://configscript.sh \
>>>>> file://setup.sh \
>>>>> - file://download_dev-random \
>>>>> file://build.sh"
>>>>> PV = "1.0"
>>>>> @@ -32,16 +31,21 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>>>>> WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>>>>> do_prepare[nostamp] = "1"
>>>>> -do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt"
>>>>> +do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt \
>>>>> + ${BUILDCHROOT_DIR}/dev \
>>>>> + ${BUILDCHROOT_DIR}/proc \
>>>>> + ${BUILDCHROOT_DIR}/sys"
>>>>> do_prepare() {
>>>>> sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO}
>>>>> ${BUILDCHROOT_DIR}/isar-apt
>>>>> + sudo mount --bind /dev ${BUILDCHROOT_DIR}/dev
>>>>> + sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>>>> + sudo mount -t sysfs none ${BUILDCHROOT_DIR}/sys
>>>>> }
>>>>> addtask prepare before do_build after do_unpack
>>>>> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>>>>> -do_build[dirs] = "${WORKDIR}/hooks_multistrap"
>>>>> do_build[depends] = "isar-apt:do_cache_config"
>>>>> do_build() {
>>>>> @@ -49,7 +53,6 @@ do_build() {
>>>>> chmod +x "${WORKDIR}/setup.sh"
>>>>> chmod +x "${WORKDIR}/configscript.sh"
>>>>> - install -m 755 "${WORKDIR}/download_dev-random"
>>>>> "${WORKDIR}/hooks_multistrap/"
>>>>> # Multistrap accepts only relative path in configuration
>>>>> files, so get it:
>>>>> cd ${TOPDIR}
>>>>> @@ -68,15 +71,6 @@ do_build() {
>>>>> -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
>>>>> "${WORKDIR}/multistrap.conf.in" >
>>>>> "${WORKDIR}/multistrap.conf"
>>>>> - [ ! -d ${BUILDCHROOT_DIR}/proc ] && install -d -m 555
>>>>> ${BUILDCHROOT_DIR}/proc
>>>>> - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>>>> - _do_build_cleanup() {
>>>>> - ret=$?
>>>>> - sudo umount ${BUILDCHROOT_DIR}/proc 2>/dev/null || true
>>>>> - (exit $ret) || bb_exit_handler
>>>>> - }
>>>>> - trap '_do_build_cleanup' EXIT
>>>>> -
>>>>> # Create root filesystem
>>>>> sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f
>>>>> "${WORKDIR}/multistrap.conf"
>>>>> @@ -85,5 +79,4 @@ do_build() {
>>>>> # Configure root filesystem
>>>>> sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
>>>>> - _do_build_cleanup
>>>>> }
>>>>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>> b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>> index 458c94b..a5942b5 100644
>>>>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>> @@ -39,9 +39,5 @@ export LC_ALL=C LANGUAGE=C LANG=C
>>>>> #run pre installation script
>>>>> /var/lib/dpkg/info/dash.preinst install
>>>>> -# apt-get http method, gpg require /dev/null
>>>>> -mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>>>> -
>>>>> #configuring packages
>>>>> dpkg --configure -a
>>>>> -umount /dev
>>>>> diff --git
>>>>> a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>> b/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>> deleted file mode 100644
>>>>> index 5b5b96b..0000000
>>>>> --- a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>> +++ /dev/null
>>>>> @@ -1,13 +0,0 @@
>>>>> -#!/bin/sh
>>>>> -
>>>>> -set -e
>>>>> -
>>>>> -readonly ROOTFS="$1"
>>>>> -
>>>>> -mknod "${ROOTFS}/dev/random" c 1 8
>>>>> -chmod 640 "${ROOTFS}/dev/random"
>>>>> -chown 0:0 "${ROOTFS}/dev/random"
>>>>> -
>>>>> -mknod "${ROOTFS}/dev/urandom" c 1 9
>>>>> -chmod 640 "${ROOTFS}/dev/urandom"
>>>>> -chown 0:0 "${ROOTFS}/dev/urandom"
>>>>>
>>>>
>>>> That should finally obsolete my /dev/null fix. But after the problem
>>>> with my bind-mount attempt for /dev, I'd like to validate. What is the
>>>> baseline this patch should go upon?
>>>>
>>>
>>> Rebased patch to the latest 'next', please try 'asmirnov/devel' branch.
>>> Also it would be helpful if you could test double ^C and broken build.
>>>
>>> It would be perfect if it works :-)
>>>
>>> NOTE: umounts are done within next 2-3 seconds after your build stopped
>>> It seems this time is needed to stop bitbake server context.
>>
>> Will run a couple of tests (I'm particularly good generating broken one)
>> and let you know. On first glance, it works as designed. Even ^C^C
>> followed by an immediate restart work fine (the second run waits for the
>> first to finish and does not complain about any dangling mounts).
>>
>
> OK, something that was not yet addressed: Unmounting of the workdir from
> the buildchroot on ^C^C. I suppose that is doable in an analogous way,
> right?
>
We also need this for the isar-image build (I'm left with /proc still
mounted when interrupt that task).
And when I restart the build that I interrupt after buildchroot was long
finished, that task is still rebuild - and that fails, maybe because of
preexisting artifacts.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-05 17:50 ` Jan Kiszka
@ 2018-02-05 18:03 ` Jan Kiszka
2018-02-05 18:03 ` Alexander Smirnov
1 sibling, 0 replies; 19+ messages in thread
From: Jan Kiszka @ 2018-02-05 18:03 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-05 18:50, Jan Kiszka wrote:
> On 2018-02-05 18:32, Jan Kiszka wrote:
>> On 2018-02-05 18:30, [ext] Jan Kiszka wrote:
>>> On 2018-02-05 18:16, Alexander Smirnov wrote:
>>>> On 02/05/2018 07:53 PM, Jan Kiszka wrote:
>>>>> On 2018-02-05 17:43, Alexander Smirnov wrote:
>>>>>> Mount these folders permanently before creating buildchroot. Mounts are
>>>>>> performed in dedicated task do_prepare, so it will also work if you run
>>>>>> build with already existing buildchroot.
>>>>>>
>>>>>> BuildCompleted event is used for clean up, so we should not take care
>>>>>> about this manually.
>>>>>>
>>>>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>>>>> ---
>>>>>> meta/classes/isar-events.bbclass | 3 +++
>>>>>> meta/recipes-devtools/buildchroot/buildchroot.bb | 21
>>>>>> +++++++--------------
>>>>>> .../buildchroot/files/configscript.sh | 4 ----
>>>>>> .../buildchroot/files/download_dev-random | 13 -------------
>>>>>> 4 files changed, 10 insertions(+), 31 deletions(-)
>>>>>> delete mode 100644
>>>>>> meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>>
>>>>>> diff --git a/meta/classes/isar-events.bbclass
>>>>>> b/meta/classes/isar-events.bbclass
>>>>>> index 55fc106..9f581a6 100644
>>>>>> --- a/meta/classes/isar-events.bbclass
>>>>>> +++ b/meta/classes/isar-events.bbclass
>>>>>> @@ -15,6 +15,9 @@ python isar_handler () {
>>>>>> # Clean up buildchroot
>>>>>> subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>> '/isar-apt || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>> '/dev || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>> '/proc || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>> '/sys || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>> devnull.close()
>>>>>> }
>>>>>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>> b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>> index 0044a71..b8aaf28 100644
>>>>>> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>> @@ -12,7 +12,6 @@ FILESPATH =.
>>>>>> "${LAYERDIR_core}/recipes-devtools/buildchroot/files:"
>>>>>> SRC_URI = "file://multistrap.conf.in \
>>>>>> file://configscript.sh \
>>>>>> file://setup.sh \
>>>>>> - file://download_dev-random \
>>>>>> file://build.sh"
>>>>>> PV = "1.0"
>>>>>> @@ -32,16 +31,21 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>>>>>> WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>>>>>> do_prepare[nostamp] = "1"
>>>>>> -do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt"
>>>>>> +do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt \
>>>>>> + ${BUILDCHROOT_DIR}/dev \
>>>>>> + ${BUILDCHROOT_DIR}/proc \
>>>>>> + ${BUILDCHROOT_DIR}/sys"
>>>>>> do_prepare() {
>>>>>> sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO}
>>>>>> ${BUILDCHROOT_DIR}/isar-apt
>>>>>> + sudo mount --bind /dev ${BUILDCHROOT_DIR}/dev
>>>>>> + sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>>>>> + sudo mount -t sysfs none ${BUILDCHROOT_DIR}/sys
>>>>>> }
>>>>>> addtask prepare before do_build after do_unpack
>>>>>> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>>>>>> -do_build[dirs] = "${WORKDIR}/hooks_multistrap"
>>>>>> do_build[depends] = "isar-apt:do_cache_config"
>>>>>> do_build() {
>>>>>> @@ -49,7 +53,6 @@ do_build() {
>>>>>> chmod +x "${WORKDIR}/setup.sh"
>>>>>> chmod +x "${WORKDIR}/configscript.sh"
>>>>>> - install -m 755 "${WORKDIR}/download_dev-random"
>>>>>> "${WORKDIR}/hooks_multistrap/"
>>>>>> # Multistrap accepts only relative path in configuration
>>>>>> files, so get it:
>>>>>> cd ${TOPDIR}
>>>>>> @@ -68,15 +71,6 @@ do_build() {
>>>>>> -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
>>>>>> "${WORKDIR}/multistrap.conf.in" >
>>>>>> "${WORKDIR}/multistrap.conf"
>>>>>> - [ ! -d ${BUILDCHROOT_DIR}/proc ] && install -d -m 555
>>>>>> ${BUILDCHROOT_DIR}/proc
>>>>>> - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>>>>> - _do_build_cleanup() {
>>>>>> - ret=$?
>>>>>> - sudo umount ${BUILDCHROOT_DIR}/proc 2>/dev/null || true
>>>>>> - (exit $ret) || bb_exit_handler
>>>>>> - }
>>>>>> - trap '_do_build_cleanup' EXIT
>>>>>> -
>>>>>> # Create root filesystem
>>>>>> sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f
>>>>>> "${WORKDIR}/multistrap.conf"
>>>>>> @@ -85,5 +79,4 @@ do_build() {
>>>>>> # Configure root filesystem
>>>>>> sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
>>>>>> - _do_build_cleanup
>>>>>> }
>>>>>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> index 458c94b..a5942b5 100644
>>>>>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> @@ -39,9 +39,5 @@ export LC_ALL=C LANGUAGE=C LANG=C
>>>>>> #run pre installation script
>>>>>> /var/lib/dpkg/info/dash.preinst install
>>>>>> -# apt-get http method, gpg require /dev/null
>>>>>> -mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>>>>> -
>>>>>> #configuring packages
>>>>>> dpkg --configure -a
>>>>>> -umount /dev
>>>>>> diff --git
>>>>>> a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>> b/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>> deleted file mode 100644
>>>>>> index 5b5b96b..0000000
>>>>>> --- a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>> +++ /dev/null
>>>>>> @@ -1,13 +0,0 @@
>>>>>> -#!/bin/sh
>>>>>> -
>>>>>> -set -e
>>>>>> -
>>>>>> -readonly ROOTFS="$1"
>>>>>> -
>>>>>> -mknod "${ROOTFS}/dev/random" c 1 8
>>>>>> -chmod 640 "${ROOTFS}/dev/random"
>>>>>> -chown 0:0 "${ROOTFS}/dev/random"
>>>>>> -
>>>>>> -mknod "${ROOTFS}/dev/urandom" c 1 9
>>>>>> -chmod 640 "${ROOTFS}/dev/urandom"
>>>>>> -chown 0:0 "${ROOTFS}/dev/urandom"
>>>>>>
>>>>>
>>>>> That should finally obsolete my /dev/null fix. But after the problem
>>>>> with my bind-mount attempt for /dev, I'd like to validate. What is the
>>>>> baseline this patch should go upon?
>>>>>
>>>>
>>>> Rebased patch to the latest 'next', please try 'asmirnov/devel' branch.
>>>> Also it would be helpful if you could test double ^C and broken build.
>>>>
>>>> It would be perfect if it works :-)
>>>>
>>>> NOTE: umounts are done within next 2-3 seconds after your build stopped
>>>> It seems this time is needed to stop bitbake server context.
>>>
>>> Will run a couple of tests (I'm particularly good generating broken one)
>>> and let you know. On first glance, it works as designed. Even ^C^C
>>> followed by an immediate restart work fine (the second run waits for the
>>> first to finish and does not complain about any dangling mounts).
>>>
>>
>> OK, something that was not yet addressed: Unmounting of the workdir from
>> the buildchroot on ^C^C. I suppose that is doable in an analogous way,
>> right?
>>
>
> We also need this for the isar-image build (I'm left with /proc still
> mounted when interrupt that task).
>
> And when I restart the build that I interrupt after buildchroot was long
> finished, that task is still rebuild - and that fails, maybe because of
> preexisting artifacts.
Actually, buildchroot is now unconditionally rebuilt. Something is
broken, and that already in next (384750df).
Jan
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-05 17:50 ` Jan Kiszka
2018-02-05 18:03 ` Jan Kiszka
@ 2018-02-05 18:03 ` Alexander Smirnov
2018-02-05 18:06 ` Jan Kiszka
1 sibling, 1 reply; 19+ messages in thread
From: Alexander Smirnov @ 2018-02-05 18:03 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/05/2018 08:50 PM, Jan Kiszka wrote:
> On 2018-02-05 18:32, Jan Kiszka wrote:
>> On 2018-02-05 18:30, [ext] Jan Kiszka wrote:
>>> On 2018-02-05 18:16, Alexander Smirnov wrote:
>>>> On 02/05/2018 07:53 PM, Jan Kiszka wrote:
>>>>> On 2018-02-05 17:43, Alexander Smirnov wrote:
>>>>>> Mount these folders permanently before creating buildchroot. Mounts are
>>>>>> performed in dedicated task do_prepare, so it will also work if you run
>>>>>> build with already existing buildchroot.
>>>>>>
>>>>>> BuildCompleted event is used for clean up, so we should not take care
>>>>>> about this manually.
>>>>>>
>>>>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>>>>> ---
>>>>>> meta/classes/isar-events.bbclass | 3 +++
>>>>>> meta/recipes-devtools/buildchroot/buildchroot.bb | 21
>>>>>> +++++++--------------
>>>>>> .../buildchroot/files/configscript.sh | 4 ----
>>>>>> .../buildchroot/files/download_dev-random | 13 -------------
>>>>>> 4 files changed, 10 insertions(+), 31 deletions(-)
>>>>>> delete mode 100644
>>>>>> meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>>
>>>>>> diff --git a/meta/classes/isar-events.bbclass
>>>>>> b/meta/classes/isar-events.bbclass
>>>>>> index 55fc106..9f581a6 100644
>>>>>> --- a/meta/classes/isar-events.bbclass
>>>>>> +++ b/meta/classes/isar-events.bbclass
>>>>>> @@ -15,6 +15,9 @@ python isar_handler () {
>>>>>> # Clean up buildchroot
>>>>>> subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>> '/isar-apt || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>> '/dev || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>> '/proc || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>> '/sys || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>> devnull.close()
>>>>>> }
>>>>>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>> b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>> index 0044a71..b8aaf28 100644
>>>>>> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>> @@ -12,7 +12,6 @@ FILESPATH =.
>>>>>> "${LAYERDIR_core}/recipes-devtools/buildchroot/files:"
>>>>>> SRC_URI = "file://multistrap.conf.in \
>>>>>> file://configscript.sh \
>>>>>> file://setup.sh \
>>>>>> - file://download_dev-random \
>>>>>> file://build.sh"
>>>>>> PV = "1.0"
>>>>>> @@ -32,16 +31,21 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>>>>>> WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>>>>>> do_prepare[nostamp] = "1"
>>>>>> -do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt"
>>>>>> +do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt \
>>>>>> + ${BUILDCHROOT_DIR}/dev \
>>>>>> + ${BUILDCHROOT_DIR}/proc \
>>>>>> + ${BUILDCHROOT_DIR}/sys"
>>>>>> do_prepare() {
>>>>>> sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO}
>>>>>> ${BUILDCHROOT_DIR}/isar-apt
>>>>>> + sudo mount --bind /dev ${BUILDCHROOT_DIR}/dev
>>>>>> + sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>>>>> + sudo mount -t sysfs none ${BUILDCHROOT_DIR}/sys
>>>>>> }
>>>>>> addtask prepare before do_build after do_unpack
>>>>>> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>>>>>> -do_build[dirs] = "${WORKDIR}/hooks_multistrap"
>>>>>> do_build[depends] = "isar-apt:do_cache_config"
>>>>>> do_build() {
>>>>>> @@ -49,7 +53,6 @@ do_build() {
>>>>>> chmod +x "${WORKDIR}/setup.sh"
>>>>>> chmod +x "${WORKDIR}/configscript.sh"
>>>>>> - install -m 755 "${WORKDIR}/download_dev-random"
>>>>>> "${WORKDIR}/hooks_multistrap/"
>>>>>> # Multistrap accepts only relative path in configuration
>>>>>> files, so get it:
>>>>>> cd ${TOPDIR}
>>>>>> @@ -68,15 +71,6 @@ do_build() {
>>>>>> -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
>>>>>> "${WORKDIR}/multistrap.conf.in" >
>>>>>> "${WORKDIR}/multistrap.conf"
>>>>>> - [ ! -d ${BUILDCHROOT_DIR}/proc ] && install -d -m 555
>>>>>> ${BUILDCHROOT_DIR}/proc
>>>>>> - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>>>>> - _do_build_cleanup() {
>>>>>> - ret=$?
>>>>>> - sudo umount ${BUILDCHROOT_DIR}/proc 2>/dev/null || true
>>>>>> - (exit $ret) || bb_exit_handler
>>>>>> - }
>>>>>> - trap '_do_build_cleanup' EXIT
>>>>>> -
>>>>>> # Create root filesystem
>>>>>> sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f
>>>>>> "${WORKDIR}/multistrap.conf"
>>>>>> @@ -85,5 +79,4 @@ do_build() {
>>>>>> # Configure root filesystem
>>>>>> sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
>>>>>> - _do_build_cleanup
>>>>>> }
>>>>>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> index 458c94b..a5942b5 100644
>>>>>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> @@ -39,9 +39,5 @@ export LC_ALL=C LANGUAGE=C LANG=C
>>>>>> #run pre installation script
>>>>>> /var/lib/dpkg/info/dash.preinst install
>>>>>> -# apt-get http method, gpg require /dev/null
>>>>>> -mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>>>>> -
>>>>>> #configuring packages
>>>>>> dpkg --configure -a
>>>>>> -umount /dev
>>>>>> diff --git
>>>>>> a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>> b/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>> deleted file mode 100644
>>>>>> index 5b5b96b..0000000
>>>>>> --- a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>> +++ /dev/null
>>>>>> @@ -1,13 +0,0 @@
>>>>>> -#!/bin/sh
>>>>>> -
>>>>>> -set -e
>>>>>> -
>>>>>> -readonly ROOTFS="$1"
>>>>>> -
>>>>>> -mknod "${ROOTFS}/dev/random" c 1 8
>>>>>> -chmod 640 "${ROOTFS}/dev/random"
>>>>>> -chown 0:0 "${ROOTFS}/dev/random"
>>>>>> -
>>>>>> -mknod "${ROOTFS}/dev/urandom" c 1 9
>>>>>> -chmod 640 "${ROOTFS}/dev/urandom"
>>>>>> -chown 0:0 "${ROOTFS}/dev/urandom"
>>>>>>
>>>>>
>>>>> That should finally obsolete my /dev/null fix. But after the problem
>>>>> with my bind-mount attempt for /dev, I'd like to validate. What is the
>>>>> baseline this patch should go upon?
>>>>>
>>>>
>>>> Rebased patch to the latest 'next', please try 'asmirnov/devel' branch.
>>>> Also it would be helpful if you could test double ^C and broken build.
>>>>
>>>> It would be perfect if it works :-)
>>>>
>>>> NOTE: umounts are done within next 2-3 seconds after your build stopped
>>>> It seems this time is needed to stop bitbake server context.
>>>
>>> Will run a couple of tests (I'm particularly good generating broken one)
>>> and let you know. On first glance, it works as designed. Even ^C^C
>>> followed by an immediate restart work fine (the second run waits for the
>>> first to finish and does not complain about any dangling mounts).
>>>
>>
>> OK, something that was not yet addressed: Unmounting of the workdir from
>> the buildchroot on ^C^C. I suppose that is doable in an analogous way,
>> right?
Yes, I've already thought about this, implement something like this:
for a in $BUILDCHROOT_DIR/home/builder
umount xxx
in isar-events.bbclass.
>>
>
> We also need this for the isar-image build (I'm left with /proc still
> mounted when interrupt that task).
For now it's only about buildchroot.
>
> And when I restart the build that I interrupt after buildchroot was long
> finished, that task is still rebuild - and that fails, maybe because of
> preexisting artifacts.
That's the known problem, we have no do_clean task implemented. Re-run
on existing tree is not officially supported for now.
So, I'm right that there are no mounted /dev, /proc and /sys in your
buildchroot after termination?
Alex
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-05 18:03 ` Alexander Smirnov
@ 2018-02-05 18:06 ` Jan Kiszka
2018-02-06 9:38 ` Jan Kiszka
0 siblings, 1 reply; 19+ messages in thread
From: Jan Kiszka @ 2018-02-05 18:06 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-05 19:03, Alexander Smirnov wrote:
>
>
> On 02/05/2018 08:50 PM, Jan Kiszka wrote:
>> On 2018-02-05 18:32, Jan Kiszka wrote:
>>> On 2018-02-05 18:30, [ext] Jan Kiszka wrote:
>>>> On 2018-02-05 18:16, Alexander Smirnov wrote:
>>>>> On 02/05/2018 07:53 PM, Jan Kiszka wrote:
>>>>>> On 2018-02-05 17:43, Alexander Smirnov wrote:
>>>>>>> Mount these folders permanently before creating buildchroot.
>>>>>>> Mounts are
>>>>>>> performed in dedicated task do_prepare, so it will also work if
>>>>>>> you run
>>>>>>> build with already existing buildchroot.
>>>>>>>
>>>>>>> BuildCompleted event is used for clean up, so we should not take
>>>>>>> care
>>>>>>> about this manually.
>>>>>>>
>>>>>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>>>>>> ---
>>>>>>> meta/classes/isar-events.bbclass | 3 +++
>>>>>>> meta/recipes-devtools/buildchroot/buildchroot.bb | 21
>>>>>>> +++++++--------------
>>>>>>> .../buildchroot/files/configscript.sh | 4 ----
>>>>>>> .../buildchroot/files/download_dev-random | 13
>>>>>>> -------------
>>>>>>> 4 files changed, 10 insertions(+), 31 deletions(-)
>>>>>>> delete mode 100644
>>>>>>> meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>>>
>>>>>>> diff --git a/meta/classes/isar-events.bbclass
>>>>>>> b/meta/classes/isar-events.bbclass
>>>>>>> index 55fc106..9f581a6 100644
>>>>>>> --- a/meta/classes/isar-events.bbclass
>>>>>>> +++ b/meta/classes/isar-events.bbclass
>>>>>>> @@ -15,6 +15,9 @@ python isar_handler () {
>>>>>>> # Clean up buildchroot
>>>>>>> subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>>> '/isar-apt || /bin/true', stdout=devnull, stderr=devnull,
>>>>>>> shell=True)
>>>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>>> '/dev || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>>> '/proc || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>>> + subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot +
>>>>>>> '/sys || /bin/true', stdout=devnull, stderr=devnull, shell=True)
>>>>>>> devnull.close()
>>>>>>> }
>>>>>>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>>> b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>>> index 0044a71..b8aaf28 100644
>>>>>>> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>>> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>>>>> @@ -12,7 +12,6 @@ FILESPATH =.
>>>>>>> "${LAYERDIR_core}/recipes-devtools/buildchroot/files:"
>>>>>>> SRC_URI = "file://multistrap.conf.in \
>>>>>>> file://configscript.sh \
>>>>>>> file://setup.sh \
>>>>>>> - file://download_dev-random \
>>>>>>> file://build.sh"
>>>>>>> PV = "1.0"
>>>>>>> @@ -32,16 +31,21 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>>>>>>> WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>>>>>>> do_prepare[nostamp] = "1"
>>>>>>> -do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt"
>>>>>>> +do_prepare[dirs] = "${BUILDCHROOT_DIR}/isar-apt \
>>>>>>> + ${BUILDCHROOT_DIR}/dev \
>>>>>>> + ${BUILDCHROOT_DIR}/proc \
>>>>>>> + ${BUILDCHROOT_DIR}/sys"
>>>>>>> do_prepare() {
>>>>>>> sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO}
>>>>>>> ${BUILDCHROOT_DIR}/isar-apt
>>>>>>> + sudo mount --bind /dev ${BUILDCHROOT_DIR}/dev
>>>>>>> + sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>>>>>> + sudo mount -t sysfs none ${BUILDCHROOT_DIR}/sys
>>>>>>> }
>>>>>>> addtask prepare before do_build after do_unpack
>>>>>>> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>>>>>>> -do_build[dirs] = "${WORKDIR}/hooks_multistrap"
>>>>>>> do_build[depends] = "isar-apt:do_cache_config"
>>>>>>> do_build() {
>>>>>>> @@ -49,7 +53,6 @@ do_build() {
>>>>>>> chmod +x "${WORKDIR}/setup.sh"
>>>>>>> chmod +x "${WORKDIR}/configscript.sh"
>>>>>>> - install -m 755 "${WORKDIR}/download_dev-random"
>>>>>>> "${WORKDIR}/hooks_multistrap/"
>>>>>>> # Multistrap accepts only relative path in configuration
>>>>>>> files, so get it:
>>>>>>> cd ${TOPDIR}
>>>>>>> @@ -68,15 +71,6 @@ do_build() {
>>>>>>> -e
>>>>>>> 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
>>>>>>> "${WORKDIR}/multistrap.conf.in" >
>>>>>>> "${WORKDIR}/multistrap.conf"
>>>>>>> - [ ! -d ${BUILDCHROOT_DIR}/proc ] && install -d -m 555
>>>>>>> ${BUILDCHROOT_DIR}/proc
>>>>>>> - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>>>>>>> - _do_build_cleanup() {
>>>>>>> - ret=$?
>>>>>>> - sudo umount ${BUILDCHROOT_DIR}/proc 2>/dev/null || true
>>>>>>> - (exit $ret) || bb_exit_handler
>>>>>>> - }
>>>>>>> - trap '_do_build_cleanup' EXIT
>>>>>>> -
>>>>>>> # Create root filesystem
>>>>>>> sudo -E multistrap -a ${DISTRO_ARCH} -d
>>>>>>> "${BUILDCHROOT_DIR}" -f
>>>>>>> "${WORKDIR}/multistrap.conf"
>>>>>>> @@ -85,5 +79,4 @@ do_build() {
>>>>>>> # Configure root filesystem
>>>>>>> sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
>>>>>>> - _do_build_cleanup
>>>>>>> }
>>>>>>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>>> b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>>> index 458c94b..a5942b5 100644
>>>>>>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>>> @@ -39,9 +39,5 @@ export LC_ALL=C LANGUAGE=C LANG=C
>>>>>>> #run pre installation script
>>>>>>> /var/lib/dpkg/info/dash.preinst install
>>>>>>> -# apt-get http method, gpg require /dev/null
>>>>>>> -mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>>>>>> -
>>>>>>> #configuring packages
>>>>>>> dpkg --configure -a
>>>>>>> -umount /dev
>>>>>>> diff --git
>>>>>>> a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>>> b/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>>> deleted file mode 100644
>>>>>>> index 5b5b96b..0000000
>>>>>>> --- a/meta/recipes-devtools/buildchroot/files/download_dev-random
>>>>>>> +++ /dev/null
>>>>>>> @@ -1,13 +0,0 @@
>>>>>>> -#!/bin/sh
>>>>>>> -
>>>>>>> -set -e
>>>>>>> -
>>>>>>> -readonly ROOTFS="$1"
>>>>>>> -
>>>>>>> -mknod "${ROOTFS}/dev/random" c 1 8
>>>>>>> -chmod 640 "${ROOTFS}/dev/random"
>>>>>>> -chown 0:0 "${ROOTFS}/dev/random"
>>>>>>> -
>>>>>>> -mknod "${ROOTFS}/dev/urandom" c 1 9
>>>>>>> -chmod 640 "${ROOTFS}/dev/urandom"
>>>>>>> -chown 0:0 "${ROOTFS}/dev/urandom"
>>>>>>>
>>>>>>
>>>>>> That should finally obsolete my /dev/null fix. But after the problem
>>>>>> with my bind-mount attempt for /dev, I'd like to validate. What is
>>>>>> the
>>>>>> baseline this patch should go upon?
>>>>>>
>>>>>
>>>>> Rebased patch to the latest 'next', please try 'asmirnov/devel'
>>>>> branch.
>>>>> Also it would be helpful if you could test double ^C and broken build.
>>>>>
>>>>> It would be perfect if it works :-)
>>>>>
>>>>> NOTE: umounts are done within next 2-3 seconds after your build
>>>>> stopped
>>>>> It seems this time is needed to stop bitbake server context.
>>>>
>>>> Will run a couple of tests (I'm particularly good generating broken
>>>> one)
>>>> and let you know. On first glance, it works as designed. Even ^C^C
>>>> followed by an immediate restart work fine (the second run waits for
>>>> the
>>>> first to finish and does not complain about any dangling mounts).
>>>>
>>>
>>> OK, something that was not yet addressed: Unmounting of the workdir from
>>> the buildchroot on ^C^C. I suppose that is doable in an analogous way,
>>> right?
>
> Yes, I've already thought about this, implement something like this:
>
> for a in $BUILDCHROOT_DIR/home/builder
> umount xxx
>
> in isar-events.bbclass.
>
>>>
>>
>> We also need this for the isar-image build (I'm left with /proc still
>> mounted when interrupt that task).
>
> For now it's only about buildchroot.
>
>>
>> And when I restart the build that I interrupt after buildchroot was long
>> finished, that task is still rebuild - and that fails, maybe because of
>> preexisting artifacts.
>
> That's the known problem, we have no do_clean task implemented. Re-run
> on existing tree is not officially supported for now.
That should be fixed, or our turn-around times for Isar development will
explode!
>
> So, I'm right that there are no mounted /dev, /proc and /sys in your
> buildchroot after termination?
Yes, that works as expected.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] buildchroot: Do not call 'apt-get update'
2018-02-05 17:25 ` Jan Kiszka
@ 2018-02-06 9:12 ` Alexander Smirnov
2018-02-06 9:13 ` Alexander Smirnov
0 siblings, 1 reply; 19+ messages in thread
From: Alexander Smirnov @ 2018-02-06 9:12 UTC (permalink / raw)
To: Jan Kiszka, isar-users
Hi,
On 02/05/2018 08:25 PM, Jan Kiszka wrote:
> On 2018-02-05 18:06, Alexander Smirnov wrote:
>> On 02/05/2018 07:51 PM, Jan Kiszka wrote:
>>> On 2018-02-05 17:43, Alexander Smirnov wrote:
>>>> We should not do this to avoid local Packages.gz update.
>>>>
>>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>>> ---
>>>> meta/recipes-devtools/buildchroot/files/configscript.sh | 1 -
>>>> 1 file changed, 1 deletion(-)
>>>>
>>>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>> b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>> index 9813c9a..458c94b 100644
>>>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>> @@ -44,5 +44,4 @@ mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>>> #configuring packages
>>>> dpkg --configure -a
>>>> -apt-get update
>>>> umount /dev
>>>>
>>>
>>> Can you also explain why we (no longer?) need this? Just to ensure that
>>> there are no subtle issues waiting to be surfaced.
>>
>> Multistrap calls 'apt-get install' for the list of packages, so at this
>> point the '/var/lib/apt' folder is created. So the upstream state used
>> to generate buildchroot is cached.
>>
>> The line I removed in this patch, is called *after* rootfs generation,
>> so upstream state in cache could be possibly updated, do we need that?
>
> As we are heading for a single update run, no. I just wanted to ensure
> that it's clear why we do not need it - and ideally also why we once
> thought we need it.
>
> Jan
>
I checked the patch which added thi and it was dated by 2016 and
contains big blobs for various scripts. I guess it was merge from some
existing example. I've double checked the multistrap Wiki page at
debian.org and manual, there is no recommendation to have it in
configscript. So due to it works without it - I'd like to drop it.
Alex
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] buildchroot: Do not call 'apt-get update'
2018-02-06 9:12 ` Alexander Smirnov
@ 2018-02-06 9:13 ` Alexander Smirnov
2018-02-06 9:38 ` Jan Kiszka
0 siblings, 1 reply; 19+ messages in thread
From: Alexander Smirnov @ 2018-02-06 9:13 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/06/2018 12:12 PM, Alexander Smirnov wrote:
> Hi,
>
> On 02/05/2018 08:25 PM, Jan Kiszka wrote:
>> On 2018-02-05 18:06, Alexander Smirnov wrote:
>>> On 02/05/2018 07:51 PM, Jan Kiszka wrote:
>>>> On 2018-02-05 17:43, Alexander Smirnov wrote:
>>>>> We should not do this to avoid local Packages.gz update.
>>>>>
>>>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>>>> ---
>>>>> meta/recipes-devtools/buildchroot/files/configscript.sh | 1 -
>>>>> 1 file changed, 1 deletion(-)
>>>>>
>>>>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>> b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>> index 9813c9a..458c94b 100644
>>>>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>> @@ -44,5 +44,4 @@ mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>>>> #configuring packages
>>>>> dpkg --configure -a
>>>>> -apt-get update
>>>>> umount /dev
>>>>>
>>>>
>>>> Can you also explain why we (no longer?) need this? Just to ensure that
>>>> there are no subtle issues waiting to be surfaced.
>>>
>>> Multistrap calls 'apt-get install' for the list of packages, so at this
>>> point the '/var/lib/apt' folder is created. So the upstream state used
>>> to generate buildchroot is cached.
>>>
>>> The line I removed in this patch, is called *after* rootfs generation,
>>> so upstream state in cache could be possibly updated, do we need that?
>>
>> As we are heading for a single update run, no. I just wanted to ensure
>> that it's clear why we do not need it - and ideally also why we once
>> thought we need it.
>>
>> Jan
>>
>
> I checked the patch which added thi and it was dated by 2016 and
> contains big blobs for various scripts. I guess it was merge from some
> existing example. I've double checked the multistrap Wiki page at
> debian.org and manual, there is no recommendation to have it in
> configscript. So due to it works without it - I'd like to drop it.
I mean drop 'apt-get update' :-)
Alex
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-05 18:06 ` Jan Kiszka
@ 2018-02-06 9:38 ` Jan Kiszka
2018-02-06 9:43 ` Alexander Smirnov
0 siblings, 1 reply; 19+ messages in thread
From: Jan Kiszka @ 2018-02-06 9:38 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-05 19:06, Jan Kiszka wrote:
>>> And when I restart the build that I interrupt after buildchroot was long
>>> finished, that task is still rebuild - and that fails, maybe because of
>>> preexisting artifacts.
>>
>> That's the known problem, we have no do_clean task implemented. Re-run
>> on existing tree is not officially supported for now.
>
> That should be fixed, or our turn-around times for Isar development will
> explode!
This is really an urgent must-fix. I'm doing full rebuilds over and over
again now, just to test small changes down the pipeline.
Do you already have an idea how to prevent the buildchroot rebuild? I
suppose it's caused by the new prepare task, right? Can we achieve that
without invalidating the buildchroot setup?
Jan
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] buildchroot: Do not call 'apt-get update'
2018-02-06 9:13 ` Alexander Smirnov
@ 2018-02-06 9:38 ` Jan Kiszka
0 siblings, 0 replies; 19+ messages in thread
From: Jan Kiszka @ 2018-02-06 9:38 UTC (permalink / raw)
To: Alexander Smirnov, isar-users
On 2018-02-06 10:13, Alexander Smirnov wrote:
>
>
> On 02/06/2018 12:12 PM, Alexander Smirnov wrote:
>> Hi,
>>
>> On 02/05/2018 08:25 PM, Jan Kiszka wrote:
>>> On 2018-02-05 18:06, Alexander Smirnov wrote:
>>>> On 02/05/2018 07:51 PM, Jan Kiszka wrote:
>>>>> On 2018-02-05 17:43, Alexander Smirnov wrote:
>>>>>> We should not do this to avoid local Packages.gz update.
>>>>>>
>>>>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>>>>> ---
>>>>>> meta/recipes-devtools/buildchroot/files/configscript.sh | 1 -
>>>>>> 1 file changed, 1 deletion(-)
>>>>>>
>>>>>> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> index 9813c9a..458c94b 100644
>>>>>> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
>>>>>> @@ -44,5 +44,4 @@ mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev
>>>>>> #configuring packages
>>>>>> dpkg --configure -a
>>>>>> -apt-get update
>>>>>> umount /dev
>>>>>>
>>>>>
>>>>> Can you also explain why we (no longer?) need this? Just to ensure
>>>>> that
>>>>> there are no subtle issues waiting to be surfaced.
>>>>
>>>> Multistrap calls 'apt-get install' for the list of packages, so at this
>>>> point the '/var/lib/apt' folder is created. So the upstream state used
>>>> to generate buildchroot is cached.
>>>>
>>>> The line I removed in this patch, is called *after* rootfs generation,
>>>> so upstream state in cache could be possibly updated, do we need that?
>>>
>>> As we are heading for a single update run, no. I just wanted to ensure
>>> that it's clear why we do not need it - and ideally also why we once
>>> thought we need it.
>>>
>>> Jan
>>>
>>
>> I checked the patch which added thi and it was dated by 2016 and
>> contains big blobs for various scripts. I guess it was merge from some
>> existing example. I've double checked the multistrap Wiki page at
>> debian.org and manual, there is no recommendation to have it in
>> configscript. So due to it works without it - I'd like to drop it.
>
> I mean drop 'apt-get update' :-)
>
Ack.
Jan
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc'
2018-02-06 9:38 ` Jan Kiszka
@ 2018-02-06 9:43 ` Alexander Smirnov
0 siblings, 0 replies; 19+ messages in thread
From: Alexander Smirnov @ 2018-02-06 9:43 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 02/06/2018 12:38 PM, Jan Kiszka wrote:
> On 2018-02-05 19:06, Jan Kiszka wrote:
>>>> And when I restart the build that I interrupt after buildchroot was long
>>>> finished, that task is still rebuild - and that fails, maybe because of
>>>> preexisting artifacts.
>>>
>>> That's the known problem, we have no do_clean task implemented. Re-run
>>> on existing tree is not officially supported for now.
>>
>> That should be fixed, or our turn-around times for Isar development will
>> explode!
>
> This is really an urgent must-fix. I'm doing full rebuilds over and over
> again now, just to test small changes down the pipeline.
>
> Do you already have an idea how to prevent the buildchroot rebuild? I
> suppose it's caused by the new prepare task, right? Can we achieve that
> without invalidating the buildchroot setup?
That's unexpected bitbake behavior for me, I didn't assume that it
invalidates all the stamps starting from the current. :-( Will fix this now.
Alex
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2018-02-06 9:43 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05 16:43 [PATCH 0/2] mounts for buildchroot Alexander Smirnov
2018-02-05 16:43 ` [PATCH 1/2] buildchroot: Do not call 'apt-get update' Alexander Smirnov
2018-02-05 16:51 ` Jan Kiszka
2018-02-05 17:06 ` Alexander Smirnov
2018-02-05 17:25 ` Jan Kiszka
2018-02-06 9:12 ` Alexander Smirnov
2018-02-06 9:13 ` Alexander Smirnov
2018-02-06 9:38 ` Jan Kiszka
2018-02-05 16:43 ` [PATCH 2/2] buildchroot: Permanently mount '/dev', '/sys' and '/proc' Alexander Smirnov
2018-02-05 16:53 ` Jan Kiszka
2018-02-05 17:16 ` Alexander Smirnov
2018-02-05 17:30 ` Jan Kiszka
2018-02-05 17:32 ` Jan Kiszka
2018-02-05 17:50 ` Jan Kiszka
2018-02-05 18:03 ` Jan Kiszka
2018-02-05 18:03 ` Alexander Smirnov
2018-02-05 18:06 ` Jan Kiszka
2018-02-06 9:38 ` Jan Kiszka
2018-02-06 9:43 ` Alexander Smirnov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox