Fix for failed pkg update

Today, I suddenly encountered an unknown error when running pkg update on FreeBSD 15.0:

Code:
Updating FreeBSD-ports repository catalogue...
pkg: Failed to fetch https://pkg.FreeBSD.org/FreeBSD:15:amd64/latest/meta.conf: Unknown error
pkg: Failed to fetch https://pkg.FreeBSD.org/FreeBSD:15:amd64/latest/meta.txz: Unknown error
repository FreeBSD-ports has no meta file, using default settings
pkg: Failed to fetch https://pkg.FreeBSD.org/FreeBSD:15:amd64/latest/data.pkg: Unknown error
pkg: Failed to fetch https://pkg.FreeBSD.org/FreeBSD:15:amd64/latest/data.tzst: Unknown error
pkg: Failed to fetch https://pkg.FreeBSD.org/FreeBSD:15:amd64/latest/packagesite.pkg: Unknown error
pkg: Failed to fetch https://pkg.FreeBSD.org/FreeBSD:15:amd64/latest/packagesite.tzst: Unknown error
Unable to update repository FreeBSD-ports
Error updating repositories!

And I want to share my fix below, in case you encounter similar issue.

Code:
mkdir -p /usr/local/etc/pkg/repos/ && \
cat <<'EOF' > /usr/local/etc/pkg/repos/FreeBSD.conf && pkg update
FreeBSD-ports: {
  url: "http://pkg0.your.FreeBSD.org/${ABI}/quarterly",
  mirror_type: "none",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
FreeBSD-ports-kmods: {
  url: "http://pkg0.your.FreeBSD.org/${ABI}/kmods_quarterly_${VERSION_MINOR}",
  mirror_type: "none",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
EOF

PS:
  • Replace pkg0.your.FreeBSD.org with a mirror URL nearest to your location. Check out the list in Other mirros section here: https://pkg.freebsd.org/
  • Note that this is only a temporary fix. Remove the file or rename its .conf extension once the original repo has come back to work for you.
 
Apart from the url settings issues, this "all-in-one-go" seems a bit specific, targeting "quarterly" users only. Applied as-is, users of a packaged base 15.0-RELEASE (who have FreeBSD-base: { enabled: yes, } in their local /usr/local/etc/pkg/repos/FreeBSD.conf) will likely be confronted with a disabled FreeBSD-base repository, that they may not be anticipating.

Edit: this is just a friendly note to users to consider before applying.
 
Apart from the url settings issues, this "all-in-one-go" seems a bit specific, targeting "quarterly" users only. Applied as-is, users of a packaged base 15.0-RELEASE (who have FreeBSD-base: { enabled: yes, } in their local /usr/local/etc/pkg/repos/FreeBSD.conf) will likely be confronted with a disabled FreeBSD-base repository, that they may not be anticipating.

Edit: this is just a friendly note to users to consider before applying.

Nice note, thanks,

Users of latest need to replace quarterly with latest.
 
Back
Top