public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Maxim Yu. Osipov" <mosipov@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH 2/2] meta/classes: Cleanup /sys rbind mounting
Date: Wed,  5 Dec 2018 10:46:59 +0100	[thread overview]
Message-ID: <20181205094659.25029-3-mosipov@ilbers.de> (raw)
In-Reply-To: <20181205094659.25029-1-mosipov@ilbers.de>

This patch eliminates rbind mounting introduced by commit
768908a "buildchroot: add sysfs mount since expected by some packages"
as bitbake hangs when trying to unmount /sys).

The following scenario causes hangs on Debian 9 (stretch) systems:
 * source isar-init-build-env
 * sed -i -e 's/ISAR_CROSS_COMPILE ?= "0"/ISAR_CROSS_COMPILE ?= "1"/g' conf/local.conf
 * bitbake  -c cache_base_repo multiconfig:qemuarm-stretch:isar-image-base \
   multiconfig:qemuarm64-stretch:isar-image-base multiconfig:qemuamd64-stretch:isar-image-base
 * sudo rm -rf tmp
 * sed -i -e 's/#ISAR_USE_CACHED_BASE_REPO ?= "1"/ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
 * bitbake multiconfig:qemuarm-stretch:isar-image-base \
   multiconfig:qemuarm64-stretch:isar-image-base multiconfig:qemuamd64-stretch:isar-image-base

The last command hangs on the last task.

Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
 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 | 3 +--
 5 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index d7368c4..5a8a137 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -29,8 +29,7 @@ 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 --rbind /sys ${BUILDCHROOT_DIR}/sys
-            mount --make-rslave ${BUILDCHROOT_DIR}/sys
+            mount -t sysfs /sys ${BUILDCHROOT_DIR}/sys
         fi
 
         # Refresh /etc/resolv.conf at this chance
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index f438f11..5806a59 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -110,7 +110,7 @@ do_populate_sdk() {
 
     sudo umount ${SDKCHROOT_DIR}/rootfs/dev || true
     sudo umount ${SDKCHROOT_DIR}/rootfs/proc || true
-    sudo umount -R ${SDKCHROOT_DIR}/rootfs/sys || 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 0750a8f..e755e4f 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -105,8 +105,7 @@ setup_root_file_system() {
 
     sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev
     sudo mount -t proc none $ROOTFSDIR/proc
-    sudo mount --rbind /sys ${ROOTFSDIR}/sys
-    sudo mount --make-rslave ${ROOTFSDIR}/sys
+    sudo mount -t sysfs /sys ${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 c65b13c..14b97dd 100644
--- a/meta/classes/isar-image.bbclass
+++ b/meta/classes/isar-image.bbclass
@@ -61,7 +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 -R -l ${IMAGE_ROOTFS}/sys
+    sudo umount -l ${IMAGE_ROOTFS}/sys
     sudo rm -f "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf"
     if [ "${ISAR_USE_CACHED_BASE_REPO}" = "1" ]; then
         sudo umount -l ${IMAGE_ROOTFS}/base-apt
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index c19399c..b13ea9d 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -245,8 +245,7 @@ isar_bootstrap() {
             # update APT
             mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev
             mount -t proc none ${ROOTFSDIR}/proc
-            mount --rbind /sys ${ROOTFSDIR}/sys
-            mount --make-rslave ${ROOTFSDIR}/sys
+            mount -t sysfs /sys ${ROOTFSDIR}/sys
 
             export DEBIAN_FRONTEND=noninteractive
             chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y
-- 
2.11.0


  parent reply	other threads:[~2018-12-05  9:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05  9:46 [PATCH 0/2] Cleanup rbind mounting for /dev ans /sys Maxim Yu. Osipov
2018-12-05  9:46 ` [PATCH 1/2] Revert "buildchroot+bootstrap: rbind mount for /dev" Maxim Yu. Osipov
2018-12-05  9:46 ` Maxim Yu. Osipov [this message]
2018-12-05  9:58 ` [PATCH 0/2] Cleanup rbind mounting for /dev ans /sys Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181205094659.25029-3-mosipov@ilbers.de \
    --to=mosipov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox