Both 'pkg bootstrap' and 'pkg update' need to have this set to avoid
image builds terminating with an error due to a yes/no prompt.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
I would like to get this change into 14.3 if possible - it works around a confusing error message caused by 'pkg update' attempting to get a yes/no response.
Now that we have images available from both docker.io and ghcr.io, it might also be a good idea to change the FROM statement to one of these options which would allow the example podman command in share/examples/oci/README to work without manual steps to copy a suitable image to local storage and tag it correctly.
Sorry I managed to be in Germany for the week when this landed...
I did some testing and the ASSUME... stuff is no longer needed AFAICT.
pkg bootstrap -yr FreeBSD && pkg update -f
Is this simpler, or does it still sometimes break under some scenarios?
BTW when running this against 14.3-RC1 I needed to add a tiny sleep 3
at the end to accommodate pkg(8) still doing whatever pkg does:
The cleanup will free 32 MiB Deleting files: .......... done Checking integrity... done (0 conflicting) Deinstallation has been requested for the following 1 packages (of 0 packages in the universe): Installed packages to be REMOVED: pkg: 2.1.2 Number of packages to be removed: 1 The operation will free 47 MiB. [6d08abef1cdc] [1/1] Deinstalling pkg-2.1.2... [6d08abef1cdc] [1/1] Deleting files for pkg-2.1.2: .......... done 2025-06-06T14:18:40000326901Z: delete: container not in "stopped" or "created" state (currently "running") error running container: deleting container: exit status 1 Error: building at STEP "RUN pkg clean -ay && pkg delete -fy pkg && rm -rf /var/db/pkg/repos": while running runtime: exit status 1 dch@wintermute /tmp>
I would like to get this change into 14.3 if possible - it works around a confusing error message caused by 'pkg update' attempting to get a yes/no response.
Now that we have images available from both docker.io and ghcr.io, it might also be a good idea to change the FROM statement to one of these options which would allow the example podman command in share/examples/oci/README to work without manual steps to copy a suitable image to local storage and tag it correctly.
For some reason, I believed that pkg bootstrap didn't support a '-y' flag. I'll look into simplifying this and avoid the ugly env var hacks.
I tried 'pkg bootstrap -y ... && pkg update -f' and got a y/N prompt due to an OSVERSION mismatch:
podman build -f ./share/examples/oci/Containerfile.pkg --build-arg=packages=nginx STEP 1/5: FROM ghcr.io/freebsd/freebsd-runtime:14.snap STEP 2/5: ARG packages --> Using cache 50727e205dc5f3ea6f9611d12851fab5d9f8bbc52c7527ca607bbf0d81506d72 --> 50727e205dc5 STEP 3/5: RUN pkg bootstrap -y -r FreeBSD && pkg update -f [6162c01ad01e] Installing pkg-2.2.1... [6162c01ad01e] Extracting pkg-2.2.1: .......... done Bootstrapping pkg from pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/latest, please wait... Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done Updating FreeBSD repository catalogue... [6162c01ad01e] Fetching meta.conf: . done [6162c01ad01e] Fetching data.pkg: .......... done Processing entries: .......... done FreeBSD repository update completed. 36361 packages processed. Updating FreeBSD-kmods repository catalogue... [6162c01ad01e] Fetching meta.conf: . done [6162c01ad01e] Fetching data.pkg: . done Processing entries: ...... done FreeBSD-kmods repository update completed. 53 packages processed. Updating FreeBSD-base repository catalogue... [6162c01ad01e] Fetching meta.conf: . done [6162c01ad01e] Fetching data.pkg: ... done Processing entries: Newer FreeBSD version for package FreeBSD-wpa-man: To ignore this error set IGNORE_OSVERSION=yes - package: 1403503 - running userland: 1403502 Ignore the mismatch and continue? [y/N]: pkg: repository FreeBSD-base contains packages for wrong OS version: FreeBSD:14:amd64Processing entries... Unable to update repository FreeBSD-base Error updating repositories! Error: building at STEP "RUN pkg bootstrap -y -r FreeBSD && pkg update -f": while running runtime: exit status 1