Page MenuHomeFreeBSD

release: Make sure 'pkg update' is run with ASSUME_ALWAYS_YES set
ClosedPublic

Authored by dfr on May 29 2025, 11:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jul 26, 12:59 PM
Unknown Object (File)
Sat, Jul 26, 9:16 AM
Unknown Object (File)
Tue, Jul 22, 11:22 AM
Unknown Object (File)
Mon, Jul 7, 6:31 PM
Unknown Object (File)
Jun 27 2025, 10:57 AM
Unknown Object (File)
Jun 27 2025, 1:57 AM
Unknown Object (File)
Jun 19 2025, 5:27 AM
Unknown Object (File)
Jun 19 2025, 5:22 AM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dfr requested review of this revision.May 29 2025, 11:11 AM

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.

dch requested changes to this revision.Jun 6 2025, 2:14 PM

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?

This revision now requires changes to proceed.Jun 6 2025, 2:14 PM

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>

Rebase, reword commit, change image path

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.

In D50596#1157748, @dch wrote:

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?

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

I think I will re-work this to set IGNORE_OSVERSION instead.

Set IGNORE_OSVERSION instead of ASSUME_ALWAYS_YES

This revision is now accepted and ready to land.Tue, Jul 22, 10:26 AM