From nobody Sun Oct 19 16:22:20 2025 X-Original-To: dev-commits-src-main@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 4cqP3J66Tnz6DPtv; Sun, 19 Oct 2025 16:22:20 +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 4cqP3J5QBcz3h8P; Sun, 19 Oct 2025 16:22:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760890940; 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=gHx5hgR0GdaTehXeBg+7+4nJHRdpHz4pz6ozjedLgwQ=; b=lKy+TDSReCN04IGw4TC+JrHAxtjFcH34m+sZscrjY8ARQ9xoazY1Sv9x5Je5ysvgivjm60 6U084slJWlMBvGxEC2s0iOCGyTbDK0HTJIwzJall+vmUh0CN2gjU8USYoTjowEw9MXaXAu 9GIB+cCm0hcyssLlZyS4B4FPhxSG1Pvh3bHVKgAjX+y2w/OEu5Dr7e3+/0rR6yZUMcRvTe L+lsk6jxlbkwAsqPJhsARTxQ8Yo875hyOJPe0c8TbyqNS8TtEg85WFmfiyGgChubKcHMLC KiHVjrNDbIZTRUQWCOXPkZLFjRhaGz2EWNdXdMm7LNqqH3RnVY5mJvW3gr46pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760890940; 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=gHx5hgR0GdaTehXeBg+7+4nJHRdpHz4pz6ozjedLgwQ=; b=Jcdfk3VgxrGPGdU7fTCL3VXOZfpfYcmMCCcmrTU8W5Ojc8rvIh7ZTSeAqmLL663W4qFUGt tNaj4smcoWw9WbaPp7hNN7EwYucSW9Xh75omiTagQB0oBe4mSFASPVlwR34nxerLSaDa6q UVZppNUj9m7Mj1UlmhnHZx8Paeg9ocrgHP2YI/MGbbwfPe+g/wXpTHJk84JlWKLVM+l4/B NV1RUN9/nO6AQtdxd4aCyDUj7Ypgvw0FlZVg6It4PkkVAvJw1FaVdmXdZ9Bh3PbJzipYNe 0vR51o1f3282kme+bSLKUu+QkTug9XVE0x6wkrvwWsWHpM39LwG6/BAZ8R3CCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760890940; a=rsa-sha256; cv=none; b=K8U8FuNvCxhIQJV01LQM6bjPf3tj5m7lLOJYDFOcGjMlbJU1lDCRcP11XhSJqaARw8ieNY Goc74cDUOC0YhLxtr9PdukBiBId8dV0SN6+KjMkGC5YdY13IbtLBN9+C9rdaETf57D0CAG wVHwBvw9oWJwttfjs2Ch0wwUG8qkmTyMOlggso+mlWBEDAnYDdXRj+6D7Ifd4re3Mtnnja RPYq9t7wzps5e6LFesZU+RXeTL10/Xs0zAIvIjlS0spFcE02wCkkbqDaCtK2YACdpnAQfI 7cmhNbTtnrldrdU4D6QKdw0Fyhx1s6LJKpQsFU0ekyM3sOgdXWJ0rVtc4LPXLw== 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 4cqP3J4yNQzb7K; Sun, 19 Oct 2025 16:22:20 +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 59JGMKGK043876; Sun, 19 Oct 2025 16:22:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59JGMKlt043873; Sun, 19 Oct 2025 16:22:20 GMT (envelope-from git) Date: Sun, 19 Oct 2025 16:22:20 GMT Message-Id: <202510191622.59JGMKlt043873@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 012014403bdc - main - vmimage.subr: Fix when/where we fix up METALOG List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 012014403bdcb2b3aa7ed3895079a0059204c35f Auto-Submitted: auto-generated The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=012014403bdcb2b3aa7ed3895079a0059204c35f commit 012014403bdcb2b3aa7ed3895079a0059204c35f Author: Colin Percival AuthorDate: 2025-10-19 00:27:07 +0000 Commit: Colin Percival CommitDate: 2025-10-19 16:21:56 +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 --- 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)