From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 6313F5A0271 for ; Fri, 22 Mar 2024 03:27:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1711074461; bh=Dto5D1m272D/g0mr4+X6TK8c6AeRDFlrVapubHwiaYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HsiIC8w38p3XOHZjf7R8Ur7auZIYX5QvVha04Tc5KNUr4wORyxZsp1DxxbYv9XxER nPjt2eHQRQgg/mp1vxLCheCL5PZyLbqQFV2hvuFpMzGd/wkUQfHuHxU9ziyO1MGjrI r1KxZ7HiCHnMbINVEvKZDhtr4rG47IXQmFIujRSaR/iVcWffbaqpUI0mU/pMCboNkQ 7dJOshRdbFftlP36xub8Rcli9zrM51Zck5SOPlDpCGS9A1dy9Qr29wHyJs61Nn8BkF Qy3Pqs42EY0Ud8c/elsKTndJNm54uktK+Jp98e6+2eQl8hK2BIhIq6BrrzBnhOeNAY sos6KvctgnPug== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4V15p53MZxz4wx6; Fri, 22 Mar 2024 13:27:41 +1100 (AEDT) From: David Gibson To: Stefano Brivio Subject: [PATCH 2/4] Remove stale archivemount support Date: Fri, 22 Mar 2024 13:27:37 +1100 Message-ID: <20240322022739.2746102-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240322022739.2746102-1-david@gibson.dropbear.id.au> References: <20240322022739.2746102-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: TTDL35FGRJ7YOQMGOZ5ICIPURHTSINMC X-Message-ID-Hash: TTDL35FGRJ7YOQMGOZ5ICIPURHTSINMC X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: lvivier@redhat.com, passt-dev@passt.top, David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: mbuto has two ways of building the initramfs. One is the typical approach of staging its contents in a temporary directory, then building the initramfs with cpio. The other is to create an empty initramfs, mount it with archivemount, and copy things into the mounted archive. However, the archivemount approach is broken. I'm not entirely sure why, but it appears not to properly unmount the archive and retrieve the final. filled version. The upshot is that if archivemount is installed, then mbuto generates an empty, gzip-compressed initramfs instead of whatever it was supposed to. It looks like this has bitrotted from some earlier working version. The archivemount approach is not necessary, and honestly a pretty strange and roundabout way of building the initramfs. Remove it. Reported-by: Laurent Vivier Signed-off-by: David Gibson --- mbuto | 41 +++++------------------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/mbuto b/mbuto index a6f80ab..49d032c 100755 --- a/mbuto +++ b/mbuto @@ -368,7 +368,6 @@ cmd_check() { # cleanup() - Remove left-overs on exit, used from trap cleanup() { - [ -n "${ARCHIVEMOUNT}" ] && "${UMOUNT}" "${wd}" 2>/dev/null "${RM}" -rf "${wd}" [ -n "${pkg_tmp}" ] && "${RM}" -f "${pkg_tmp}" [ -n "${compress_test1}" ] && "${RM}" -f "${compress_test1}" @@ -564,16 +563,6 @@ cpio_init() { else OUT="$("${REALPATH}" "${OUT}")" fi - - if [ -n "${ARCHIVEMOUNT}" ]; then - : | "${CPIO}" --create -H newc --quiet | \ - "${GZIP}" > "${OUT}" - fi - fi - - if [ -n "${ARCHIVEMOUNT}" ]; then - "${ARCHIVEMOUNT}" "${OUT}" "${wd}" - info "Mounted CPIO archive ${OUT} at ${wd}" fi } @@ -1099,26 +1088,17 @@ cmds() { [ "${NOSTRIP}" != "y" ] && strip_all - if [ -z "${ARCHIVEMOUNT}" ]; then - ( __out="$("${REALPATH}" "${OUT}")" - "${CD}" "${wd}" - "${FIND}" . | "${CPIO}" --create -H newc --quiet > "${OUT}" - cpio_compress "${__out}" - ) - else - "${SYNC}" - fi + ( __out="$("${REALPATH}" "${OUT}")" + "${CD}" "${wd}" + "${FIND}" . | "${CPIO}" --create -H newc --quiet > "${OUT}" + cpio_compress "${__out}" + ) stats printf "%s" "${OUTPUT}" | \ sed 's,__INITRD__,'"$("${REALPATH}" "${OUT}")"',g' | \ sed 's,__KERNEL__,/boot/vmlinuz-'"${KERNEL}"',g' - - if [ -n "${ARCHIVEMOUNT}" ]; then - trap - EXIT - notice "initramfs mounted at: ${wd}" - fi } # usage() - Print usage and exit @@ -1271,17 +1251,6 @@ else eval "profile_${PROFILE}" || err "profile ${PROFILE} not found" fi -# Check if we can keep the CPIO mounted for convenience as we exit. This isn't -# safe with fakeroot, as contents can't be touched before the environment -# save-file is loaded again, so it needs root (and archivemount). -if [ "${LD_PRELOAD}" = "libfakeroot-sysv.so" ]; then - if command -v archivemount >/dev/null 2>&1; then - notice "Not running as root, won't keep cpio mounted" - fi -elif ! ARCHIVEMOUNT="$(command -v archivemount)"; then - warn "archivemount not available, won't keep cpio mounted" -fi - trap cleanup EXIT cmds "$@" -- 2.44.0