Re: How to do the equivalent of "pkg clean" for the likes of: /usr/local/poudriere/jails/official-aarch64/var/cache/pkg/FreeBSD-* [poudriere vs. pkg issue?]

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sat, 09 May 2026 03:34:34 UTC
On 5/8/26 17:35, Mark Millard wrote:
> I'm not sure if this would be considered a poudriere usage s. a pkg
> usage issue for where to submit.
> 
> My poudriere jail updates are not cleaning out prior:
> 
> /usr/local/poudriere/jails/*/var/cache/pkg/FreeBSD-*
> 
> files after updates. For example my "official-aarch64" poudriere jail
> now shows over 1600 files:
> 
> # ls -dC1
> /usr/local/poudriere/jails/official-aarch64/var/cache/pkg/FreeBSD-* | wc -l
>     1682
> 
> and spans a history of 6 snapshots:
> 
> # ls -dC1t \
> /usr/local/poudriere/jails/official-aarch64/var/cache/pkg/FreeBSD-*~* \
> | sed -e 's@^.*\(/FreeBSD-.*\)-15\.snap.*~.*$@\1@' \
> | sort \
> | uniq -c \
> | sort -rn \
> | head
>    6 /FreeBSD-utilities-lib32
>    6 /FreeBSD-utilities
>    6 /FreeBSD-toolchain
>    6 /FreeBSD-src-sys
>    6 /FreeBSD-runtime-lib32
>    6 /FreeBSD-runtime
>    6 /FreeBSD-kernel-man
>    6 /FreeBSD-geom
>    6 /FreeBSD-clibs-dev
>    6 /FreeBSD-bsnmp
> 
> 


I found a way based on disabling FreeBSD-ports and FreeBSD-ports-kmods
(and redundantly FreeBSD-base) and have just poudriere-devel's pkgbase
enabled in a way that avoids /usr/local/* use. An example follows:

/usr/local/poudriere/jails/release15p1-aarch64/etc/pkg/FreeBSD.conf left
as it normally is.

# cat \
/usr/local/poudriere/jails/release15p1-aarch64/etc/pkg/pkgbase.conf
pkgbase: {
  url: "https://pkg.freebsd.org/FreeBSD:15:aarch64/base_release_1"
  mirror_type: "none"
  enabled: yes
}

(That is an example of a normal pkgbase.conf file for poudriere jails.)

I controlled the enables for the purpose separately:

# cat \
/usr/local/poudriere/jails/release15p1-aarch64/etc/pkg/pkgbase9999.conf
FreeBSD-ports: {
  enabled: no
}
FreeBSD-ports-kmods: {
  enabled: no
}
FreeBSD-base: {
  enabled: no
}
pkgbase: {
  enabled: yes
}

With that as context:

# pkg-static -c /usr/local/poudriere/jails/release15p1-aarch64/ clean
. . .
Proceed with cleaning the cache? [y/N]:y
Deleting files: 100%

does work.

Then remove the:

/usr/local/poudriere/jails/release15p1-aarch64/etc/pkg/pkgbase9999.conf

file to avoid overriding poudiere-devel in normal operation.

(These notes ignore FreeBSD 14's pkgbase and its older style repo naming.)

The above does presume that the jail is not otherwise in use during the
activity. pkg v2.7.5 was used for testing.


It looks to me like a somewhat analogus activity could be done by
poudriere-devel at the end of a pkgbase-based jail upgrade.

So I now expect that this is a poudriere-devel issue.


-- 
===
Mark Millard
marklmi at yahoo.com