[PATCH] buildchroot: add sysfs mount since expected by some packages

33 views
Skip to first unread message

Cedric Hombourger

unread,
Nov 9, 2018, 3:11:38 PM11/9/18
to isar-...@googlegroups.com, Cedric Hombourger
Some packages look for /sys when they configure, build or test themselves (for
instance golang-google-grpc).

Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/classes/buildchroot.bbclass | 1 +
1 file changed, 1 insertion(+)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 870d27c..6bc57f4 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -29,5 +29,6 @@ buildchroot_do_mounts() {
mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
mount -t proc none ${BUILDCHROOT_DIR}/proc
+ mount -t sysfs none ${BUILDCHROOT_DIR}/sys
fi'
}
--
2.11.0

Cedric Hombourger

unread,
Nov 10, 2018, 2:15:52 AM11/10/18
to isar-...@googlegroups.com, Cedric Hombourger
Some packages look for /sys when they configure, build or test themselves (for
instance golang-google-grpc).

Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/classes/buildchroot.bbclass | 1 +
meta/classes/isar-bootstrap-helper.bbclass | 2 ++
2 files changed, 3 insertions(+)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 870d27c..6bc57f4 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -29,5 +29,6 @@ buildchroot_do_mounts() {
mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
mount -t proc none ${BUILDCHROOT_DIR}/proc
+ mount -t sysfs none ${BUILDCHROOT_DIR}/sys
fi'
}
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index 1ac39db..874bed4 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -105,6 +105,8 @@ setup_root_file_system() {

sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
sudo mount -t proc none $ROOTFSDIR/proc
+ sudo install -m 755 -d $ROOTFSDIR/sys
+ sudo mount -t sysfs none $ROOTFSDIR/sys

# Install packages:
E="${@ bb.utils.export_proxies(d)}"
--
2.11.0

Henning Schild

unread,
Nov 12, 2018, 4:31:27 AM11/12/18
to Cedric Hombourger, isar-...@googlegroups.com
Am Sat, 10 Nov 2018 08:15:39 +0100
schrieb Cedric Hombourger <Cedric_H...@mentor.com>:

> Some packages look for /sys when they configure, build or test
> themselves (for instance golang-google-grpc).
>
> Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
> ---
> meta/classes/buildchroot.bbclass | 1 +
> meta/classes/isar-bootstrap-helper.bbclass | 2 ++
> 2 files changed, 3 insertions(+)
>
> diff --git a/meta/classes/buildchroot.bbclass
> b/meta/classes/buildchroot.bbclass index 870d27c..6bc57f4 100644
> --- a/meta/classes/buildchroot.bbclass
> +++ b/meta/classes/buildchroot.bbclass
> @@ -29,5 +29,6 @@ buildchroot_do_mounts() {
> mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
> mount -t devtmpfs -o mode=0755,nosuid devtmpfs
> ${BUILDCHROOT_DIR}/dev mount -t proc none ${BUILDCHROOT_DIR}/proc
> + mount -t sysfs none ${BUILDCHROOT_DIR}/sys

We once had /sys on the list of filesystems to mount. But for some
reason it was dropped. Patches and reasons can be found in the
mailinglist archive ... i assume.

And things like that should probably be mounted with --rbind and
--make-rslave.
https://wiki.gentoo.org/wiki/Chroot/en#Configuration

Henning

Maxim Yu. Osipov

unread,
Nov 12, 2018, 4:46:32 AM11/12/18
to Cedric Hombourger, isar-...@googlegroups.com
Hi Cedric,

On 11/10/18 10:15 AM, Cedric Hombourger wrote:
> Some packages look for /sys when they configure, build or test themselves (for
> instance golang-google-grpc).

It's worth to check where this sysfs has to be unmounted (from the first
glance in isar_image_cleanup) and amend it to the patch.


Kind regards,
Maxim.
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mos...@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov

Cedric Hombourger

unread,
Nov 12, 2018, 11:59:48 PM11/12/18
to isar-...@googlegroups.com, Cedric Hombourger
Bind mount the entire hierarchy for /dev and /proc as recommended in Gentoo's
chroot setup guide.

Suggested-by: Henning Schild <henning...@siemens.com>
Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/classes/buildchroot.bbclass | 6 ++++--
meta/classes/isar-bootstrap-helper.bbclass | 6 ++++--
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 6 ++++--
3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 870d27c..26d5e80 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -27,7 +27,9 @@ buildchroot_do_mounts() {
if ! grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts; then
mount --bind ${REPO_ISAR_DIR}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
- mount -t proc none ${BUILDCHROOT_DIR}/proc
+ mount --rbind /dev ${BUILDCHROOT_DIR}/dev
+ mount --make-rslave ${BUILDCHROOT_DIR}/dev
+ mount --rbind /proc ${BUILDCHROOT_DIR}/proc
+ mount --make-rslave ${BUILDCHROOT_DIR}/proc
fi'
}
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index 1ac39db..62c0839 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -103,8 +103,10 @@ setup_root_file_system() {
sudo mount --bind ${REPO_BASE_DIR} ${ROOTFSDIR}/base-apt
fi

- sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
- sudo mount -t proc none $ROOTFSDIR/proc
+ sudo mount --rbind /dev ${ROOTFSDIR}/dev
+ sudo mount --make-rslave ${ROOTFSDIR}/dev
+ sudo mount --rbind /proc ${ROOTFSDIR}/proc
+ sudo mount --make-rslave ${ROOTFSDIR}/proc

# Install packages:
E="${@ bb.utils.export_proxies(d)}"
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 592d042..cd93f6c 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -241,8 +241,10 @@ isar_bootstrap() {
"${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"

# update APT
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev
- mount -t proc none ${ROOTFSDIR}/proc
+ mount --rbind /dev ${BUILDCHROOT_DIR}/dev
+ mount --make-rslave ${BUILDCHROOT_DIR}/dev
+ mount --rbind /proc ${BUILDCHROOT_DIR}/proc
+ mount --make-rslave ${BUILDCHROOT_DIR}/proc

export DEBIAN_FRONTEND=noninteractive
chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y
--
2.11.0

Cedric Hombourger

unread,
Nov 12, 2018, 11:59:49 PM11/12/18
to isar-...@googlegroups.com, Cedric Hombourger
Some packages look for /sys when they configure, build or test themselves (for
instance golang-google-grpc).

Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/classes/buildchroot.bbclass | 2 ++
meta/classes/image.bbclass | 1 +
meta/classes/isar-bootstrap-helper.bbclass | 3 +++
meta/classes/isar-image.bbclass | 1 +
4 files changed, 7 insertions(+)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 26d5e80..d2f138f 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -31,5 +31,7 @@ buildchroot_do_mounts() {
mount --make-rslave ${BUILDCHROOT_DIR}/dev
mount --rbind /proc ${BUILDCHROOT_DIR}/proc
mount --make-rslave ${BUILDCHROOT_DIR}/proc
+ mount --rbind /sys ${BUILDCHROOT_DIR}/sys
+ mount --make-rslave ${BUILDCHROOT_DIR}/sys
fi'
}
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d033cf5..5806a59 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -110,6 +110,7 @@ do_populate_sdk() {

sudo umount ${SDKCHROOT_DIR}/rootfs/dev || true
sudo umount ${SDKCHROOT_DIR}/rootfs/proc || true
+ sudo umount ${SDKCHROOT_DIR}/rootfs/sys || true

# Create SDK archive
sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index 62c0839..7b2ddf3 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -107,6 +107,9 @@ setup_root_file_system() {
sudo mount --make-rslave ${ROOTFSDIR}/dev
sudo mount --rbind /proc ${ROOTFSDIR}/proc
sudo mount --make-rslave ${ROOTFSDIR}/proc
+ sudo install -m 755 -d ${ROOTFSDIR}/sys
+ sudo mount --rbind /sys ${ROOTFSDIR}/sys
+ sudo mount --make-rslave ${ROOTFSDIR}/sys

# Install packages:
E="${@ bb.utils.export_proxies(d)}"
diff --git a/meta/classes/isar-image.bbclass b/meta/classes/isar-image.bbclass
index e0508be..356c97a 100644
--- a/meta/classes/isar-image.bbclass
+++ b/meta/classes/isar-image.bbclass
@@ -61,6 +61,7 @@ isar_image_cleanup() {
sudo rmdir ${IMAGE_ROOTFS}/isar-apt
sudo umount -l ${IMAGE_ROOTFS}/dev
sudo umount -l ${IMAGE_ROOTFS}/proc
+ sudo umount -l ${IMAGE_ROOTFS}/sys
sudo rm -f "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf"
}

--
2.11.0

chomb...@gmail.com

unread,
Nov 13, 2018, 5:43:45 AM11/13/18
to isar-users
Hello all,

While testing this patch series further in a more complex environment, I noticed some build errors that I did not get with pristine Isar builds.
The build logs show mkstemp being called in the buildchroot'ed environment and failing to find /tmp. Gentoo's guide was also bind mounting /tmp
I am however unclear on why this shows up with this particular change.

Cedric

Jan Kiszka

unread,
Nov 13, 2018, 5:59:44 AM11/13/18
to chomb...@gmail.com, isar-users
On 13.11.18 11:43, chomb...@gmail.com wrote:
> Hello all,
>
> While testing this patch series further in a more complex environment, I noticed
> some build errors that I did not get with pristine Isar builds.
> The build logs show mkstemp being called in the buildchroot'ed environment and
> failing to find /tmp. Gentoo's guide was also bind mounting /tmp
> I am however unclear on why this shows up with this particular change.

Confused. We do have /tmp inside the buildchroot, don't we? Or what is missing
from /tmp?

Jan

>
> Cedric
>
> On Monday, November 12, 2018 at 8:59:49 PM UTC-8, Cedric Hombourger wrote:
>
> Some packages look for /sys when they configure, build or test themselves (for
> instance golang-google-grpc).
>
> Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com <javascript:>>
> --
> You received this message because you are subscribed to the Google Groups
> "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to isar-users+...@googlegroups.com
> <mailto:isar-users+...@googlegroups.com>.
> To post to this group, send email to isar-...@googlegroups.com
> <mailto:isar-...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/isar-users/93fdfb3c-d759-4157-a269-f7f4987d581d%40googlegroups.com
> <https://groups.google.com/d/msgid/isar-users/93fdfb3c-d759-4157-a269-f7f4987d581d%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

Henning Schild

unread,
Nov 13, 2018, 7:06:08 AM11/13/18
to Cedric Hombourger, isar-...@googlegroups.com
Am Mon, 12 Nov 2018 20:59:32 -0800
schrieb Cedric Hombourger <Cedric_H...@mentor.com>:
/proc should be mounted as it was before.

Henning

Henning Schild

unread,
Nov 13, 2018, 7:07:05 AM11/13/18
to Cedric Hombourger, isar-...@googlegroups.com
Did you go through the mailinglist archives and find out why we do not
mount sys (anymore?) ?

Henning

Am Mon, 12 Nov 2018 20:59:33 -0800
schrieb Cedric Hombourger <Cedric_H...@mentor.com>:

Hombourger, Cedric

unread,
Nov 13, 2018, 7:37:38 AM11/13/18
to Henning Schild, isar-...@googlegroups.com
Hi Henning,

I have found this thread: https://groups.google.com/forum/#!searchin/isar-users/sysfs%7Csort:date/isar-users/YvBj1W8v-AM/yyNmaczJAwAJ
It suggests that attempts to mount another of sysfs in a docker would fail if not mounted read-only
I do not use Isar in a docker environment but would suspect the use of a bind mount would resolve that issue?

Cedric

Jan Kiszka

unread,
Nov 13, 2018, 7:59:59 AM11/13/18
to Hombourger, Cedric, Henning Schild, isar-...@googlegroups.com
On 13.11.18 13:37, Hombourger, Cedric wrote:
> Hi Henning,
>
> I have found this thread: https://groups.google.com/forum/#!searchin/isar-users/sysfs%7Csort:date/isar-users/YvBj1W8v-AM/yyNmaczJAwAJ
> It suggests that attempts to mount another of sysfs in a docker would fail if not mounted read-only
> I do not use Isar in a docker environment but would suspect the use of a bind mount would resolve that issue?

That issue was "resolved" already back then: We need docker run --privileged for
Isar anyway, so even mounting sysfs should be no issue. Needs a test, but that
is simple: jailhouse-images (soon also xenomai-images).

Jan

Henning Schild

unread,
Nov 14, 2018, 2:44:57 AM11/14/18
to Cedric Hombourger, isar-...@googlegroups.com
Two more things to double-check.

1. Do the umount hooks we have in place clean up all the recursiveness?
2. Once we rbind mount sys the chroot will probably be allowed to mess
with cgroups, tracing etc. Does a debootstrap change anything there,
i.e. by installing systemd, libvirt, or perf?

Henning

Am Mon, 12 Nov 2018 20:59:33 -0800
schrieb Cedric Hombourger <Cedric_H...@mentor.com>:

chomb...@gmail.com

unread,
Nov 16, 2018, 11:29:44 AM11/16/18
to isar-users
Hi Henning,

1. the hook we have for when the build ends does handle nested mounts just fine. I will however post a new patch with 'umount -R' calls in places where we explicitly umount /dev, /proc and /sys
2. I don't think we have an issue here, the use-case is similar to e.g. lxc, they do have /sys mounted and packages may be installed at will within the container

Cedric

Cedric Hombourger

unread,
Nov 16, 2018, 11:31:50 AM11/16/18
to isar-...@googlegroups.com, Cedric Hombourger
Bind mount the entire hierarchy for /dev as recommended in Gentoo's chroot
setup guide.

Suggested-by: Henning Schild <henning...@siemens.com>
Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/classes/buildchroot.bbclass | 3 ++-
meta/classes/image.bbclass | 2 +-
meta/classes/isar-bootstrap-helper.bbclass | 3 ++-
meta/classes/isar-image.bbclass | 2 +-
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 5 +++--
5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 34b7f59..a8964c6 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -27,7 +27,8 @@ buildchroot_do_mounts() {
if ! grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts; then
mount --bind ${REPO_ISAR_DIR}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
+ mount --rbind /dev ${BUILDCHROOT_DIR}/dev
+ mount --make-rslave ${BUILDCHROOT_DIR}/dev
mount -t proc none ${BUILDCHROOT_DIR}/proc
fi

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d033cf5..01e045d 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -108,7 +108,7 @@ do_populate_sdk() {
# Purge apt cache to make image slimmer
sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*

- sudo umount ${SDKCHROOT_DIR}/rootfs/dev || true
+ sudo umount -R ${SDKCHROOT_DIR}/rootfs/dev || true
sudo umount ${SDKCHROOT_DIR}/rootfs/proc || true

# Create SDK archive
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index e6a46ce..1d3e5f6 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -103,7 +103,8 @@ setup_root_file_system() {
sudo mount --bind ${REPO_BASE_DIR} ${ROOTFSDIR}/base-apt
fi

- sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
+ sudo mount --rbind /dev ${ROOTFSDIR}/dev
+ sudo mount --make-rslave ${ROOTFSDIR}/dev
sudo mount -t proc none $ROOTFSDIR/proc

# Refresh /etc/resolv.conf
diff --git a/meta/classes/isar-image.bbclass b/meta/classes/isar-image.bbclass
index e0508be..703b3e7 100644
--- a/meta/classes/isar-image.bbclass
+++ b/meta/classes/isar-image.bbclass
@@ -59,7 +59,7 @@ isar_image_cleanup() {
-maxdepth 1 -name 'qemu-*-static' -type f -delete
sudo umount -l ${IMAGE_ROOTFS}/isar-apt
sudo rmdir ${IMAGE_ROOTFS}/isar-apt
- sudo umount -l ${IMAGE_ROOTFS}/dev
+ sudo umount -R -l ${IMAGE_ROOTFS}/dev
sudo umount -l ${IMAGE_ROOTFS}/proc
sudo rm -f "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf"
}
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 21454b0..dfd649e 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -183,7 +183,7 @@ isar_bootstrap() {
set -e
if [ ! -e "${DEPLOY_ISAR_BOOTSTRAP}" ]; then
if [ -e "${ROOTFSDIR}" ]; then
- umount -l "${ROOTFSDIR}/dev" || true
+ umount -R -l "${ROOTFSDIR}/dev" || true
umount -l "${ROOTFSDIR}/proc" || true
rm -rf "${ROOTFSDIR}"
fi
@@ -243,7 +243,8 @@ isar_bootstrap() {
"${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"

# update APT
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev
+ mount --rbind /dev ${BUILDCHROOT_DIR}/dev
+ mount --make-rslave ${BUILDCHROOT_DIR}/dev
mount -t proc none ${ROOTFSDIR}/proc

export DEBIAN_FRONTEND=noninteractive
--
2.11.0

Cedric Hombourger

unread,
Nov 16, 2018, 11:31:55 AM11/16/18
to isar-...@googlegroups.com, Cedric Hombourger
Bind mount the entire hierarchy for /dev and /proc as recommended in Gentoo's
chroot setup guide.

Suggested-by: Henning Schild <henning...@siemens.com>
Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/classes/buildchroot.bbclass | 6 ++++--
meta/classes/isar-bootstrap-helper.bbclass | 6 ++++--
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 6 ++++--
3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 870d27c..26d5e80 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -27,7 +27,9 @@ buildchroot_do_mounts() {
if ! grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts; then
mount --bind ${REPO_ISAR_DIR}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
- mount -t proc none ${BUILDCHROOT_DIR}/proc
+ mount --rbind /dev ${BUILDCHROOT_DIR}/dev
+ mount --make-rslave ${BUILDCHROOT_DIR}/dev
+ mount --rbind /proc ${BUILDCHROOT_DIR}/proc
+ mount --make-rslave ${BUILDCHROOT_DIR}/proc
fi'
}
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index 1ac39db..62c0839 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -103,8 +103,10 @@ setup_root_file_system() {
sudo mount --bind ${REPO_BASE_DIR} ${ROOTFSDIR}/base-apt
fi

- sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
- sudo mount -t proc none $ROOTFSDIR/proc
+ sudo mount --rbind /dev ${ROOTFSDIR}/dev
+ sudo mount --make-rslave ${ROOTFSDIR}/dev
+ sudo mount --rbind /proc ${ROOTFSDIR}/proc
+ sudo mount --make-rslave ${ROOTFSDIR}/proc

# Install packages:
E="${@ bb.utils.export_proxies(d)}"
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 592d042..cd93f6c 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -241,8 +241,10 @@ isar_bootstrap() {
"${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"

# update APT
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev
- mount -t proc none ${ROOTFSDIR}/proc
+ mount --rbind /dev ${BUILDCHROOT_DIR}/dev
+ mount --make-rslave ${BUILDCHROOT_DIR}/dev
+ mount --rbind /proc ${BUILDCHROOT_DIR}/proc
+ mount --make-rslave ${BUILDCHROOT_DIR}/proc

export DEBIAN_FRONTEND=noninteractive
chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y
--
2.11.0

Cedric Hombourger

unread,
Nov 16, 2018, 11:31:58 AM11/16/18
to isar-...@googlegroups.com, Cedric Hombourger
Some packages look for /sys when they configure, build or test themselves (for
instance golang-google-grpc).

Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/classes/buildchroot.bbclass | 2 ++
meta/classes/image.bbclass | 1 +
meta/classes/isar-bootstrap-helper.bbclass | 3 +++
meta/classes/isar-image.bbclass | 1 +
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 3 +++
5 files changed, 10 insertions(+)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index a8964c6..0d4ff4e 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -30,6 +30,8 @@ buildchroot_do_mounts() {
mount --rbind /dev ${BUILDCHROOT_DIR}/dev
mount --make-rslave ${BUILDCHROOT_DIR}/dev
mount -t proc none ${BUILDCHROOT_DIR}/proc
+ mount --rbind /sys ${BUILDCHROOT_DIR}/sys
+ mount --make-rslave ${BUILDCHROOT_DIR}/sys
fi

# Refresh /etc/resolv.conf at this chance
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 01e045d..d8fbfd5 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -110,6 +110,7 @@ do_populate_sdk() {

sudo umount -R ${SDKCHROOT_DIR}/rootfs/dev || true
sudo umount ${SDKCHROOT_DIR}/rootfs/proc || true
+ sudo umount -R ${SDKCHROOT_DIR}/rootfs/sys || true

# Create SDK archive
sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index 1d3e5f6..c065851 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -106,6 +106,9 @@ setup_root_file_system() {
sudo mount --rbind /dev ${ROOTFSDIR}/dev
sudo mount --make-rslave ${ROOTFSDIR}/dev
sudo mount -t proc none $ROOTFSDIR/proc
+ sudo install -m 755 -d ${ROOTFSDIR}/sys
+ sudo mount --rbind /sys ${ROOTFSDIR}/sys
+ sudo mount --make-rslave ${ROOTFSDIR}/sys

# Refresh /etc/resolv.conf
sudo cp -L /etc/resolv.conf ${ROOTFSDIR}/etc
diff --git a/meta/classes/isar-image.bbclass b/meta/classes/isar-image.bbclass
index 703b3e7..7aaaecb 100644
--- a/meta/classes/isar-image.bbclass
+++ b/meta/classes/isar-image.bbclass
@@ -61,6 +61,7 @@ isar_image_cleanup() {
sudo rmdir ${IMAGE_ROOTFS}/isar-apt
sudo umount -R -l ${IMAGE_ROOTFS}/dev
sudo umount -l ${IMAGE_ROOTFS}/proc
+ sudo umount -R -l ${IMAGE_ROOTFS}/sys
sudo rm -f "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf"
}

diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index dfd649e..3f7910f 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -185,6 +185,7 @@ isar_bootstrap() {
if [ -e "${ROOTFSDIR}" ]; then
umount -R -l "${ROOTFSDIR}/dev" || true
umount -l "${ROOTFSDIR}/proc" || true
+ umount -R -l "${ROOTFSDIR}/sys" || true
rm -rf "${ROOTFSDIR}"
fi
if [ ${IS_HOST} ]; then
@@ -246,6 +247,8 @@ isar_bootstrap() {
mount --rbind /dev ${BUILDCHROOT_DIR}/dev
mount --make-rslave ${BUILDCHROOT_DIR}/dev
mount -t proc none ${ROOTFSDIR}/proc
+ mount --rbind /sys ${BUILDCHROOT_DIR}/sys
+ mount --make-rslave ${BUILDCHROOT_DIR}/sys

Cedric Hombourger

unread,
Nov 17, 2018, 9:57:11 AM11/17/18
to isar-...@googlegroups.com, Cedric Hombourger
Some of the packages I have been rebuilding within Isar require /sys mounted.
For instance, golang-google-grpc runs some package tests after it builds itself
and reads properties from /sys/class/dmi.

The initial version of this patch series only added a mount of /sys. Henning
then suggested that we follow Gentoo's guidelines for chroots. As such, this
patch series is now mounting /dev and /sys as rbind mounts but leaves /proc
as a regular procfs mount (like Gentoo does).

ChangeLog:

v5: cover letter added as suggested by Jan (private e-mail)
v4: limit rbind mounts to /dev and /sys, leave /proc as a regular mount
v3: rbind mounts for /dev, /proc and /sys, add explicit umount calls
v2: create /sys directory
v1: initial submission, simply mount /sys

Cedric Hombourger (2):
buildchroot+bootstrap: rbind mount for /dev
buildchroot: add sysfs mount since expected by some packages

meta/classes/buildchroot.bbclass | 5 ++++-
meta/classes/image.bbclass | 3 ++-
meta/classes/isar-bootstrap-helper.bbclass | 6 +++++-
meta/classes/isar-image.bbclass | 3 ++-
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 8 ++++++--
5 files changed, 19 insertions(+), 6 deletions(-)

--
2.7.4

Cedric Hombourger

unread,
Nov 17, 2018, 9:57:13 AM11/17/18
to isar-...@googlegroups.com, Cedric Hombourger
Bind mount the entire hierarchy for /dev as recommended in Gentoo's chroot
setup guide.

Suggested-by: Henning Schild <henning...@siemens.com>
Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/classes/buildchroot.bbclass | 3 ++-
meta/classes/image.bbclass | 2 +-
meta/classes/isar-bootstrap-helper.bbclass | 3 ++-
meta/classes/isar-image.bbclass | 2 +-
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 5 +++--
5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 34b7f59..a8964c6 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -27,7 +27,8 @@ buildchroot_do_mounts() {
if ! grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts; then
mount --bind ${REPO_ISAR_DIR}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
+ mount --rbind /dev ${BUILDCHROOT_DIR}/dev
+ mount --make-rslave ${BUILDCHROOT_DIR}/dev
mount -t proc none ${BUILDCHROOT_DIR}/proc
fi

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d033cf5..01e045d 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -108,7 +108,7 @@ do_populate_sdk() {
# Purge apt cache to make image slimmer
sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*

- sudo umount ${SDKCHROOT_DIR}/rootfs/dev || true
+ sudo umount -R ${SDKCHROOT_DIR}/rootfs/dev || true
sudo umount ${SDKCHROOT_DIR}/rootfs/proc || true

# Create SDK archive
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index e6a46ce..1d3e5f6 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -103,7 +103,8 @@ setup_root_file_system() {
sudo mount --bind ${REPO_BASE_DIR} ${ROOTFSDIR}/base-apt
fi

- sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
+ sudo mount --rbind /dev ${ROOTFSDIR}/dev
+ sudo mount --make-rslave ${ROOTFSDIR}/dev
sudo mount -t proc none $ROOTFSDIR/proc

# Refresh /etc/resolv.conf
diff --git a/meta/classes/isar-image.bbclass b/meta/classes/isar-image.bbclass
index e0508be..703b3e7 100644
--- a/meta/classes/isar-image.bbclass
+++ b/meta/classes/isar-image.bbclass
@@ -59,7 +59,7 @@ isar_image_cleanup() {
-maxdepth 1 -name 'qemu-*-static' -type f -delete
sudo umount -l ${IMAGE_ROOTFS}/isar-apt
sudo rmdir ${IMAGE_ROOTFS}/isar-apt
- sudo umount -l ${IMAGE_ROOTFS}/dev
+ sudo umount -R -l ${IMAGE_ROOTFS}/dev
sudo umount -l ${IMAGE_ROOTFS}/proc
sudo rm -f "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf"
}
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 21454b0..dfd649e 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -183,7 +183,7 @@ isar_bootstrap() {
set -e
if [ ! -e "${DEPLOY_ISAR_BOOTSTRAP}" ]; then
if [ -e "${ROOTFSDIR}" ]; then
- umount -l "${ROOTFSDIR}/dev" || true
+ umount -R -l "${ROOTFSDIR}/dev" || true
umount -l "${ROOTFSDIR}/proc" || true
rm -rf "${ROOTFSDIR}"
fi
@@ -243,7 +243,8 @@ isar_bootstrap() {
"${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"

# update APT
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev
+ mount --rbind /dev ${BUILDCHROOT_DIR}/dev
+ mount --make-rslave ${BUILDCHROOT_DIR}/dev
mount -t proc none ${ROOTFSDIR}/proc

export DEBIAN_FRONTEND=noninteractive
--
2.7.4

Cedric Hombourger

unread,
Nov 17, 2018, 9:57:15 AM11/17/18
to isar-...@googlegroups.com, Cedric Hombourger
2.7.4

Henning Schild

unread,
Nov 19, 2018, 4:24:10 AM11/19/18
to Cedric Hombourger, isar-...@googlegroups.com
Am Sat, 17 Nov 2018 15:56:59 +0100
schrieb Cedric Hombourger <Cedric_H...@mentor.com>:
Why this mkdir? Does debootstrap create the other two and not this one?

Henning

Henning Schild

unread,
Nov 19, 2018, 4:25:25 AM11/19/18
to Cedric Hombourger, isar-...@googlegroups.com
Am Sat, 17 Nov 2018 15:56:58 +0100
schrieb Cedric Hombourger <Cedric_H...@mentor.com>:
umount -R ${ROOTFSDIR} ?

Maybe as a third patch on top.

Henning

Henning Schild

unread,
Nov 19, 2018, 4:27:27 AM11/19/18
to Cedric Hombourger, isar-...@googlegroups.com
Looking at how many places we have to change to get the mounts right,
we most likely want all that logic in a function. I recently had issues
with an imager class in a layer, that also carries mounting logic.

But i guess that would be a cleanup step on top.

Henning

Am Sat, 17 Nov 2018 15:56:57 +0100
schrieb Cedric Hombourger <Cedric_H...@mentor.com>:

Hombourger, Cedric

unread,
Nov 19, 2018, 4:30:17 AM11/19/18
to Henning Schild, isar-...@googlegroups.com
Hi Henning,

Yes you read my mind, that's the next thing I'd like to do but wouldn't mind getting this series in first to unblock some other work we have on-going here
I will go through your comments on the v5 series and respond/handle

Cedric

-----Original Message-----
From: Henning Schild [mailto:henning...@siemens.com]
Sent: Monday, November 19, 2018 10:27 AM
To: Hombourger, Cedric <Cedric_H...@mentor.com>
Cc: isar-...@googlegroups.com

chomb...@gmail.com

unread,
Nov 20, 2018, 7:36:26 AM11/20/18
to isar-users


On Monday, November 19, 2018 at 10:25:25 AM UTC+1, Henning Schild wrote:
> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index
> 21454b0..dfd649e 100644 ---
> a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++
> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -183,7
> +183,7 @@ isar_bootstrap() { set -e
>          if [ ! -e "${DEPLOY_ISAR_BOOTSTRAP}" ]; then
>              if [ -e "${ROOTFSDIR}" ]; then
> -               umount -l "${ROOTFSDIR}/dev" || true
> +               umount -R -l "${ROOTFSDIR}/dev" || true
>                 umount -l "${ROOTFSDIR}/proc" || true
>                 rm -rf "${ROOTFSDIR}"

 umount -R ${ROOTFSDIR} ?

Maybe as a third patch on top.

This will not work as ROOTFSDIR is not a mountpoint.
I will post a v6 with the removal of the mkdir of /sys as the only change

Cedric 

Cedric Hombourger

unread,
Nov 20, 2018, 7:42:27 AM11/20/18
to isar-...@googlegroups.com, Cedric Hombourger
Some of the packages I have been rebuilding within Isar require /sys mounted.
For instance, golang-google-grpc runs some package tests after it builds itself
and reads properties from /sys/class/dmi.

The initial version of this patch series only added a mount of /sys. Henning
then suggested that we follow Gentoo's guidelines for chroots. As such, this
patch series is now mounting /dev and /sys as rbind mounts but leaves /proc
as a regular procfs mount (like Gentoo does).

ChangeLog:

v6: remove unnecessary mkdir for /sys
v5: cover letter added as suggested by Jan (private e-mail)
v4: limit rbind mounts to /dev and /sys, leave /proc as a regular mount
v3: rbind mounts for /dev, /proc and /sys, add explicit umount calls
v2: create /sys directory
v1: initial submission, simply mount /sys

Cedric Hombourger (2):
buildchroot+bootstrap: rbind mount for /dev
buildchroot: add sysfs mount since expected by some packages

meta/classes/buildchroot.bbclass | 5 ++++-
meta/classes/image.bbclass | 3 ++-
meta/classes/isar-bootstrap-helper.bbclass | 6 +++++-
meta/classes/isar-image.bbclass | 3 ++-
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 8 ++++++--
5 files changed, 19 insertions(+), 6 deletions(-)

--
2.7.4

Cedric Hombourger

unread,
Nov 20, 2018, 7:42:42 AM11/20/18
to isar-...@googlegroups.com, Cedric Hombourger
Bind mount the entire hierarchy for /dev as recommended in Gentoo's chroot
setup guide.

Suggested-by: Henning Schild <henning...@siemens.com>
Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/classes/buildchroot.bbclass | 3 ++-
meta/classes/image.bbclass | 2 +-
meta/classes/isar-bootstrap-helper.bbclass | 3 ++-
meta/classes/isar-image.bbclass | 2 +-
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 5 +++--
5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 34b7f59..a8964c6 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -27,7 +27,8 @@ buildchroot_do_mounts() {
if ! grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts; then
mount --bind ${REPO_ISAR_DIR}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
+ mount --rbind /dev ${BUILDCHROOT_DIR}/dev
+ mount --make-rslave ${BUILDCHROOT_DIR}/dev
mount -t proc none ${BUILDCHROOT_DIR}/proc
fi

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d033cf5..01e045d 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -108,7 +108,7 @@ do_populate_sdk() {
# Purge apt cache to make image slimmer
sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*

- sudo umount ${SDKCHROOT_DIR}/rootfs/dev || true
+ sudo umount -R ${SDKCHROOT_DIR}/rootfs/dev || true
sudo umount ${SDKCHROOT_DIR}/rootfs/proc || true

# Create SDK archive
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index e6a46ce..1d3e5f6 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -103,7 +103,8 @@ setup_root_file_system() {
sudo mount --bind ${REPO_BASE_DIR} ${ROOTFSDIR}/base-apt
fi

- sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
+ sudo mount --rbind /dev ${ROOTFSDIR}/dev
+ sudo mount --make-rslave ${ROOTFSDIR}/dev
sudo mount -t proc none $ROOTFSDIR/proc

# Refresh /etc/resolv.conf
diff --git a/meta/classes/isar-image.bbclass b/meta/classes/isar-image.bbclass
index e0508be..703b3e7 100644
--- a/meta/classes/isar-image.bbclass
+++ b/meta/classes/isar-image.bbclass
@@ -59,7 +59,7 @@ isar_image_cleanup() {
-maxdepth 1 -name 'qemu-*-static' -type f -delete
sudo umount -l ${IMAGE_ROOTFS}/isar-apt
sudo rmdir ${IMAGE_ROOTFS}/isar-apt
- sudo umount -l ${IMAGE_ROOTFS}/dev
+ sudo umount -R -l ${IMAGE_ROOTFS}/dev
sudo umount -l ${IMAGE_ROOTFS}/proc
sudo rm -f "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf"
}
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 21454b0..dfd649e 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -183,7 +183,7 @@ isar_bootstrap() {
set -e
if [ ! -e "${DEPLOY_ISAR_BOOTSTRAP}" ]; then
if [ -e "${ROOTFSDIR}" ]; then
- umount -l "${ROOTFSDIR}/dev" || true
+ umount -R -l "${ROOTFSDIR}/dev" || true
umount -l "${ROOTFSDIR}/proc" || true
rm -rf "${ROOTFSDIR}"
fi
@@ -243,7 +243,8 @@ isar_bootstrap() {
"${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"

# update APT
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev
+ mount --rbind /dev ${BUILDCHROOT_DIR}/dev
+ mount --make-rslave ${BUILDCHROOT_DIR}/dev
mount -t proc none ${ROOTFSDIR}/proc

export DEBIAN_FRONTEND=noninteractive
--
2.7.4

Cedric Hombourger

unread,
Nov 20, 2018, 7:42:43 AM11/20/18
to isar-...@googlegroups.com, Cedric Hombourger
Some packages look for /sys when they configure, build or test themselves (for
instance golang-google-grpc).

Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/classes/buildchroot.bbclass | 2 ++
meta/classes/image.bbclass | 1 +
meta/classes/isar-bootstrap-helper.bbclass | 2 ++
meta/classes/isar-image.bbclass | 1 +
meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 3 +++
5 files changed, 9 insertions(+)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index a8964c6..0d4ff4e 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -30,6 +30,8 @@ buildchroot_do_mounts() {
mount --rbind /dev ${BUILDCHROOT_DIR}/dev
mount --make-rslave ${BUILDCHROOT_DIR}/dev
mount -t proc none ${BUILDCHROOT_DIR}/proc
+ mount --rbind /sys ${BUILDCHROOT_DIR}/sys
+ mount --make-rslave ${BUILDCHROOT_DIR}/sys
fi

# Refresh /etc/resolv.conf at this chance
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 01e045d..d8fbfd5 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -110,6 +110,7 @@ do_populate_sdk() {

sudo umount -R ${SDKCHROOT_DIR}/rootfs/dev || true
sudo umount ${SDKCHROOT_DIR}/rootfs/proc || true
+ sudo umount -R ${SDKCHROOT_DIR}/rootfs/sys || true

# Create SDK archive
sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index 1d3e5f6..d77690f 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -106,6 +106,8 @@ setup_root_file_system() {
sudo mount --rbind /dev ${ROOTFSDIR}/dev
sudo mount --make-rslave ${ROOTFSDIR}/dev
sudo mount -t proc none $ROOTFSDIR/proc
--
2.7.4

chomb...@gmail.com

unread,
Nov 22, 2018, 11:08:35 AM11/22/18
to isar-users
Is the v6 series ready/ok for Maxim to merge?

Maxim Yu. Osipov

unread,
Nov 23, 2018, 9:13:22 AM11/23/18
to Cedric Hombourger, isar-...@googlegroups.com
On 11/20/18 3:40 PM, Cedric Hombourger wrote:
> Some of the packages I have been rebuilding within Isar require /sys mounted.
> For instance, golang-google-grpc runs some package tests after it builds itself
> and reads properties from /sys/class/dmi.
>
> The initial version of this patch series only added a mount of /sys. Henning
> then suggested that we follow Gentoo's guidelines for chroots. As such, this
> patch series is now mounting /dev and /sys as rbind mounts but leaves /proc
> as a regular procfs mount (like Gentoo does).
>
> ChangeLog:
>
> v6: remove unnecessary mkdir for /sys
> v5: cover letter added as suggested by Jan (private e-mail)
> v4: limit rbind mounts to /dev and /sys, leave /proc as a regular mount
> v3: rbind mounts for /dev, /proc and /sys, add explicit umount calls
> v2: create /sys directory
> v1: initial submission, simply mount /sys

Applied (finally!) to the 'next',

Thanks,
Maxim.

> Cedric Hombourger (2):
> buildchroot+bootstrap: rbind mount for /dev
> buildchroot: add sysfs mount since expected by some packages
>
> meta/classes/buildchroot.bbclass | 5 ++++-
> meta/classes/image.bbclass | 3 ++-
> meta/classes/isar-bootstrap-helper.bbclass | 6 +++++-
> meta/classes/isar-image.bbclass | 3 ++-
> meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 8 ++++++--
> 5 files changed, 19 insertions(+), 6 deletions(-)
>


--
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mos...@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov

Maxim Yu. Osipov

unread,
Nov 27, 2018, 9:45:35 AM11/27/18
to Cedric Hombourger, isar-...@googlegroups.com
Hi Cedric,

After applying these patches I've recognized that after
running ci_build.sh script, the number of mounts significantly increases.

On my PC it looks like that

$ mount | wc -l
34
isar$ ./scripts/ci_build.sh -q -f
...
$ mount | wc -l
100

If I revert these patches the number of mount points
stays the same after running ci_build.sh script.

This behavior significantly affects CI -
builds start to fail. This is a blocking point for CI and if we don't
find a quick solution I will have to revert these patches in 'next'.

Thanks,
Maxim.

On 11/20/18 3:40 PM, Cedric Hombourger wrote:

Hombourger, Cedric

unread,
Nov 27, 2018, 9:48:44 AM11/27/18
to Maxim Yu. Osipov, isar-...@googlegroups.com
Hi Maxim,

We may need to revert Henning's suggestion to rbind /sys and mount /sys as a regular mount (the chroot may not need all of the sub-mounts from /sys)
What do people think?

Cedric

Maxim Yu. Osipov

unread,
Nov 29, 2018, 3:23:06 AM11/29/18
to Hombourger, Cedric, isar-...@googlegroups.com
Hi Cedric,

On 11/27/18 5:48 PM, Hombourger, Cedric wrote:
> Hi Maxim,
>
> We may need to revert Henning's suggestion to rbind /sys and mount /sys as a regular mount (the chroot may not need all of the sub-mounts from /sys)
> What do people think?

My apologies for late reply (was busy with other urgent topics).
Have you tested the version with regular mounts?

Kind regards,
Maxim.

Hombourger, Cedric

unread,
Nov 29, 2018, 3:28:43 AM11/29/18
to Maxim Yu. Osipov, isar-...@googlegroups.com
Hi Maxim,

No worries - I was also busy here in St Petersburg because of an accident and now have a broken ankle :(
Yes I had tested with regular mounts (patch series v1/v2) and it worked just fine. I can submit a patch this week

Cedric

-----Original Message-----
From: Maxim Yu. Osipov [mailto:mos...@ilbers.de]
Sent: Thursday, November 29, 2018 11:23 AM
To: Hombourger, Cedric <Cedric_H...@mentor.com>

Maxim Yu. Osipov

unread,
Nov 29, 2018, 3:48:50 AM11/29/18
to Hombourger, Cedric, isar-...@googlegroups.com
Hi Cedric,

On 11/29/18 11:28 AM, Hombourger, Cedric wrote:
> Hi Maxim,
>
> No worries - I was also busy here in St Petersburg because of an accident and now have a broken ankle :(

Sad to hear :(...
So you are the victim of Russian winter and you learned the Russian word
'gololed' (iced surface)...

> Yes I had tested with regular mounts (patch series v1/v2) and it worked just fine. I can submit a patch this week

Yes, I've re-read the thread. My concern on v2 was to double check that
all /sys are properly unmounted (this is a problem we experience in 'next').

I wish you to recover and take care,

Henning Schild

unread,
Nov 29, 2018, 4:54:57 AM11/29/18
to Hombourger, Cedric, Maxim Yu. Osipov, isar-...@googlegroups.com
Am Tue, 27 Nov 2018 14:48:37 +0000
schrieb "Hombourger, Cedric" <Cedric_H...@mentor.com>:

> Hi Maxim,
>
> We may need to revert Henning's suggestion to rbind /sys and
> mount /sys as a regular mount (the chroot may not need all of the
> sub-mounts from /sys) What do people think?

I already expected the umount not being able to clean up, but Cedric
tested that and made the umount recursive.
I guess it would be a good idea to understand what is going on, and why
those mounts do not get cleaned up. Maybe we still have a problem in
the umounting logic and mounting less will not fix but just hide it.

But we can also revert to mounting as little as needed and accept new
mounts on demand, just like we did for sys. However the demand for
something under sys would not be a big surprise and we might be talking
about that topic again soon ... or never. I do not know.

Henning

Baurzhan Ismagulov

unread,
Nov 29, 2018, 5:00:15 AM11/29/18
to isar-...@googlegroups.com
Hello Cedric,

On Thu, Nov 29, 2018 at 08:28:37AM +0000, Hombourger, Cedric wrote:
> No worries - I was also busy here in St Petersburg because of an accident and
> now have a broken ankle :(

Oh :( , get well soon!

With kind regards,
Baurzhan.
Reply all
Reply to author
Forward
0 new messages