Re: pkg-repositories(8) and the --rootdir option of pkg(8)

From: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 16 Mar 2026 02:54:48 UTC
On 3/15/26 17:46, Graham Perrin wrote:
> pkg version 2.6.2. 
> 
> Below, I half-expected the second use of pkg to show 
> base_latest (not base_release_0) in the url.
> 
> What am I missing? 
> 
> Thanks
> 
> 
> root@clean:~ # bectl list -c creation
> BE        Active Mountpoint Space Created
> default   NR     /          11.7G 2025-10-07 04:15
> stable-15 -      /tmp/up    483M  2026-03-15 23:31
> root@clean:~ # pkg repos FreeBSD-base
> FreeBSD-base: { 
>     url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:amd64/
> base_release_0",
>     enabled         : yes,
>     priority        : 0,
>     mirror_type     : "SRV",
>     signature_type  : "FINGERPRINTS",
>     fingerprints    : "/usr/share/keys/pkgbase-15"
>   }
> root@clean:~ # pkg -r /tmp/up repos FreeBSD-base

QUOTE (of man pkg output)
     -c ⟨chroot path⟩, --chroot ⟨chroot path⟩
             pkg will chroot in the ⟨chroot path⟩ environment.

     -r ⟨root directory⟩, --rootdir ⟨root directory⟩
             pkg will install all packages within the specified ⟨root
             directory⟩.
END QUOTE

--rootdir says nothing about anything except where packages are
installed, not where url specifications come from, nor about other files
generated/updated that would have meta data about the install.

--chroot uses the chroot environment instead of the original
environment. There could be different files with different content in
that chroot environment, files that would indicate a different url. But
more then that (such as other files generated/updated) would then be
internal to the chroot enviroment instead of being in the original
environment.

It might be that you were after --chroot instead?

> FreeBSD-base: { 
>     url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:amd64/
> base_release_0",
>     enabled         : yes,
>     priority        : 0,
>     mirror_type     : "SRV",
>     signature_type  : "FINGERPRINTS",
>     fingerprints    : "/usr/share/keys/pkgbase-15"
>   }
> root@clean:~ # grep -A 2 FreeBSD-base /tmp/up/usr/local/etc/pkg/repos/
> FreeBSD.conf
> FreeBSD-base {
>     enabled = yes;
>     url = "pkg+https://pkg.freebsd.org/${ABI}/base_latest";
> root@clean:~ # 
> 


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