Bug 281924 - Missing pkg.txz prevents pkg bootstrap
Summary: Missing pkg.txz prevents pkg bootstrap
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 14.1-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-07 12:46 UTC by Vincent Bentley
Modified: 2024-10-07 17:48 UTC (History)
3 users (show)

See Also:


Attachments
Screenshot of folder index (33.88 KB, image/png)
2024-10-07 16:54 UTC, Vincent Bentley
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Bentley 2024-10-07 12:46:04 UTC
A never before used pkg on this install attempts to bootstrap pkg by pulling https://pkg.freebsd.org/FreeBSD:14:amd64/latest/Latest/pkg.txz but the file does not exist.

For comparison, pkg.txz is present in the repo for FreeBSD 13
https://pkg.freebsd.org/FreeBSD:13:amd64/latest/Latest/

I noticed the fault after building podman images from https://github.com/dfr/freebsd-images and being unable to bootstrap pkg from and amd64 image.

$ sudo podman run -it localhost/freebsd14.1-small sh
# pkg bootstrap
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:14:amd64/latest, please wait...
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:14:amd64/latest/Latest/pkg.txz: Address family for host not supported
Address resolution failed for http://pkg.FreeBSD.org/FreeBSD:14:amd64/latest.
Consider changing PACKAGESITE.

When viewing http://pkg.FreeBSD.org/FreeBSD:14:amd64/latest/Latest/ in a web browser you can see that pkg.txz is missing.
Comment 1 dfr 2024-10-07 13:08:50 UTC
When I visit http://pkg.freebsd.org/FreeBSD:14:amd64/latest/Latest, I do see pkg.txz so perhaps this is a problem with your local mirror?
Comment 2 Ed Maste freebsd_committer freebsd_triage 2024-10-07 15:20:17 UTC
Note that the pkg bootstrap first tries fetching pkg.pkg, falling back to pkg.txz if that is not successful. If all fail to fetch the URL from the last fetch attempt will be printed. I assume the same error "Address family for host not supported" occurred for both pkg.pkg and pkg.txz.
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-10-07 16:02:30 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f5c847ae849aab9354d0956afd683f1c90bfd91e

commit f5c847ae849aab9354d0956afd683f1c90bfd91e
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-10-07 15:11:09 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-10-07 16:01:36 +0000

    pkg: prefer .pkg extension

    .pkg is the default extension as of commit c244b1d8a387, falling back to
    .txz if not found.

    PR:             281924
    Reviewed by:    bapt
    Fixes: a2aac2f5e564 ("pkg(7): when bootstrapping first search for pkg.bsd file then pkg.txz")
    Fixes: c244b1d8a387 ("pkg: settle the uniq extension to .pkg instead of .bsd")
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D46977

 usr.sbin/pkg/pkg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 4 Ed Maste freebsd_committer freebsd_triage 2024-10-07 16:21:54 UTC
To be explicit - pkg tried to fetch both pkg.pkg and pkg.txz and both fetch attempts failed. The issue is not a missing pkg.txz.

Two different approaches for improving the error message to help diagnose issues like this one:

https://reviews.freebsd.org/D46983
https://reviews.freebsd.org/D46981
Comment 5 Vincent Bentley 2024-10-07 16:54:51 UTC
Created attachment 254076 [details]
Screenshot of folder index
Comment 6 Ed Maste freebsd_committer freebsd_triage 2024-10-07 16:58:29 UTC
(In reply to Vincent Bentley from comment #5)
Yes, pkg.txz is a red herring -- pkg.txz does not exist there, but it does not matter. The pkg bootstrap looks (first) for pkg.pkg, which exists.
Comment 7 Ed Maste freebsd_committer freebsd_triage 2024-10-07 17:03:14 UTC
Ah, perhaps the missing info is that pkg.pkg and pkg.txz are the same thing - the default package extension was changed, and for some time pkg was provided under both names, for backwards compatibility.

In FreeBSD 14.0 and later pkg looks first for the new name, falling back to trying the old name if that is not found.
Comment 8 commit-hook freebsd_committer freebsd_triage 2024-10-07 17:06:36 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=be9243409d6be99f5d7815b6d074a85a6e84f7ce

commit be9243409d6be99f5d7815b6d074a85a6e84f7ce
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-10-07 16:33:12 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-10-07 17:05:07 +0000

    pkg: improve error message

    Print the complete list of url that have failed

    PR:             281924
    Co-authored-by: Baptiste Daroussin <bapt@FreeBSD.org>
    Differential Revision: https://reviews.freebsd.org/D46983

 usr.sbin/pkg/pkg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Comment 9 Vincent Bentley 2024-10-07 17:43:06 UTC
(In reply to Ed Maste from comment #6)
pkg.pkg is present on the mirror I have access to. I think my problem is actually networking. I can fetch the pkg.pkg file from my podman host but not from a podman image. The clue was both pkg.pkg and pkg.txz failing.

I have tried using pkg from two separate podman hosts in separate locations but both had complex network configs with various combinations of wlan, lagg, vlan and bridges. I have probably messed something up with the PF NAT configs on each host for podman. I will build a specific test host for podman with a simple wired network config and try again.