pkg報錯missing or size mismatch
環境信息
OS Version: FreeBSD 14
PKG Version : 1.21.3
PKG Repo: NJU Eud
错误信息
在使用pkg安装git的时候报错missing or size mismatch, fetching from remote
root@localhost:/etc/pkg # pkg install git
Updating FreeBSD repository catalogue...
pkg: No SRV record found for the repo 'FreeBSD'
Fetching meta.conf: 0%
FreeBSD repository is up to date.
All repositories are up to date.
The following 26 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
curl: 8.10.0
expat: 2.6.2
git: 2.45.2_1
libnghttp2: 1.62.1
libpsl: 0.21.5_1
libssh2: 1.11.0_1,3
p5-Authen-SASL: 2.17
p5-CGI: 4.65
p5-Clone: 0.46
p5-Digest-HMAC: 1.04
p5-Encode-Locale: 1.05
p5-Error: 0.17029
p5-GSSAPI: 0.28_2
p5-HTML-Parser: 3.82
p5-HTML-Tagset: 3.24
p5-HTTP-Date: 6.06
p5-HTTP-Message: 6.46
p5-IO-HTML: 1.004
p5-IO-Socket-IP: 0.42
p5-IO-Socket-SSL: 2.085_1
p5-LWP-MediaTypes: 6.04
p5-Mozilla-CA: 20240730
p5-Net-SSLeay: 1.94
p5-TimeDate: 2.33,1
p5-URI: 5.28
pcre2: 10.43
Number of packages to be installed: 26
The process will require 54 MiB more space.
7 MiB to be downloaded.
Proceed with this action? [y/N]: y
[1/3] Fetching p5-HTTP-Message-6.46.pkg: 100% 81 KiB 83.2kB/s 00:01
pkg: cached package p5-HTTP-Message-6.46: missing or size mismatch, fetching from remote
[2/3] Fetching p5-HTTP-Message-6.46.pkg: 100% 81 KiB 83.2kB/s 00:01
pkg: cached package p5-HTTP-Message-6.46: missing or size mismatch, cannot continue
Consider running 'pkg update -f'
[3/3] Fetching p5-HTTP-Message-6.46.pkg: 100% 81 KiB 83.2kB/s 00:01
pkg: cached package p5-HTTP-Message-6.46: missing or size mismatch, fetching from remote
Fetching p5-HTTP-Message-6.46.pkg: 100% 81 KiB 83.2kB/s 00:01
pkg: cached package p5-HTTP-Message-6.46: missing or size mismatch, cannot continue
Consider running 'pkg update -f'
pkg: Package database is busy while closing!
解決方案
-
清空緩存
pkg update -f -
刪除pkg緩存和數據庫
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 -
更換pkg源
把pkg的源從南京大學的更換到中國科學技術大學的就解決了.(實際上上面的步驟我执行了之后并没有解决问题,问题的原因就是南大的源可能有问题。)
change http://mirrors.nju.edu.cn/freebsd-pkg/${ABI}/quarterly --> http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly