From nobody Tue Sep 16 20:50:52 2025 X-Original-To: dev-commits-src-all@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 4cRDZN5h7rz682xT; Tue, 16 Sep 2025 20:50:52 +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 4cRDZN44kxz3VTY; Tue, 16 Sep 2025 20:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758055852; 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=lt2yq2ZWFORBpFk5zp8JbmAK5qtENQ/CPVyt8XAvMdQ=; b=tUzJ0yAX/s31qhU1piXGFIBExCmBHIj8fTbxzHehEPwI/vE4rVnSUIHmO/aCb5vxqObmAc rb5SudSSTSVZtlriKLs9FO4UnMScmow+Nh7UEXM4rnQXvWyeOuNtMdI4ZDcANWcjcqZL4M wDehPzguGqZo+WHidqp9q69+FEejKrWW5ts/INh6QQnZ7IlTwFdscN+hlriS5CIsazV1ru ackB0Aopqu7X5+wUL2AFmK41/9Sbyqyj5G0YlFlH7ORgGyFLkF8Zx0zChK0woP9g0t4hQa HwgXhAlX6L121LLkYgh45Of6p1VmtsRpGrfDjL5ki1BJKqS+W8Rl/2w8KYvkug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758055852; 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=lt2yq2ZWFORBpFk5zp8JbmAK5qtENQ/CPVyt8XAvMdQ=; b=hHgXsbIG5nNEN1uV5ESufcfOzWsmnDWkGpVQX48q/xzZd1QzY9fyGsLe8oz6DhY7ghqjT3 a7kMlO+Hj9wVL0pgNlsmZs90E73hYByZY2jtOGEYnHPOfl3DHsqN5dEfRwk3PB802tb/dY WFvpV+Vgh57mLrrmNowDli0wQhrGy4f/D6H5GNUee4Xu2vQKiy2sV2gjpaCxYVz9mw9Q3k JyTyJEE/1bzSTy9gcbzoyKYWmRrRu7xymo2V+WA33AdQELoCk5/8P3KJqfBYA2Z9GPx8+r S/0xrNQdtVYXUayUqADXaidIV8DdzRcmQDk5X7OUWA9ck/zaayep/1GeYhksiA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758055852; a=rsa-sha256; cv=none; b=eDVRxbIzfzBT1cApo+kxb80NuOz89o2Actjsno9WjvmHFkSfysF7MbAm9DvfhGH9fIZuWQ 0a9nBKefwohu4OrHiZ/x/R2kMW+bYy0r06y5M9mCWZShDjdDV9bh7yIq4A15FeqNLZkJP6 8sbh0xDH0ERt47fRMPsYwwGLsPJWRQuMY8JxfW+sRNXEiJKw8j12j7D4RE4A+p5pWPVVZt 8zbkvK3jdRfKUhLDYDqFroAIIRKlKWTTEgg9Z59bbkzINDklHRSoZr1sP6xrYpUxxyVF0G vE+d4tWGH4HcO2Xh16hlY5VrqOiIwpm5hP+7/DhUb+4afkYWblyiVJiSkoQUng== 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 4cRDZN3hCczwpW; Tue, 16 Sep 2025 20:50:52 +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 58GKoqq0046307; Tue, 16 Sep 2025 20:50:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58GKoqwA046304; Tue, 16 Sep 2025 20:50:52 GMT (envelope-from git) Date: Tue, 16 Sep 2025 20:50:52 GMT Message-Id: <202509162050.58GKoqwA046304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 8027de008d9f - main - release: Prepare EC2 cloudware images to be buildable as non-root List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8027de008d9f3c5cd5509d586f14846abd0f3db2 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8027de008d9f3c5cd5509d586f14846abd0f3db2 commit 8027de008d9f3c5cd5509d586f14846abd0f3db2 Author: Mark Johnston AuthorDate: 2025-09-16 16:53:35 +0000 Commit: Mark Johnston CommitDate: 2025-09-16 20:50:33 +0000 release: Prepare EC2 cloudware images to be buildable as non-root - Avoid chrooting to uninstall pkg, as it will not be installed in the first place when in non-root mode. - Add metalog entries. Reviewed by: cperciva MFC after: 3 days Sponsored by: The FreeBSD Foundation Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D52452 --- release/tools/ec2-base.conf | 1 + release/tools/ec2-builder.conf | 5 +++++ release/tools/ec2-cloud-init.conf | 1 + release/tools/ec2-small.conf | 1 + release/tools/ec2.conf | 31 ++++++++++++++++++++----------- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/release/tools/ec2-base.conf b/release/tools/ec2-base.conf index 3ed20474a4e8..b6354db3d9d1 100644 --- a/release/tools/ec2-base.conf +++ b/release/tools/ec2-base.conf @@ -28,6 +28,7 @@ vm_extra_pre_umount() { # be "new" disks; there is no "previous boot" when they might have # been seen and used already. touch ${DESTDIR}/var/db/ec2_ephemeral_diskseen + metalog_add_data ./var/db/ec2_ephemeral_diskseen # Configuration common to all EC2 AMIs ec2_common diff --git a/release/tools/ec2-builder.conf b/release/tools/ec2-builder.conf index 7927fc13a74d..993dffc565eb 100644 --- a/release/tools/ec2-builder.conf +++ b/release/tools/ec2-builder.conf @@ -28,6 +28,7 @@ vm_extra_pre_umount() { # be "new" disks; there is no "previous boot" when they might have # been seen and used already. touch ${DESTDIR}/var/db/ec2_ephemeral_diskseen + metalog_add_data ./var/db/ec2_ephemeral_diskseen # Configuration common to all EC2 AMIs ec2_common @@ -37,21 +38,25 @@ vm_extra_pre_umount() { # Grab a copy of the ec2-base disk image, and compress it zstd < ${EC2BASEIMG} > ${DESTDIR}/image.zst + metalog_add_data ./image.zst # Disable fortune so we don't have extra noise at login chmod a-x ${DESTDIR}/usr/bin/fortune # Install the AMI-building script install -m 755 ${WORLDDIR}/release/tools/mkami.sh ${DESTDIR}/bin/mkami + metalog_add_data ./bin/mkami 0755 # Install an /etc/rc which juggles disks around for us install -m 755 ${WORLDDIR}/release/tools/rc.amibuilder ${DESTDIR}/etc + metalog_add_data ./etc/rc.amibuilder 0755 # We want to mount from the UFS disk and juggle disks first cat >> ${DESTDIR}/boot/loader.conf <<-EOF vfs.root.mountfrom="ufs:/dev/gpt/rootfs" init_script="/etc/rc.amibuilder" EOF + metalog_add_data ./boot/loader.conf return 0 } diff --git a/release/tools/ec2-cloud-init.conf b/release/tools/ec2-cloud-init.conf index 048202e252f6..2a15ae5c57d8 100644 --- a/release/tools/ec2-cloud-init.conf +++ b/release/tools/ec2-cloud-init.conf @@ -27,6 +27,7 @@ vm_extra_pre_umount() { doas: - permit nopass ec2-user EOF + metalog_add_data ./usr/local/etc/cloud/cloud.cfg.d/98_ec2.cfg return 0 } diff --git a/release/tools/ec2-small.conf b/release/tools/ec2-small.conf index 858836717f5a..e2a348d6ba8f 100644 --- a/release/tools/ec2-small.conf +++ b/release/tools/ec2-small.conf @@ -33,6 +33,7 @@ vm_extra_pre_umount() { # be "new" disks; there is no "previous boot" when they might have # been seen and used already. touch ${DESTDIR}/var/db/ec2_ephemeral_diskseen + metalog_add_data ./var/db/ec2_ephemeral_diskseen # Configuration common to all EC2 AMIs ec2_common diff --git a/release/tools/ec2.conf b/release/tools/ec2.conf index 704a8f3f0073..335db6cca93a 100644 --- a/release/tools/ec2.conf +++ b/release/tools/ec2.conf @@ -22,17 +22,27 @@ export NOSWAP=YES ec2_common() { # Delete the pkg package and the repo database; they will likely be - # long out of date before the EC2 instance is launched. - mount -t devfs devfs ${DESTDIR}/dev - chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \ - /usr/sbin/pkg delete -f -y pkg - umount ${DESTDIR}/dev - rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports - rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports-kmods + # long out of date before the EC2 instance is launched. In + # unprivileged builds this is unnecessary as pkg will not be + # installed to begin with. + if [ -z "${NO_ROOT}" ]; then + mount -t devfs devfs ${DESTDIR}/dev + chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \ + /usr/sbin/pkg delete -f -y pkg + umount ${DESTDIR}/dev + rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports + rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports-kmods + fi # Turn off IPv6 Duplicate Address Detection; the EC2 networking # configuration makes it unnecessary. echo 'net.inet6.ip6.dad_count=0' >> ${DESTDIR}/etc/sysctl.conf + metalog_add_data ./etc/sysctl.conf + + # Tell gptboot not to wait 3 seconds for a keypress which will + # never arrive. + printf -- "-n\n" > ${DESTDIR}/boot.config + metalog_add_data ./boot.config # Booting quickly is more important than giving users a chance to # access the boot loader via the serial port. @@ -43,10 +53,6 @@ ec2_common() { # default 2048 bytes of entropy; ask for 64 bytes instead. echo 'entropy_efi_seed_size="64"' >> ${DESTDIR}/boot/loader.conf - # Tell gptboot not to wait 3 seconds for a keypress which will - # never arrive. - printf -- "-n\n" > ${DESTDIR}/boot.config - # The emulated keyboard attached to EC2 instances is inaccessible to # users, and there is no mouse attached at all; disable to keyboard # and the keyboard controller (to which the mouse would attach, if @@ -93,6 +99,7 @@ ec2_common() { # by pressing the "Attention button" a second time, but in the EC2 # environment this delay serves no purpose. echo 'hw.pci.pcie_hp_detach_timeout="0"' >> ${DESTDIR}/boot/loader.conf + metalog_add_data ./boot/loader.conf # Disable KbdInteractiveAuthentication according to EC2 requirements. sed -i '' -e \ @@ -127,6 +134,7 @@ REGION=`fetch -qo- http://169.254.169.254/latest/meta-data/placement/availabilit echo "-nfsv4,minorversion=1,oneopenown ${FS}.efs.${REGION}.amazonaws.com:/" EOF chmod 755 ${DESTDIR}/etc/autofs/special_efs + metalog_add_data ./etc/autofs/special_efs 0755 return 0 } @@ -154,6 +162,7 @@ ec2_base_networking () { /usr/local/sbin/dhclient -6 -nw -N -cf /dev/null $1 EOF chmod 755 ${DESTDIR}/usr/local/libexec/rtsold-M + metalog_add_data ./usr/local/libexec/rtsold-M 0755 return 0 }