pkg: repository archive entry is too large

Today I noticed the following message while doing pkg upgrade:

Code:
$ doas pkg upgrade; echo $?
Updating FreeBSD-ports-kmods repository catalogue...
FreeBSD-ports-kmods repository is up to date.
Updating FreeBSD-ports repository catalogue...
pkg: need to re-create repo FreeBSD-ports to upgrade schema version
Fetching meta.conf: 100%     168 B   0.2 kB/s    00:01    
Fetching data: 100%  9103 KiB   1.9 MB/s    00:05    
pkg: repository archive entry is too large: data
pkg: No signature found
FreeBSD-ports repository is up to date.
All repositories are up to date.
pkg: need to re-create repo FreeBSD-ports to upgrade schema version
pkg: Repository FreeBSD-ports cannot be opened. 'pkg update' required
Checking for upgrades (0 candidates): 100%
Processing candidates (0 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.
0

So, especially the following outputs are worrying me:

Code:
pkg: need to re-create repo FreeBSD-ports to upgrade schema version
pkg: Repository FreeBSD-ports cannot be opened. 'pkg update' required

And, when running pkg update:

Code:
$ doas pkg update; echo $?
Updating FreeBSD-ports-kmods repository catalogue...
FreeBSD-ports-kmods repository is up to date.
Updating FreeBSD-ports repository catalogue...
pkg: need to re-create repo FreeBSD-ports to upgrade schema version
Fetching meta.conf: 100%     168 B   0.2 kB/s    00:01    
Fetching data: 100%  9103 KiB   9.3 MB/s    00:01    
pkg: repository archive entry is too large: data
pkg: No signature found
FreeBSD-ports repository is up to date.
All repositories are up to date.
0

That pkg: repository archive entry is too large: data doesn't look good. I've removed everything under /var/db/pkg/repos/ and ran pkg update again, but to no avail, the message is still present. I've tried to "verify" the local package state, and at least the file itself appears to be OK, but I haven't check its contents yet, and wouldn't know where to begin:

Code:
$ doas sqlite3 /var/db/pkg/local.sqlite "PRAGMA integrity_check"
╭─────────────────╮
│ integrity_check                                    │
╞═════════════════╡
│ ok                                                        │
╰─────────────────╯

The pkg: need to re-create repo message is mentioned in a (very) old thread in this forum, but apparently the message vanished somehow.

Ideas welcome on what to do here, thanks!


Code:
$ doas pkg -vv
Version                 : 2.8.2
libpkg                  : 2.8.2
libarchive              : libarchive 3.8.7
sqlite                  : 3.53.2
openssl                 : OpenSSL 3.5.6 7 Apr 2026
PKG_DBDIR = "/var/db/pkg";
PKG_CACHEDIR = "/var/cache/pkg";
PORTSDIR = "/usr/ports";
INDEXDIR = "";
INDEXFILE = "INDEX-15";
HANDLE_RC_SCRIPTS = false;
DEFAULT_ALWAYS_YES = false;
ASSUME_ALWAYS_YES = false;
REPOS_DIR [
    "/etc/pkg/",
    "/usr/local/etc/pkg/repos/",
]
PLIST_KEYWORDS_DIR = "";
SYSLOG = true;
DEVELOPER_MODE = false;
VULNXML_SITE = "https://vuxml.freebsd.org/freebsd/vuln.xml.xz";
FETCH_RETRY = 3;
PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
PKG_ENABLE_PLUGINS = true;
PLUGINS [
]
DEBUG_SCRIPTS = false;
PLUGINS_CONF_DIR = "/usr/local/etc/pkg/";
PERMISSIVE = false;
REPO_AUTOUPDATE = true;
NAMESERVER = "";
HTTP_USER_AGENT = "pkg/2.8.2";
EVENT_PIPE = "";
FETCH_TIMEOUT = 30;
UNSET_TIMESTAMP = false;
SSH_RESTRICT_DIR = "";
PKG_ENV {
}
PKG_SSH_ARGS = "";
DEBUG_LEVEL = 0;
ALIAS {
    all-depends = "query %dn-%dv";
    annotations = "info -A";
    build-depends = "info -qd";
    cinfo = "info -Cx";
    comment = "query -i \"%c\"";

    comment = "query -i \"%c\"";
    csearch = "search -Cx";
    desc = "query -i \"%e\"";
    download = "fetch";
    iinfo = "info -ix";
    isearch = "search -ix";
    prime-list = "query -e '%a = 0' '%n'";
    prime-origins = "query -e '%a = 0' '%o'";
    leaf = "query -e '%#r == 0' '%n-%v'";
    list = "info -ql";
    noauto = "query -e '%a == 0' '%n-%v'";
    options = "query -i \"%n - %Ok: %Ov\"";
    origin = "info -qo";
    orphans = "version -vRl?";
    provided-depends = "info -qb";
    rall-depends = "rquery %dn-%dv";
    raw = "info -R";
    rcomment = "rquery -i \"%c\"";
    rdesc = "rquery -i \"%e\"";
    required-depends = "info -qr";
    roptions = "rquery -i \"%n - %Ok: %Ov\"";
    sets = "info -d -C -x '^FreeBSD-set-'";
    shared-depends = "info -qB";
    show = "info -f -k";
    size = "info -sq";
    unmaintained = "query -e '%m = \"ports@FreeBSD.org\"' '%o (%w)'";
    runmaintained = "rquery -e '%m = \"ports@FreeBSD.org\"' '%o (%w)'";
}
CUDF_SOLVER = "";
SAT_SOLVER = "";
RUN_SCRIPTS = true;
CASE_SENSITIVE_MATCH = true;
LOCK_WAIT = 1;
LOCK_RETRIES = 5;
SQLITE_PROFILE = false;
WORKERS_COUNT = 0;
READ_LOCK = false;
IP_VERSION = 0;
AUTOMERGE = true;
MERGETOOL = "";
VERSION_SOURCE = "";
CONSERVATIVE_UPGRADE = true;
FORCE_CAN_REMOVE_VITAL = true;
PKG_CREATE_VERBOSE = false;
AUTOCLEAN = false;
AUTOREMOVE = false;

DOT_FILE = "";
DEBUG_SCHEDULER_DOT_FILE = "";
REPOSITORIES {
}
VALID_URL_SCHEME [
    "pkg+http",
    "pkg+https",
    "https",
    "http",
    "file",
    "ssh",
    "tcp",
]
WARN_SIZE_LIMIT = 1048576;
METALOG = "";
IGNORE_OSVERSION = false;
IGNORE_OSMAJOR = false;
BACKUP_LIBRARIES = false;
BACKUP_LIBRARY_PATH = "/usr/local/lib/compat/pkg";
PKG_TRIGGERS_DIR [
    "/usr/share/pkg/triggers/",
    "/usr/local/share/pkg/triggers",
]
PKG_TRIGGERS_ENABLE = true;
AUDIT_IGNORE_GLOB [
]
AUDIT_IGNORE_REGEX [
]
COMPRESSION_FORMAT = "";
COMPRESSION_LEVEL = -1;
REPO_ACCEPT_LEGACY_PKG = false;
FILES_IGNORE_GLOB [
]
FILES_IGNORE_REGEX [
]
SHLIB_PROVIDE_PATHS_NATIVE [
]
SHLIB_PROVIDE_PATHS_COMPAT_32 [
]
SHLIB_PROVIDE_PATHS_COMPAT_LINUX [
]
SHLIB_PROVIDE_PATHS_COMPAT_LINUX_32 [
]
SHLIB_PROVIDE_IGNORE_GLOB [
]
SHLIB_PROVIDE_IGNORE_REGEX [

SHLIB_PROVIDE_PATHS_COMPAT_LINUX_32 [
]
SHLIB_PROVIDE_IGNORE_GLOB [
]
SHLIB_PROVIDE_IGNORE_REGEX [
]
SHLIB_REQUIRE_IGNORE_GLOB [
]
SHLIB_REQUIRE_IGNORE_REGEX [
]
PKG_DEBUG_FLAGS [
    "all",
]
COMPRESSION_THREADS = -1;
PKG_REINSTALL_ON_OPTIONS_CHANGE = true;
TRACK_LINUX_COMPAT_SHLIBS = false;
PKG_RWHICH_DATABASE = true;
ABI = "FreeBSD:15:aarch64";
ALTABI = "freebsd:15:aarch64:64";
OSVERSION = "1501000";

Repositories:
  FreeBSD-ports-kmods: { 
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:aarch64/kmods_quarterly_1",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
  FreeBSD-base: { 
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:aarch64/base_release_1",
    enabled         : no,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkgbase-15"
  }
  FreeBSD-ports: { 
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:aarch64/latest",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
 
The the error always mentions the FreeBSD-ports repo, I've disabled the same and the error is gone - but then of course the ports are gone. Running with -d4 gives more output: https://paste.debian.net/hidden/2ffffacc

The interesting part from that, maybe:


$ doas pkg -d4 update
[...]
DBG(1)[28589]> (fetch) libfetch> fetching from: https://pkgmir.geo.freebsd.org/FreeBSD:15:aarch64/latest/data.pkg with opts "i4"
DBG(1)[28589]> (fetch) Fetch: fetcher used: pkg+https
Fetching data:
DBG(1)[28589]> (fetch) Read status: 8192 over 9321846
[...]
DBG(1)[28589]> (fetch) Read status: 9321846 over 9321846
Fetching data... done
DBG(1)[28589]> PkgRepo: extracting data of repo FreeBSD-ports
DBG(1)[28702]> PkgRepo: extracting signature of repo in a sandbox
pkg: repository archive entry is too large: datapkg: No signature found


When manually fetching the data.pkg file:


$ curl -LO https://pkgmir.geo.freebsd.org/FreeBSD:15:aarch64/latest/data.pkg
$ tar --zstd -xf data.pkg
$ ls -l data*
-rw-r--r-- 1 root wheel 62971704 Aug 13 17:32 data
-rw-r----- 1 root wheel 9321846 Aug 15 10:15 data.pkg
-rw-r--r-- 1 root wheel 451 Jan 1 1970 data.pub
-rw-r--r-- 1 root wheel 256 Jan 1 1970 data.sig


Does anyone know how to verify these files? Maybe there's some weird transmission error?
 
I have no experience with aarch64 repositories, and I have no idea what causes the "too large" error message. If, with or without advice from others, the problem cannot be resolved, I'd consider deleting every package and deleting pkg and its db completely from your system. Then start afresh with installing pkg(8). Beforehand I should save all your relevant package names (using pkg prime-list is helpful here).

However, you have a misaligned repository set-up in your .conf file:
Rich (BB code):
   [...]
$ doas pkg -vv
Version                 : 2.8.2
[...]
ABI = "FreeBSD:15:aarch64";
ALTABI = "freebsd:15:aarch64:64";
OSVERSION = "1501000";

Repositories:
  FreeBSD-ports-kmods: { 
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:aarch64/kmods_quarterly_1",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
  FreeBSD-base: { 
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:aarch64/base_release_1",
    enabled         : no,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkgbase-15"
  }
  FreeBSD-ports: { 
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:aarch64/latest",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
Your pkg -vv output should reflect either both using quarterly or both using latest; not a mix of both for the ports-tree repositories as shown in your output.

In, for example a local user set-up in /usr/local/etc/pkg/repos/FreeBSD.conf, using latest, you should have someting like:
Rich (BB code):
[1-0] # cat /usr/local/etc/pkg/repos/FreeBSD.conf
FreeBSD-ports: {
  url: "pkg+https://pkg.FreeBSD.org/${ABI}/latest",
  enabled: yes
}
FreeBSD-ports-kmods: {
  url: "pkg+https://pkg.FreeBSD.org/${ABI}/kmods_latest_${VERSION_MINOR}",
  enabled: yes
}
FreeBSD-base: {
  url: "pkg+https://pkgbase.FreeBSD.org/${ABI}/base_release_${VERSION_MINOR}",
  url: "pkg+https://pkg.FreeBSD.org/${ABI}/base_release_${VERSION_MINOR}",
  enabled: yes
}

This will also be reflected in a pkg -vv or pkg-repositories(8) output.
 
Last edited:
Wow, good catch. I've corrected the same and ran pkg update again:


$ doas pkg update
Updating FreeBSD-ports-kmods repository catalogue...
pkg: Repository FreeBSD-ports-kmods has a wrong packagesite, need to re-create database
Fetching meta.conf: 100% 179 B 0.2 kB/s 00:01
Fetching data: 100% 17 KiB 17.5 kB/s 00:01
Processing entries: 100%
FreeBSD-ports-kmods repository update completed. 80 packages processed.

Updating FreeBSD-ports repository catalogue...
pkg: Repository FreeBSD-ports has a wrong packagesite, need to re-create database
Fetching meta.conf: 100% 168 B 0.2 kB/s 00:01
Fetching data: 100% 9103 KiB 2.3 MB/s 00:04
pkg: repository archive entry is too large: data
pkg: No signature found
FreeBSD-ports repository is up to date.
All repositories are up to date.


So, the FreeBSD-ports-kmods repository has now been refreshed properly, but that of course did nothing to the FreeBSD-ports repo, as you might have guessed.

Since this really looks like a proper bug I went ahead and opened bug 297548. Thank you for responding and catching this misaligned config!
 
Back
Top