pkg cached package : missing or size mismatch, fetching from remote/cannot continue

Hi,

I moved continents back in October/November and I just put back my FreeBSD 14.1-RELEASE-p8 hard disk into another computer. I wanted to upgrade it but cannot perform pkg upgrade (although freebsd-update fetch install did work)
root@fb33:~ # freebsd-version
14.1-RELEASE-p8
root@fb33:~ # uname -r
14.1-RELEASE-p7
I suspect it may be partially caused by my slow connection, because I was able to upgrade xxd before and lsof after following the usual instructions for fixing this (Thread pkg-1-3-0-size-mismatch-cannot-continue.47444/post-265056)
But when it reaches bigger packages like libreoffice, I get this :
Code:
[1/253] Fetching libreoffice-24.8.4.2.pkg: 20% 29 MiB 32.8kB/s 01:26:38 ETA
pkg: cached package libreoffice-24.8.4.2: missing or size mismatch, fetching from remote
[2/253] Fetching libreoffice-24.8.4.2.pkg: 20% 29 MiB 32.8kB/s 01:30:45 ETA
pkg: cached package libreoffice-24.8.4.2: missing or size mismatch, cannot continue
I did follow the instructions from SirDice, but to no avail.
Then I downloaded another version of the catalog, but to be frank I have no idea if it is the right version :
Code:
root@fb33:~ # pkg -o OSVERSION=1401000 update -f
(by the way, is there a list somewhere of all versions like 1401000 matched with FreeBSD versions or do we just use uname -r as a target or something?)
I then followed the instructions again and thus installed another version of pkg I believe.

I also wonder if the rm command in the instructions should not be targeted at this path :
Code:
/var/db/pkg/repos/FreeBSD/db:         SQLite 3.x database, user version 2014, last written using SQLite version 3045002, file counter
Since the paths seem to have changed slightly since then? Could this be why the fix didn't work? I didn't delete the erroneous DB?

Any help would be much appreciated :)

I'll attach a tmux log of what I did for whoever is curious enough to go through it.
 

Attachments

OSVERSION is irrelevant for the package repositories, there's only one for the entire 14 branch. Well, technically it's two, latest and quarterly, but they're both for 14.

Code:
url: "pkg+https://pkg.FreeBSD.org/${ABI}/quarterly",
That ${ABI} variable translates to FreeBSD:14:amd64, as you can see it's only the major version that's important.
 
OSVERSION is irrelevant for the package repositories, there's only one for the entire 14 branch. Well, technically it's two, latest and quarterly, but they're both for 14.

Code:
url: "pkg+https://pkg.FreeBSD.org/${ABI}/quarterly",
That ${ABI} variable translates to FreeBSD:14:amd64, as you can see it's only the major version that's important.
I see, so any pkg update [-f] should give me the right catalog for my version, right? (I never pointed pkg or ports to quaterly so I assume I point to latest by default) So why the size mismatch?

Could not updating that install since 4-5 months be enough to "break" it? That doesn't seem right.
 
Look at pkg -vv to see which repositories are enabled. There can be more than one.

So why the size mismatch?
Some distfiles do this often, version didn't change yet the archive itself changed. Another reason might be a proxy blocking/interfering with your downloads, and some "malware prevention" features of certain firewalls are also known to interfere.
 
Look at pkg -vv to see which repositories are enabled. There can be more than one.
I will as soon as I can. But I don't have proxies/firewalls doing any of that. So I am thinking the "solution" would be to simply completely remove any offending package(s) (here libreoffice), and reinstall it after the upgrade if I really want it? (hoping it doesn't affect actually important/essential packages)
 
I suspect it may be partially caused by my slow connection,
reinstall it after the upgrade if I really want it? (hoping it doesn't affect actually important/essential packages)
If the download drops by fetching the packages with pkg-upgrade(8), download those bigger packages (another is openjdk17, dependency of libreoffice, ~ 160M, or llvm19, one of the important/essential, ~ 272M) manually with a file retriever program like ftp/wget or ftp/curl, which, when the download is interrupted, have resume capability.

After the download is completed, pkg-add(8) package. pkg-add(8) might complain about missing dependencies, those can be installed separately by pkg-install(8).

The download URLs are:

"latest" ... : http://pkg.freebsd.org/FreeBSD:14:amd64/latest/All/<name-version>.pkg
"quarterly": http://pkg.freebsd.org/FreeBSD:14:amd64/quarterly/All/<name-version>.pkg

Take the version number from pkg-upgrade(8) or pkg-search(8).


(I never pointed pkg or ports to quaterly so I assume I point to latest by default)
Your systems pkg repository configuration is pointing to quarterly according to "pkg" and "libreoffice" versions to be installed or upgraded.

From the "freebsdSizeMismatch2.txt":
Rich (BB code):
root@fb33:~ # pkg bootstrap -f
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
...
Installing pkg-1.21.3...


Installed packages to be UPGRADED:

libreoffice: 24.8.2.1 -> 24.8.4.2
Currently, on "latest" repository ports-mgmt/pkg is at version pkg-2.0.6 , editor/libreoffice at libreoffice-25.2.1.2_1.
 
If the download drops by fetching the packages with pkg-upgrade(8), download those bigger packages (another is openjdk17, dependency of libreoffice, ~ 160M, or llvm19, one of the important/essential, ~ 272M) manually with a file retriever program like ftp/wget or ftp/curl, which, when the download is interrupted, have resume capability.

After the download is completed, pkg-add(8) package. pkg-add(8) might complain about missing dependencies, those can be installed separately by pkg-install(8).

The download URLs are:

"latest" ... : http://pkg.freebsd.org/FreeBSD:14:amd64/latest/All/<name-version>.pkg
"quarterly": http://pkg.freebsd.org/FreeBSD:14:amd64/quarterly/All/<name-version>.pkg

Take the version number from pkg-upgrade(8) or pkg-search(8).



Your systems pkg repository configuration is pointing to quarterly according to "pkg" and "libreoffice" versions to be installed or upgraded.

From the "freebsdSizeMismatch2.txt":
Rich (BB code):
root@fb33:~ # pkg bootstrap -f
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
...
Installing pkg-1.21.3...


Installed packages to be UPGRADED:

libreoffice: 24.8.2.1 -> 24.8.4.2
Currently, on "latest" repository ports-mgmt/pkg is at version pkg-2.0.6 , editor/libreoffice at libreoffice-25.2.1.2_1.
Thank you very much!

I did find out I was on quaterly with pkg -vv (see attached file)

There is definitely something weird : it seems to happen only on bigger packages, but always at the same "milestones" (always 20% on libreoffice, always 10% on llvm19, etc). So I think it isn't actually about the speed or the remote server package's size.

Are there some kind of checks every 10% on packages bigger than X? (so far I removed wine, en-freebsd-doc, libreoffice, and llvm19 was failing too, but I am downloading it manually)


I would like to check the package sizes to make sure. As far as I understand the pkgsize field in the packages table in the /var/db/pkg/repos/FreeBSD/db database tells the theoretical size, right? Then I just have to compare with the headers of the URLs you mentioned, right?


I started to download llvm19, but I did it in /var/cache/pkg directly so I'll be able to seamlessly continue pkg upgrade (at least that's the plan). For some reason there is a symbolic link and the package (with a checksum appended?).
lrwxr-xr-x 1 root wheel 35 Mar 20 22:03 xfce4-tumbler-4.20.0.pkg -> xfce4-tumbler-4.20.0~814fead8f8.pkg
-rw-r--r-- 1 root wheel 155799 Feb 25 07:18 xfce4-tumbler-4.20.0~814fead8f8.pkg
lrwxr-xr-x 1 root wheel 30 Mar 21 00:05 xfce4-wm-4.20.0.pkg -> xfce4-wm-4.20.0~7f7f7cb3e6.pkg
-rw-r--r-- 1 root wheel 493429 Feb 25 03:50 xfce4-wm-4.20.0~7f7f7cb3e6.pkg
Will there be an issue if I run the update and llvm19-XXXX is an actual file and not a symbolic link?
 
Back
Top