Re: Two notes on poudriere(-devel) vs. modern pkg use by FreeBSD [corrections in note 1 mostly]

From: Mark Millard <marklmi_at_yahoo.com>
Date: Wed, 08 Oct 2025 17:21:52 UTC
[Note 1 was based in part on a dumb mistake. No FreeBSD pkg
configuration change identified for this update to the note,
nor did the original note 1 identify such: more informational.]

On Oct 7, 2025, at 20:30, Mark Millard <marklmi@yahoo.com> wrote:

> Note 0:
> 
> # diff -u5 /usr/local/share/poudriere/common.sh.orig /usr/local/share/poudriere/common.sh
> --- /usr/local/share/poudriere/common.sh.orig 2025-10-07 19:02:47.202576000 -0700
> +++ /usr/local/share/poudriere/common.sh 2025-10-07 16:33:58.460446000 -0700
> @@ -3916,12 +3916,10 @@
>    -exec chflags -fh schg {} +
> chflags -R noschg \
>    "${tomnt:?}${LOCALBASE:-/usr/local}" \
>    "${tomnt:?}${PREFIX:-/usr/local}" \
>    "${tomnt:?}/usr/home" \
> -    "${tomnt:?}/boot/modules" \
> -    "${tomnt:?}/boot/firmware" \
>    "${tomnt:?}/boot"
> if [ -n "${CCACHE_STATIC_PREFIX-}" ] && \
> [ -x "${CCACHE_STATIC_PREFIX}/bin/ccache" ]; then
> # Need to allow ccache-update-links to work.
> chflags noschg \
> 
> I was getting complaints about modules and firmware
> being missing for the above code in jail_start() in
> /usr/local/share/poudriere/common.sh .
> 
> This lead to the removal of the lines. But the
> following boot line would lead to processing modules
> and/or firmware, whichever ones happen to exist (if
> any): -R schg is recursive below the listed roots as
> well. So I do not expect that these specific lines
> are needed.
> 
> 
> Note 1:
> 
> I also set up a test having a modified poudriere-devel
> that created a jail based on use of:
> 
> -C -x ^FreeBSD-set-minimal-jail ^FreeBSD-set-devel ^FreeBSD-set-lib32 ^FreeBSD-src-sys

Those patterns also match the names that end in -dbg
as a suffix. I had not intended that. Instead, for
example:

-C -x ^FreeBSD-set-minimal-jail\$ ^FreeBSD-set-devel\$ ^FreeBSD-set-lib32\$ ^FreeBSD-src-sys\$

The difference is over 600 MiBytes in the jail for
usr/lib/debug/ having been populated unnecessarily
for the purpose.

Another question is if ^FreeBSD-bootloader\$ should also
be in the list to cover some uses of poudriere(-devel)
that might need boot/modules or boot/firmware . Such was
unneeded for my specific test context.

> instead of the way that has been in use since before
> any FreeBSD-set-* existed. (That old code over installs
> into any FreeBSD:1[56]:* jail these days as far as I
> can tell.)
> 
> Note:
> Doing this as I did would mean no support for
> FreeBSD:14:* since it has not been tracking the
> general updates made for 15+ and I did not need
> backward compatibility for what I was testing.
> Technically, no support is the FreeBSD:14:* official
> status, as I understand. Also, making poudriere have
> to deal with two different ways of doing things in
> order to span FreeBSD:14:* has its own set of
> issues.
> End Note.
> 
> I did this testing on both amd64 (443 port-package
> build tested) and on aarch64 (260 port-package
> build tested. The builds did not run into anything
> being missing. (Unfortunately bulk -ca tests take
> days and I do not want to dedicate such machine
> time.)
> 
> My change for the purpose of the test was:
> 
> # diff -u /usr/local/share/poudriere/jail.sh.orig /usr/local/share/poudriere/jail.sh
> --- /usr/local/share/poudriere/jail.sh.orig 2025-10-06 10:19:59.000000000 -0700
> +++ /usr/local/share/poudriere/jail.sh 2025-10-07 16:51:44.842240000 -0700
> @@ -921,22 +921,14 @@
>   enabled: yes
> }
> EOF
> - cat <<EOF > "${JAILMNT}/etc/pkg/FreeBSD2.conf"
> -FreeBSD: {
> -  enabled: no
> -}
> -EOF
> 
> - pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ update
> - # Omit the man/debug/kernel/src and tests packages, unneeded for us.
> - pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ search -qCx '^FreeBSD-.*' | grep -vE -- '-man|-dbg|-kernel-|-tests|-src-' | xargs pkg -o REPOS_DIR="${JAILMNT}/etc/pkg" -r ${JAILMNT}/ install -y
> - pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ search -q '^FreeBSD-src-sys' | xargs pkg -o REPOS_DIR="${JAILMNT}/etc/pkg" -r ${JAILMNT}/ install -y
> + pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ update -rpkgbase
> + pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ install -rpkgbase -y \
> + -C -x ^FreeBSD-set-minimal-jail ^FreeBSD-set-devel ^FreeBSD-set-lib32 ^FreeBSD-src-sys
> if [ -n "${KERNEL}" ]; then
> - pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ install -y FreeBSD-kernel-"${KERNEL}" || \
> + pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ install -rpkgbase -y -C -x ^FreeBSD-kernel-"${KERNEL}" || \
> err 1 "Failed to install FreeBSD-kernel-${KERNEL}"
> fi
> -
> - rm "${JAILMNT}/etc/pkg/FreeBSD2.conf"
> }
> 
> create_jail() {

Corrected --and adding ^FreeBSD-bootloader\$ for illustration:

# diff -u /usr/local/share/poudriere/jail.sh.orig /usr/local/share/poudriere/jail.sh
--- /usr/local/share/poudriere/jail.sh.orig	2025-10-06 10:19:59.000000000 -0700
+++ /usr/local/share/poudriere/jail.sh	2025-10-08 10:01:19.177663000 -0700
@@ -921,22 +921,14 @@
   enabled: yes
 }
 EOF
-	cat <<EOF > "${JAILMNT}/etc/pkg/FreeBSD2.conf"
-FreeBSD: {
-  enabled: no
-}
-EOF
 
-	pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ update
-	# Omit the man/debug/kernel/src and tests packages, unneeded for us.
-	pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ search -qCx '^FreeBSD-.*' | grep -vE -- '-man|-dbg|-kernel-|-tests|-src-' | xargs pkg -o REPOS_DIR="${JAILMNT}/etc/pkg" -r ${JAILMNT}/ install -y
-	pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ search -q '^FreeBSD-src-sys' | xargs pkg -o REPOS_DIR="${JAILMNT}/etc/pkg" -r ${JAILMNT}/ install -y
+	pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ update -rpkgbase
+	pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ install -rpkgbase -y \
+		-C -x ^FreeBSD-set-minimal-jail\$ ^FreeBSD-set-devel\$ ^FreeBSD-bootloader\$ ^FreeBSD-set-lib32\$ ^FreeBSD-src-sys\$
 	if [ -n "${KERNEL}" ]; then
-		pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ install -y FreeBSD-kernel-"${KERNEL}" || \
+		pkg -o IGNORE_OSVERSION=yes -o REPOS_DIR="${JAILMNT}/etc/pkg" -o ABI="FreeBSD:${VERSION}:${ARCH}" -r ${JAILMNT}/ install -rpkgbase -y -C -x ^FreeBSD-kernel-"${KERNEL}" || \
 			err 1 "Failed to install FreeBSD-kernel-${KERNEL}"
 	fi
-
-	rm "${JAILMNT}/etc/pkg/FreeBSD2.conf"
 }
 
 create_jail() {


> The existing code seemed to:
> 
> ) not cover "FreeBSD-ports:" and "FreeBSD-ports-kmods:" as
>   additions to the historical "FreeBSD:" alternative. I used
>   -rpkgbase to to avoid such (and any other repositories).
>   This should have been good enough for the test, even if
>   overall it is too restrictive to be in a poudriere-devel
>   release.
> 
> ) not use any FreeBSD-set-* to advantage. (This is what I was
>   trying to explore.) I ended up avoiding xargs style usage
>   and I followed my same notations for the
>   FreeBSD-kernel-"${KERNEL}" as well, not that I tested having
>   a kernel involved, however. I did not attempt FreeBSD:14:*
>   compatibility.
> 
> The test does suggest that, ignoring FreeBSD:14:* ,
> 
> -C -x ^FreeBSD-set-minimal-jail ^FreeBSD-set-devel ^FreeBSD-set-lib32 ^FreeBSD-src-sys
> 
> has a chance of being the basis for something viable
> for populating poudriere(-devel) jails.




===
Mark Millard
marklmi at yahoo.com