Re: /etc/pkg/FreeBSD.conf and /usr/local/etc/pkg/FreeBSD.conf (not repo names)

From: Tomoaki AOKI <junchoon_at_dec.sakura.ne.jp>
Date: Sat, 23 Aug 2025 13:38:19 UTC
On Sat, 23 Aug 2025 15:04:05 +0200
Michael Gmelin <grembo@freebsd.org> wrote:

> 
> 
> > On 23. Aug 2025, at 14:39, Tomoaki AOKI <junchoon@dec.sakura.ne.jp> wrote:
> > 
> > On Sat, 23 Aug 2025 11:40:27 +0100
> > Graham Perrin <grahamperrin@gmail.com> wrote:
> > 
> >>> On 23/08/2025 10:28, Tomoaki AOKI wrote:
> >>> … /etc/pkg is described as "default configuration for the package
> >>> manager, pkg(8)".
> >> 
> >> 
> >> Indeed, and pkg(8) is _not_ base, so what's described is not consistent 
> >> with /etc/ for base system software configuration files.
> >> 
> >> <https://man.freebsd.org/cgi/man.cgi?query=intro&sektion=5&manpath=freebsd-current#FILES>
> >> 
> >> A single repo e.g. FreeBSD-ports in /etc/pkg/FreeBSD.conf is used by pkg 
> >> (7, not 8) for bootstrap.
> >> 
> >> Then:
> >> 
> >> - /etc/pkg.conf does not exist
> >> 
> >> - /usr/local/etc/pkg.conf is explicitly the system-wide configuration 
> >> file for pkg(8).
> >> 
> >> So, I might expect /usr/local/etc/pkg/repos/FreeBSD.conf to be the 
> >> system-wide〓FreeBSD repository configuration file for pkg(8).
> >> 
> >> <https://man.freebsd.org/cgi/man.cgi?query=pkg.conf&sektion=5&manpath=freebsd-ports#OPTIONS> 
> >> REPOS_DIR does have the default list of two directories to search.
> >> 
> >> When I first saw pkgbasify write a FreeBSD-base configuration to 
> >> /usr/local/etc/pkg/repos/ I thought that the path was, somehow, unexpected.
> > 
> > I think it should be a fatal mistake and should be in under /etc,
> > not under /usr/local/etc. If it is still as such, it should be fixed
> > before any release primarily use PkgBase for installs/updates.
> > Maybe at 15.0?
> > 
> > 
> >> After looking at intro(5) and hier(7), /usr/local/etc/pkg/repos/ seems 
> >> proper (a change of mind).
> > 
> > Again, I think /usr/local/etc/pkg should be the place for
> > local ones, anything not updated on PkgBase, bsdinstall nor
> > freebsd-update. Anything possibly updated by them should be in
> > under /etc.
> > 
> > What allowed to be created and/or edited by admins in /etc
> > should better limited to anything essential for boot.
> > fstab, rc.conf, firewall configs and so on that any of boot process
> > (including rc scripts in /etc/rc.conf.d) requires.
> > 
> > 
> >> <https://reviews.freebsd.org/D51594> for pkgbasify in base 〓 without 
> >> pkg(8) in base 〓 will probably change my mind, again.
> > 
> > I think pkg is quite irregular corner case.
> > Indeed, it SHALL be the part of base, but as it is still under active
> > developement, need to be in ports "until the spec prolerly fixed up".
> > So exists /usr/sbin/pkg for bootstrapping.
> > 
> > If pkg is NOT an irregular corner case, why ALL ports are NOT forced
> > to have corresponding bootstraps in base?
> > 
> > And IMHO, PkgBase SHALL NOT BE ALLOWED unless pkg is considered
> > as the part of base, even though actual part is "currently" placed
> > in ports tree.
> > 
> > "PkgBase is coming to true.", I believe this is why configs for pkg
> > is placed under /etc, not /usr/local/etc.
> > 
> > -- 
> > Tomoaki AOKI    <junchoon@dec.sakura.ne.jp>
> > 
> 
> In an ideal world, pkg would be in base, its default config would be /etc/defaults/pkg.conf, users could override in /etc/pkg.conf and/or /etc/pkg.d/*.conf
> 
> But there’s history and making progress sometimes comes with compromises.
> 
> -m

IMHO, actual (non-bootstrap) pkg is in ports because it's still under
more active developement than others in base.

And as in some cases, users of *-Release wants latest instead of
quarterly (OTOH, there seem to be some want to use quarterly on stable
or main, usually forced to do so as of device compatibilities),
if placing defaults under /etc/defaults/, it would be better placing
all 3 templates in /usr/src/usr.sbin/pkg/ (latest, quarterly,
quarterly-release) under /etc/defaults/pkg/ and symlink (or copy) to
default one as /etc/FreeBSD.conf.

Regards.

-- 
Tomoaki AOKI    <junchoon@dec.sakura.ne.jp>