我有一台运行 apt-cacher(版本:1.7.16)的 Ubuntu 18.04 服务器,用于我们的环境,该环境混合了 Ubuntu 16、18 和 20 主机。我们的 Ubuntu 20.04 主机在使用 apt-cacher 主机时遇到修补问题。直接在互联网上修补可以正常工作,但这违反了我们的政策。我看到不允许获取该类型的文件错误:
admin7@template:~# apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [147 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [54.8 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [3560 B]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [3560 B]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [3560 B]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [3560 B]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [3560 B]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [3560 B]
Ign:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [2608 B]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [2608 B]
Ign:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata
Ign:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata
Ign:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata
Ign:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata
Ign:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata
Ign:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata
Ign:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata
Ign:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata
Err:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata
403 Sorry, not allowed to fetch that type of file: caa2bcaedd682ba4d80d0710baf3d9fc5e451692820011530d55b767636e4c34 [IP: 10.1.2.3 3142]
Ign:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata
Err:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata
403 Sorry, not allowed to fetch that type of file: 925b094241232d03a4765ecf2eadf174dfa8838476e49191e2f0d8e33980c953 [IP: 10.1.2.3 3142]
Get:18 http://archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [89.4 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-security/main Translation-en [33.9 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [2384 B]
Get:20 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [2384 B]
Get:20 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [2384 B]
Get:20 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [2384 B]
Get:20 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [2384 B]
Get:20 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [2384 B]
Ign:20 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata
Ign:27 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata
Ign:20 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata
Ign:27 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata
Ign:20 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata
Ign:27 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata
Err:20 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata
403 Sorry, not allowed to fetch that type of file: 8d1b06044b073a6d834a31b177e3da5028e29170ea7aacab20143e2a516ee602 [IP: 10.1.2.3 3142]
Ign:27 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata
Fetched 312 kB in 2s (133 kB/s)
Reading package lists... Done
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/main/cnf/Commands-amd64 403 Sorry, not allowed to fetch that type of file: caa2bcaedd682ba4d80d0710baf3d9fc5e451692820011530d55b767636e4c34 [IP: 10.1.2.3 3142]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/universe/cnf/Commands-amd64 403 Sorry, not allowed to fetch that type of file: 925b094241232d03a4765ecf2eadf174dfa8838476e49191e2f0d8e33980c953 [IP: 10.1.2.3 3142]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-security/main/cnf/Commands-amd64 403 Sorry, not allowed to fetch that type of file: 8d1b06044b073a6d834a31b177e3da5028e29170ea7aacab20143e2a516ee602 [IP: 10.1.2.3 3142]
E: Some index files failed to download. They have been ignored, or old ones used instead.
我看到过很多帖子抱怨类似的问题,这些问题几乎总是通过编辑 package_files_regexp 设置来解决。但是,这些帖子都提到了特定的文件扩展名。就我而言,问题文件似乎没有特定的文件扩展名,只是一长串十六进制字符。此外,这些十六进制字符串因文件而异。目前,我不知道如何解决此问题的正确步骤。有没有办法编辑 package_files_regexp 以允许这些十六进制字符串?
答案1
我刚刚在我的 Ubuntu MATE 20.04 上解决了这个问题:
apt remove command-not-found
apt clean
apt auto-remove
apt install command-not-found
答案2
我取得了一些进展。apt-get update 的输出在最后显示:
某些索引文件下载失败。它们已被忽略或使用旧文件代替。
我进入 apt-cacher 配置文件并临时设置:
索引文件正则表达式 = ^(.*)
apt-get update 现在可以在 Ubuntu 20.04 主机上运行。我不想让它保持这种设置。仍在寻找正确的解决方案,但至少我有一个临时解决方法。我已验证问题出在索引文件的名称上,并且 apt-cacher 配置文件未设置为允许其中一些文件名。