使用 Apt-Cacher NG 的 Apt-Get 无法获取哈希和不匹配的包

Mar*_*vic 9 apt networking apt-cacher-ng

我有一台机器正在使用在另一台机器上运行的 Apt-Cacher NG 作为缓存代理。

当我尝试运行时sudo apt-get update,出现以下错误:

W: Failed to fetch gzip:/var/lib/apt/lists/partial/it.archive.ubuntu.com_ubuntu_dists_oneiric-updates_main_source_Sources  Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/it.archive.ubuntu.com_ubuntu_dists_oneiric-updates_main_binary-amd64_Packages  Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/it.archive.ubuntu.com_ubuntu_dists_oneiric-updates_universe_binary-amd64_Packages  Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/it.archive.ubuntu.com_ubuntu_dists_oneiric-updates_main_binary-i386_Packages  Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
Run Code Online (Sandbox Code Playgroud)

目录 /etc/apt/sources.list.d 是空的。

为了解决这个问题,我已经尝试了以下但没有成功:

解决方案1:

sudo rm -fr /var/lib/apt/lists
sudo mkdir -p /var/lib/apt/lists/partial
sudo apt-get clean
sudo apt-get autoclean
Run Code Online (Sandbox Code Playgroud)

解决方案2:

sudo apt-get update -o Acquire::http::No-Cache=True
Run Code Online (Sandbox Code Playgroud)

有什么建议吗?

ger*_*ijk 11

我建议不要使用 APT-cacher-ng 并查看 Squid-deb-proxy。

根据我的经验,APT-cacher-ng 已被证明是非常错误的,并且有大量的错误报告非常出色。直到最近才再次提议在 Debian 中解除阻塞,因为一些主要错误已被压缩。对于 Ubuntu,我很久以前就切换到了 Squid-deb-proxy,我并不后悔。这是一个很好的选择,也是我遇到的最好的 APT-cacher。

对于 Squid-deb-proxy,只需安装包squid-deb-proxy并在/etc/squid-deb-proxy/mirror-dstdomain.acl.d. 作为奖励,客户端可以通过squid-deb-proxy-client安装包来自动发现本地网络中启用缓存的机器。


小智 8

您现在可以通过运行来解决这个问题:

http://your-cache-server:3142/acng-report.html?abortOnErrors=aOe&byPath=bP&byChecksum=bS&truncNow=tN&incomAsDamaged=iad&purgeNow=pN&doExpire=Start+Scan+and%2For+Expiration&calcSize=cs&asNeeded=an#bottom
Run Code Online (Sandbox Code Playgroud)

这将删除缓存中的所有损坏文件。

要使这个永久网络,请查看https://www.unix-ag.uni-kl.de/~bloch/acng/html/maint.html#auto-cleanup

基本上,您可以设置每日缓存清理 cron 以对整个缓存进行完整的校验和匹配。这将捕获所有错误的大小和任何其他损坏并清除这些文件。我/etc/cron.daily/apt-cacher-ng在评论后编辑并添加了以下内容:

export ACNGREQ="abortOnErrors=aOe&byPath=bP&byChecksum=bS&truncNow=tN&incomAsDamaged=iad&purgeNow=pN&doExpire=Start+Scan+and%2For+Expiration&calcSize=cs&asNeeded=an"
Run Code Online (Sandbox Code Playgroud)

这相当于点击了维护页面上除了“Skip header checks...”之外的所有到期选项