From nobody Wed Oct 22 06:51:00 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cs0Dj1lsfz6Dn6f; Wed, 22 Oct 2025 06:51:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cs0Dj1786z4B19; Wed, 22 Oct 2025 06:51:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761115861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pyDx+FJGNl7C+I90e4jjHPilLfIp3GyBP8XooyNHfSw=; b=f5iovR3Mw21fWyfAFwYZr5CmpJYPGzTm06EhyoQ/PzZuBOT8An1rSfadqciXH6Pkdg7OWf kZYyDzA1WL6Sh6B3rLDs6C3ZiTNH+YnBcF9JZVMfyt++bt10hMryQkDwuRDsmcPryt6omL IJ2nacnnmaZNe6avfM6x8OiD+MK8apUkTFZU/svPDi9TWfD7wRTicMsA4oCM5MDzytnd/7 PHGNP0ipBBCWV4wiVdEyqFNVmB/lH3ogwVG8psefqJ6IQcYtBnB3Ll3fGW7jkYQwWwFpYs 84ZsPi3wey3zfTVTl/rKjnYHFWg4cVFr+qnYTsO4n2ICzvkzGcuJK7MhaXuhTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761115861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pyDx+FJGNl7C+I90e4jjHPilLfIp3GyBP8XooyNHfSw=; b=flpAeU2rc8dHgL14/0r4iTiULT/0kkTES8pIe+Rf+r8w7hzRc0yxGKcLhmHcyp/4x+yL+x exr+/vk99qGq83u/xhNqGWyCYd6+X/981csOlMqltRXFeDwVSL2GgWnAGvrxoybL2y0rvt WTp2JwGx5jWy3KL4UyM45aOJMhpoYhOkOxjkPNa0q7Oh8QrEJ6aYK62TJ5P59rQmC7c+th HIhmVA7F4v8civhkCZDNAm3/U6KmJtMCHDLdhnUUHRzUqsldZScHYD2dEIXWVy125YvoV4 FqXmtsYDOl/vGlxAtOPunBLcKx+kOhgsOIUCjPPleMfTSb8bhOKJtQsSoRIeag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761115861; a=rsa-sha256; cv=none; b=DVwBeDdv4a213SMXtRzxuKV3IjfTTy0ZHlvWyKnGbN66BxB07bc63+UyNwEkZ3A+CGBexT jcERAqqiT9zFvUbIgdZiOQheI2v/Z3ykw5ETqXi3w1CtiLPXOMNUqGkyysjRn9FbHUwSG9 BYjd5mWn3bB46DWG0TwPMzX0kFZsK0SCf65Yy/ujKOllii/vZFc7ZfyP9PvMGWZsPfhcc+ g3SjlHD/9LUNkiMAPT5IWvkh9Eq4SlBRxIv5teQnVX4WXFhJkx/1sKZ/Z0rSS+VbpgOc2P Gc4LgTVBCj32VkP5QK8WvV6QnxgpSymj6f4fG5U6nzUj4H5N1bt96P8m++Rmdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cs0Dj0hFvz34j; Wed, 22 Oct 2025 06:51:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 59M6p07D010169; Wed, 22 Oct 2025 06:51:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59M6p0BY010166; Wed, 22 Oct 2025 06:51:00 GMT (envelope-from git) Date: Wed, 22 Oct 2025 06:51:00 GMT Message-Id: <202510220651.59M6p0BY010166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 962194df8333 - stable/15 - vmimage.subr: Fix when/where we fix up METALOG List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 962194df8333124876a25926244864bd5d2d26d7 Auto-Submitted: auto-generated The branch stable/15 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=962194df8333124876a25926244864bd5d2d26d7 commit 962194df8333124876a25926244864bd5d2d26d7 Author: Colin Percival AuthorDate: 2025-10-19 00:27:07 +0000 Commit: Colin Percival CommitDate: 2025-10-22 06:50:48 +0000 vmimage.subr: Fix when/where we fix up METALOG We only need to check for unMETALOGed directories and sort the METALOG file if we're using it, i.e. if we're doing a NO_ROOT build. This non-NO_ROOT builds by no longer bogusly writing to /METALOG*. We only need to add databases (spwd.db etc) to METALOG if we're doing a pkgbase-enabled NO_ROOT build; but we should always do this before creating the filesystem, not only if we installed extra packages (in vm_extra_install_packages, where that code was erroneously placed). This fixes non-cloud VM images, which in 15.0-BETA2 shipped without password databases. Reviewed by: ivy MFC after: 3 days Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D53194 (cherry picked from commit 012014403bdcb2b3aa7ed3895079a0059204c35f) --- release/tools/vmimage.subr | 66 ++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr index 842a808c623e..99e1936296e1 100644 --- a/release/tools/vmimage.subr +++ b/release/tools/vmimage.subr @@ -213,16 +213,6 @@ vm_extra_install_packages() { install -y -r ${PKG_REPO_NAME} $pkg done metalog_add_data ./var/db/pkg/local.sqlite - - # Add some database files which are created by pkg triggers; - # at some point in the future the tools which create these - # files should probably learn how to record them in METALOG - # (which would simplify no-root installworld as well). - metalog_add_data ./etc/login.conf.db - metalog_add_data ./etc/passwd - metalog_add_data ./etc/pwd.db - metalog_add_data ./etc/spwd.db 600 - metalog_add_data ./var/db/services.db else if [ -n "${WITHOUT_QEMU}" ]; then return 0 @@ -290,28 +280,42 @@ buildfs() { cat ${DESTDIR}/METALOG.pkg >> ${DESTDIR}/METALOG fi - # Check for any directories in the staging tree which weren't - # recorded in METALOG, and record them now. This is a quick hack - # to avoid creating unusable VM images and should go away once - # the bugs which produce such unlogged directories are gone. - grep type=dir ${DESTDIR}/METALOG | - cut -f 1 -d ' ' | - sort -u > ${DESTDIR}/METALOG.dirs - ( cd ${DESTDIR} && find . -type d ) | - sort | - comm -23 - ${DESTDIR}/METALOG.dirs > ${DESTDIR}/METALOG.missingdirs - if [ -s ${DESTDIR}/METALOG.missingdirs ]; then - echo "WARNING: Directories exist but were not in METALOG" - cat ${DESTDIR}/METALOG.missingdirs + if [ -n "${NO_ROOT}" ]; then + # Check for any directories in the staging tree which weren't + # recorded in METALOG, and record them now. This is a quick hack + # to avoid creating unusable VM images and should go away once + # the bugs which produce such unlogged directories are gone. + grep type=dir ${DESTDIR}/METALOG | + cut -f 1 -d ' ' | + sort -u > ${DESTDIR}/METALOG.dirs + ( cd ${DESTDIR} && find . -type d ) | + sort | + comm -23 - ${DESTDIR}/METALOG.dirs > ${DESTDIR}/METALOG.missingdirs + if [ -s ${DESTDIR}/METALOG.missingdirs ]; then + echo "WARNING: Directories exist but were not in METALOG" + cat ${DESTDIR}/METALOG.missingdirs + fi + while read DIR; do + metalog_add_data ${DIR} + done < ${DESTDIR}/METALOG.missingdirs + + if [ -z "${NOPKGBASE}" ]; then + # Add some database files which are created by pkg triggers; + # at some point in the future the tools which create these + # files should probably learn how to record them in METALOG + # (which would simplify no-root installworld as well). + metalog_add_data ./etc/login.conf.db + metalog_add_data ./etc/passwd + metalog_add_data ./etc/pwd.db + metalog_add_data ./etc/spwd.db 600 + metalog_add_data ./var/db/services.db + fi + + # Sort METALOG file; makefs produces directories with 000 permissions + # if their contents are seen before the directories themselves. + env -i LC_COLLATE=C sort -u ${DESTDIR}/METALOG > ${DESTDIR}/METALOG.sorted + mv ${DESTDIR}/METALOG.sorted ${DESTDIR}/METALOG fi - while read DIR; do - metalog_add_data ${DIR} - done < ${DESTDIR}/METALOG.missingdirs - - # Sort METALOG file; makefs produces directories with 000 permissions - # if their contents are seen before the directories themselves. - env -i LC_COLLATE=C sort -u ${DESTDIR}/METALOG > ${DESTDIR}/METALOG.sorted - mv ${DESTDIR}/METALOG.sorted ${DESTDIR}/METALOG case "${VMFS}" in ufs)