pkg: cached package size mismatch
Freebsd's pkg system is wonderfully handy. However, on occasion, problems may arise. In this case we're looking at
pkg: cached package XXX: size mismatch, cannot continue
The error message goes on to suggest running
pkg update -f
This forces a download of the repository catalog, (or catalogue if you are not in the US). Sometimes it works, sometimes it doesn't.
I came across a post on the FreeBSD Forums that has worked for me in several situations.
According to “SirDice”
pkg clean # cleans /var/cache/pkg/ rm -rf /var/cache/pkg/* # just remove it all pkg update -f # forces update of repository catalog rm /var/db/pkg/repo-*.sqlite # removes all remote repository catalogs pkg bootstrap -f # forces reinstall of pkg
With the caveat that you do NOT delete /var/db/pkg/local.sqlite.
Thank you SirDice!