From patchwork Wed Jun 19 10:41:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Mikanovich X-Patchwork-Id: 3624 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Wed, 19 Jun 2024 12:41:45 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-lf1-f63.google.com (mail-lf1-f63.google.com [209.85.167.63]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 45JAfiS9028308 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 19 Jun 2024 12:41:44 +0200 Received: by mail-lf1-f63.google.com with SMTP id 2adb3069b0e04-52bbd8ac2c1sf4622318e87.3 for ; Wed, 19 Jun 2024 03:41:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718793699; cv=pass; d=google.com; s=arc-20160816; b=UBjwiEgm8AQRpZFtSS/ucMfQtbPdQBYw4zmOp0QPTrGLUoxSZaI1nP3pkfDq7ccMw2 b11ZuUQSmrg3clqe2j9L1T/hZXZBmT7BMlDtzsCnB7VwXHxIKvtQjwKLO3zrPotrxf9n qJbWmjDcOwpjnMQq1yfM22BCwVw5KXDqrYsmXfB2+BfMoN7oWoVIdkwx+h6DBMJjjlWD IqWx+mIFAz/e3KDTWbQZcCRdDNKuFAK9BonXNFMPW0iSgCkX8m5Kp0ZNVmebyuoQKkcp CG1Tvh+yiLnd0ultwNX0wLrz66wZcDxN5YJrBxI3DpJZ7wn07ngylTW/gDycqY8kCFfP CSyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=snVJEdTanKBTR6Eq1BN/u6pYVoL7IVyA5bzy+PqIOIc=; fh=zDE2RPpSXHZuLmurSVs9nl3mRsAj1Dfn/X24rl4nss4=; b=EUV6IQH42bC/zjs1mdd3qXbVuzGxmlNcyvX/twxQ0UOGDaw81UEOo2xycSuMjAva/a BfAnJ6ICkHyqVrYVvk1XYKQDkKiDaCYldQ7vOuBAzkNcRWbifF+oked2Nr8IKLtg3aVV s6dvA+ZN7Evuo1T0NYyvEmxm2GSYtascWb7lNzt2wvu/5rFM92DoFRTJgt/ywx1lFgH5 DktMSY02B3/OMLmKZcKFZy1k7K0cebcnT5uvYoQScj3myopmyjMz8RLTyA3FrMIJ5umn GAvVyX47DElQLQ++MXnkuXTW7lLTA5L5kGfmGV0Ba7EtlcJ3QY9Wtj/ZtZOPtk2rS0Eh NecQ==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1718793699; x=1719398499; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=snVJEdTanKBTR6Eq1BN/u6pYVoL7IVyA5bzy+PqIOIc=; b=OcTTGN+r89rSw6+hfjboA/W7QZ30ihQL0Ym6dtdd54SkRF7spOHlCCMLzWp/QRybhc pY/aaTOQ52hvasHjokz2B1zaPz9WIVpFuF1MEYPMoca8obTGX58UBcHhsppPvfQSQVTM epQxm5jGOs0MIT1bJJtr/w2S3SfB5SzQqEoCkwhphzrFztZSBzzbex0+oHi5X7i3ZpSr 5yKljVNiY1sEXPIX1mQJyzEeZIePM32tOuI/6LrbdAYRfJ6ReEM6GO1IYBhyXydKbJgd FtU/21DK/xykjLOKFTZpXk/kjzCWuTV32KnB6t/mGaZQ3iqx57e0IHL/YzYIkKvErwQs omcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718793699; x=1719398499; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=snVJEdTanKBTR6Eq1BN/u6pYVoL7IVyA5bzy+PqIOIc=; b=ErnMZlBhLfPYRoDsdNjn0RsSRZKGN32sRl1hAS1t7GPeFl38pYqODE9PC5R3Kbtpxe uJy8IxKpUxBoJZZwdau7K3d5l9zXHGBTkfOuBkT0ctm0AnjFz0cmLaRtxAiNUnsU9Res CZnrITWfStCV2UqTA2rkyR7ojnWYnWiRJWiV8vu4lPcRh2ih1+ZeCFi1R+dDa9p0hoeD oovhThgojTNFH3GMY5qaZOaNPYxedMcXUSpndTFGmIuOU4iJ+kCSeGmkECPbr7pxsW3H /cGnouHWHdlkA0VQRmUIJj7JD1eBgAbL4J9htym8xruOGSu9J5WCDNC7cvWXtUtoJnq7 6SBg== Sender: isar-users@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXalAfeimniMk7BOSTuBNRr3giu4cMMbZ4P6IYG6cLzwfXgFbmYOOqtlsQrHJGF1J/F5Fj8xPSH5UN2pPPw6yAdYDf3a1c= X-Gm-Message-State: AOJu0YxZnQi0Xteg4N1+l6itCekwBz01dVody8VzgXzJ6lxIKsSDONpR owXFcadPjVIXtE/UnL7O2eU/A2hBU7ERBHiQVYTWOdRAF9qeZkJy X-Google-Smtp-Source: AGHT+IG6869fpFYH+g1kGMDAk+N4bi6sM3B65ouSV0mhMJWZtYSJNxPhIvUBCFkwn8p1QSRKILfF8Q== X-Received: by 2002:ac2:599a:0:b0:52c:7a2d:5d5d with SMTP id 2adb3069b0e04-52ccaa2d4dfmr1306597e87.3.1718793698459; Wed, 19 Jun 2024 03:41:38 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6512:3e1b:b0:52c:a18b:6b3e with SMTP id 2adb3069b0e04-52ca1a77391ls2810541e87.0.-pod-prod-04-eu; Wed, 19 Jun 2024 03:41:36 -0700 (PDT) X-Received: by 2002:a05:6512:70:b0:52c:8932:27bd with SMTP id 2adb3069b0e04-52ccaa38052mr974617e87.41.1718793695736; Wed, 19 Jun 2024 03:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718793695; cv=none; d=google.com; s=arc-20160816; b=KiVO/STidvpSRmmZ09jde9jEc77asrl5LrXZ8Wvk2aKwEvULqhZtpc8ROnyYd+SqlO VtJ6WOMMZ+RuXoiOiPvwDANBVQZsvlQ3lBn5NfS3VTXAGvsX5+YYveU6ZO1i+TQEWGcY pVAKuavFx8fy4qpChS1Ohp51OaK6V38B4+FrdDF5ZrBkEkDZByLUE6M4iT8rPKDi2m1f /kXr2S/FKRYYkSTQV1alg3wUVif7gYerPesxypdDy/IYoul2/E2T6Uq72vt2r2fLxXBz oj2Wgs3hzaBkrs6o6Qjmd49j23XMF+HaGdrbFgW1p2cwV30Eno4jOs512XeqC14hZGJD HIRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=vNlSemkYtCVtI7Lhyb4eIjw5u7LEkdQ7dtXmFmrHAe8=; fh=z3rP6Lb9kCHMNktWueEpSrG6TTw5jLe7zgHgRhRlVvY=; b=JQLrMCstAUNFmKKSjv9rbdub6jl+/wJGRCT9mkAAasboOIctizolEv7AtW/Nz6GBV8 IWGP2NlHDzJE/+ygV494ieQe/Q3TLVABjd5pfv/w+ctjboos8Qao5LVa7cxzlsqQeVyn FQjQfwfq2dvHiStX6cEJTOVqMqqoRT+5ZlawBK07B6P28rI2XbC3LG9P6lzXnFpERbhu R8wH09+jeGe2rqqJEhNFjC5JZFqHa+6V7slb8MTw1xV9N0hzPZe7fT2/KTOfPtBMagsN CbUuCTWHwByPGBmvNl9fptRl/XQf58QVV1t455HEsjedu/56ki3coVdKleLVQ7SD23l3 Pe6w==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id 2adb3069b0e04-52ca27c60e5si305477e87.0.2024.06.19.03.41.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jun 2024 03:41:35 -0700 (PDT) Received-SPF: pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Received: from user-B660.promwad.corp ([159.148.83.114]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 45JAfXx7028294 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 12:41:34 +0200 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Ilia Skochilov , Anton Mikanovich Subject: [PATCH] meta: Drop lazy and recursive unmounts Date: Wed, 19 Jun 2024 13:41:26 +0300 Message-Id: <20240619104126.105252-1-amikan@ilbers.de> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED, RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-Original-Sender: amikan@ilbers.de X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: Ilia Skochilov Cleanup lazy and recursive unmounting because they just mask other issues caused by wrong mounting. Also remove umount || true usages for the same reason. Signed-off-by: Anton Mikanovich Signed-off-by: Ilia Skochilov --- meta/classes/deb-dl-dir.bbclass | 4 ++-- meta/classes/image.bbclass | 14 +++++++++----- meta/classes/isar-events.bbclass | 2 +- meta/classes/rootfs.bbclass | 10 +++++----- meta/classes/sbuild.bbclass | 12 ++++++------ meta/classes/sdk.bbclass | 13 ++++++++++--- .../isar-bootstrap/isar-bootstrap.inc | 19 ++++++++++--------- .../sdk-files/files/README.sdk | 2 +- scripts/mount_chroot.sh | 2 +- 9 files changed, 45 insertions(+), 33 deletions(-) diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass index d36b7190..8e0243fe 100644 --- a/meta/classes/deb-dl-dir.bbclass +++ b/meta/classes/deb-dl-dir.bbclass @@ -27,7 +27,7 @@ debsrc_do_mounts() { set -e mkdir -p "${1}/deb-src" mountpoint -q "${1}/deb-src" || \ - mount --bind "${DEBSRCDIR}" "${1}/deb-src" + mount -o bind,private "${DEBSRCDIR}" "${1}/deb-src" EOSUDO } @@ -36,7 +36,7 @@ debsrc_undo_mounts() { set -e mkdir -p "${1}/deb-src" mountpoint -q "${1}/deb-src" && \ - umount -l "${1}/deb-src" + umount "${1}/deb-src" rm -rf "${1}/deb-src" EOSUDO } diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 4f774bbc..0a80273f 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -407,19 +407,23 @@ do_rootfs_finalize() { fi mountpoint -q '${ROOTFSDIR}/isar-apt' && \ - umount -l ${ROOTFSDIR}/isar-apt && \ + umount '${ROOTFSDIR}/isar-apt' && \ rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt mountpoint -q '${ROOTFSDIR}/base-apt' && \ - umount -l ${ROOTFSDIR}/base-apt && \ + umount '${ROOTFSDIR}/base-apt' && \ rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt + mountpoint -q '${ROOTFSDIR}/dev/pts' && \ + umount '${ROOTFSDIR}/dev/pts' + mountpoint -q '${ROOTFSDIR}/dev/shm' && \ + umount '${ROOTFSDIR}/dev/shm' mountpoint -q '${ROOTFSDIR}/dev' && \ - umount -l ${ROOTFSDIR}/dev + umount '${ROOTFSDIR}/dev' mountpoint -q '${ROOTFSDIR}/proc' && \ - umount -l ${ROOTFSDIR}/proc + umount '${ROOTFSDIR}/proc' mountpoint -q '${ROOTFSDIR}/sys' && \ - umount -l ${ROOTFSDIR}/sys + umount '${ROOTFSDIR}/sys' if [ -e "${ROOTFSDIR}/etc/apt/sources-list" ]; then mv "${ROOTFSDIR}/etc/apt/sources-list" \ diff --git a/meta/classes/isar-events.bbclass b/meta/classes/isar-events.bbclass index a6ba0a9e..f5061a8b 100644 --- a/meta/classes/isar-events.bbclass +++ b/meta/classes/isar-events.bbclass @@ -55,7 +55,7 @@ python build_completed() { if basepath in line: bb.debug(1, '%s left mounted, unmounting...' % line.split()[1]) subprocess.call( - ["sudo", "umount", "-l", line.split()[1]], + ["sudo", "umount", line.split()[1]], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass index 498fbfd6..2e091e0c 100644 --- a/meta/classes/rootfs.bbclass +++ b/meta/classes/rootfs.bbclass @@ -37,11 +37,11 @@ rootfs_do_mounts() { mountpoint -q '${ROOTFSDIR}/dev' || \ ( mount -o bind,private /dev '${ROOTFSDIR}/dev' && mount -t tmpfs none '${ROOTFSDIR}/dev/shm' && - mount --bind /dev/pts '${ROOTFSDIR}/dev/pts' ) + mount -o bind,private /dev/pts '${ROOTFSDIR}/dev/pts' ) mountpoint -q '${ROOTFSDIR}/proc' || \ mount -t proc none '${ROOTFSDIR}/proc' mountpoint -q '${ROOTFSDIR}/sys' || \ - mount --rbind /sys '${ROOTFSDIR}/sys' + mount -o bind,private /sys '${ROOTFSDIR}/sys' mount --make-rslave '${ROOTFSDIR}/sys' # Mount isar-apt if the directory does not exist or if it is empty @@ -51,7 +51,7 @@ rootfs_do_mounts() { then mkdir -p '${ROOTFSDIR}/isar-apt' mountpoint -q '${ROOTFSDIR}/isar-apt' || \ - mount --bind '${REPO_ISAR_DIR}/${DISTRO}' '${ROOTFSDIR}/isar-apt' + mount -o bind,private '${REPO_ISAR_DIR}/${DISTRO}' '${ROOTFSDIR}/isar-apt' fi # Mount base-apt if 'ISAR_USE_CACHED_BASE_REPO' is set @@ -59,7 +59,7 @@ rootfs_do_mounts() { then mkdir -p '${ROOTFSDIR}/base-apt' mountpoint -q '${ROOTFSDIR}/base-apt' || \ - mount --bind '${REPO_BASE_DIR}' '${ROOTFSDIR}/base-apt' + mount -o bind,private '${REPO_BASE_DIR}' '${ROOTFSDIR}/base-apt' fi EOSUDO @@ -360,7 +360,7 @@ rootfs_install_sstate_prepare() { # tar --one-file-system will cross bind-mounts to the same filesystem, # so we use some mount magic to prevent that mkdir -p ${WORKDIR}/mnt/rootfs - sudo mount --bind ${WORKDIR}/rootfs ${WORKDIR}/mnt/rootfs -o ro + sudo mount -o bind,private '${WORKDIR}/rootfs' '${WORKDIR}/mnt/rootfs' -o ro lopts="--one-file-system --exclude=var/cache/apt/archives" sudo tar -C ${WORKDIR}/mnt -cpSf rootfs.tar $lopts ${SSTATE_TAR_ATTR_FLAGS} rootfs sudo umount ${WORKDIR}/mnt/rootfs diff --git a/meta/classes/sbuild.bbclass b/meta/classes/sbuild.bbclass index f1193c20..9c268281 100644 --- a/meta/classes/sbuild.bbclass +++ b/meta/classes/sbuild.bbclass @@ -40,14 +40,14 @@ EOF cp -rf "${SCHROOT_CONF}/sbuild" "${SBUILD_CONF_DIR}" sbuild_fstab="${SBUILD_CONF_DIR}/fstab" - fstab_baseapt="${REPO_BASE_DIR} /base-apt none rw,bind 0 0" + fstab_baseapt="${REPO_BASE_DIR} /base-apt none rw,bind,private 0 0" grep -qxF "${fstab_baseapt}" ${sbuild_fstab} || echo "${fstab_baseapt}" >> ${sbuild_fstab} - fstab_pkgdir="${WORKDIR} /home/builder/${PN} none rw,bind 0 0" + fstab_pkgdir="${WORKDIR} /home/builder/${PN} none rw,bind,private 0 0" grep -qxF "${fstab_pkgdir}" ${sbuild_fstab} || echo "${fstab_pkgdir}" >> ${sbuild_fstab} if [ -d ${DL_DIR} ]; then - fstab_downloads="${DL_DIR} /downloads none rw,bind 0 0" + fstab_downloads="${DL_DIR} /downloads none rw,bind,private 0 0" grep -qxF "${fstab_downloads}" ${sbuild_fstab} || echo "${fstab_downloads}" >> ${sbuild_fstab} fi EOSUDO @@ -98,7 +98,7 @@ insert_mounts() { sudo -s <<'EOSUDO' set -e for mp in ${SCHROOT_MOUNTS}; do - FSTAB_LINE="${mp%%:*} ${mp#*:} none rw,bind 0 0" + FSTAB_LINE="${mp%%:*} ${mp#*:} none rw,bind,private 0 0" grep -qxF "${FSTAB_LINE}" ${SBUILD_CONF_DIR}/fstab || \ echo "${FSTAB_LINE}" >> ${SBUILD_CONF_DIR}/fstab done @@ -109,7 +109,7 @@ remove_mounts() { sudo -s <<'EOSUDO' set -e for mp in ${SCHROOT_MOUNTS}; do - FSTAB_LINE="${mp%%:*} ${mp#*:} none rw,bind 0 0" + FSTAB_LINE="${mp%%:*} ${mp#*:} none rw,bind,private 0 0" sed -i "\|${FSTAB_LINE}|d" ${SBUILD_CONF_DIR}/fstab done EOSUDO @@ -122,7 +122,7 @@ schroot_configure_ccache() { sbuild_fstab="${SBUILD_CONF_DIR}/fstab" - fstab_ccachedir="${CCACHE_DIR} /ccache none rw,bind 0 0" + fstab_ccachedir="${CCACHE_DIR} /ccache none rw,bind,private 0 0" grep -qxF "${fstab_ccachedir}" ${sbuild_fstab} || echo "${fstab_ccachedir}" >> ${sbuild_fstab} (flock 9 diff --git a/meta/classes/sdk.bbclass b/meta/classes/sdk.bbclass index 71db6f3a..754fd4cd 100644 --- a/meta/classes/sdk.bbclass +++ b/meta/classes/sdk.bbclass @@ -92,9 +92,16 @@ sdkchroot_configscript () { ROOTFS_POSTPROCESS_COMMAND:append:class-sdk = " sdkchroot_finalize" sdkchroot_finalize() { - sudo umount -R ${ROOTFSDIR}/dev || true - sudo umount ${ROOTFSDIR}/proc || true - sudo umount -R ${ROOTFSDIR}/sys || true + mountpoint -q "${ROOTFSDIR}/dev/pts" && \ + sudo umount "${ROOTFSDIR}/dev/pts" + mountpoint -q "${ROOTFSDIR}/dev/shm" && \ + sudo umount "${ROOTFSDIR}/dev/shm" + mountpoint -q "${ROOTFSDIR}/dev" && \ + sudo umount "${ROOTFSDIR}/dev" + mountpoint -q "${ROOTFSDIR}/proc" && \ + sudo umount "${ROOTFSDIR}/proc" + mountpoint -q "${ROOTFSDIR}/sys" && \ + sudo umount "${ROOTFSDIR}/sys" # Remove setup scripts sudo rm -f ${ROOTFSDIR}/chroot-setup.sh ${ROOTFSDIR}/configscript.sh diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index faf22a50..6bc667e7 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -341,7 +341,7 @@ do_bootstrap() { echo "deb-src ${line}" >> "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list" mkdir -p ${ROOTFSDIR}/base-apt - mount --bind ${REPO_BASE_DIR} ${ROOTFSDIR}/base-apt + mount -o bind,private "${REPO_BASE_DIR}" "${ROOTFSDIR}/base-apt" else install -v -m644 "${APTSRCS}" \ "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" @@ -378,10 +378,10 @@ do_bootstrap() { # update APT mount -o bind,private /dev ${ROOTFSDIR}/dev - mount --bind /dev/pts ${ROOTFSDIR}/dev/pts + mount -o bind,private /dev/pts "${ROOTFSDIR}/dev/pts" mount -t tmpfs none "${ROOTFSDIR}/dev/shm" mount -t proc none ${ROOTFSDIR}/proc - mount --rbind /sys ${ROOTFSDIR}/sys + mount -o bind,private /sys "${ROOTFSDIR}/sys" mount --make-rslave ${ROOTFSDIR}/sys export DEBIAN_FRONTEND=noninteractive @@ -400,12 +400,13 @@ do_bootstrap() { chroot "${ROOTFSDIR}" /usr/bin/apt-get dist-upgrade -y \ -o Debug::pkgProblemResolver=yes - umount -l "${ROOTFSDIR}/dev/shm" - umount -l "${ROOTFSDIR}/dev/pts" - umount -l "${ROOTFSDIR}/dev" - umount -l "${ROOTFSDIR}/proc" - umount -l "${ROOTFSDIR}/sys" - umount -l "${ROOTFSDIR}/base-apt" || true + umount "${ROOTFSDIR}/dev/shm" + umount "${ROOTFSDIR}/dev/pts" + umount "${ROOTFSDIR}/dev" + umount "${ROOTFSDIR}/proc" + umount "${ROOTFSDIR}/sys" + mountpoint -q "${ROOTFSDIR}/base-apt" && \ + umount "${ROOTFSDIR}/base-apt" # Finalize debootstrap by setting the link in deploy ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}" diff --git a/meta/recipes-devtools/sdk-files/files/README.sdk b/meta/recipes-devtools/sdk-files/files/README.sdk index 3e06d8c5..29c09950 100644 --- a/meta/recipes-devtools/sdk-files/files/README.sdk +++ b/meta/recipes-devtools/sdk-files/files/README.sdk @@ -29,7 +29,7 @@ $ sudo /mount_chroot.sh Bind-mount the project into the rootfs: -$ sudo mount -o bind /path/to/project /mnt +$ sudo mount -o bind,private /path/to/project /mnt If you have relocated the SDK previously for using option 1, you need to call this next: diff --git a/scripts/mount_chroot.sh b/scripts/mount_chroot.sh index e238f1cc..122bb33b 100755 --- a/scripts/mount_chroot.sh +++ b/scripts/mount_chroot.sh @@ -2,7 +2,7 @@ set -e -mount /tmp "$1/tmp" -o bind +mount /tmp "$1/tmp" -o bind,private mount proc "$1/proc" -t proc -o nosuid,noexec,nodev mount sysfs "$1/sys" -t sysfs -o nosuid,noexec,nodev mount devtmpfs "$1/dev" -t devtmpfs -o mode=0755,nosuid