pkg icon indicating copy to clipboard operation
pkg copied to clipboard

pkg bootstrap chooses ABI/OSVERSION of host, not specified ABI & OSVERSION when installing into an empty directory

Open dch opened this issue 2 months ago • 1 comments

use case

  • user is targeting either future jail, or empty boot env

context

Previously it was possible to bootstrap a FreeBSD system by unpacking base.txz into a directory and then pkg(8) would figure out what ABI/OSVERSION was being targeted when it bootstrapped inside the chroot/rootdir/jail. If dist sets are not going to be provided, an alternative needs to be found.

example

  • pkg bootstrap -f should install the requested ABI/OSVERSION into the root dir
$ mkdir /tmp/foo && cd /tmp/foo
$ uname -a
FreeBSD wintermute 15.0-ALPHA4 FreeBSD 15.0-ALPHA4 stable/15-n280351-b15ef791f91f GENERIC amd64
## attempt to bootstrap into empty directory
$  env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg \
                              -o ABI=FreeBSD:14:aarch64 \
                              -o OSVERSION=1403000 \
                              -o AUTOCLEAN=yes \
                              -o INSTALL_AS_USER=yes \
                              -r FreeBSD-ports \
                              --rootdir . \
                              bootstrap -f
pkg: Warning: Major OS version upgrade detected.  Running "pkg bootstrap -f" recommended
pkg(8) is already installed. Forcing reinstallation through pkg(7).
Bootstrapping pkg from pkg+https://pkg.FreeBSD.org/FreeBSD:15:amd64/latest, please wait...
^C
  • but instead we get the ABI/OSVERSION from the host

partial workaround

  • pre-copy certs & FreeBSD-*.conf pkg repo files
  • use pkg install ... as this will respect ABI/OSVERSION

But with rootdir ... it will still attempt some operations on the host, not inside.

Some more notes & experiments at https://docs.skunkwerks.at/s/zG3lEhtP_#

dch avatar Oct 02 '25 13:10 dch

If you have a FreeBSD 14.x jail on a FreeBSD 15.x host you can use pkg -j <jail> install pkg from the host which does honor the ABI and OSVERSION. Package base needs more polishing and documentation.

Crest avatar Oct 07 '25 10:10 Crest