3

尝试从任何 repo 更新任何包时,很难追踪导致以下错误的原因。我通过将所有其他存储库设置为禁用来测试多个存储库。我已经清理了所有缓存并删除了所有 dnf yum 缓存文件。

# dnf -v update
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
DNF version: 4.2.7
cachedir: /var/cache/dnf
repo: downloading from remote: AppStream
error: Curl error (28): Timeout was reached for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Resolving timed out after 30000 milliseconds] (http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock).
CentOS-8 - AppStream                                                                                                                                                     0.0  B/s |   0  B     00:30    
Cannot download 'http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Resolving timed out after 30000 milliseconds].
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'

每次我尝试更新 dnf 时,服务器上的平均负载都会飙升,高达 40 倍

curl 可以访问镜像站点。

curl 'http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock'
http://ftp.tc.edu.tw/Linux/CentOS/8.2.2004/AppStream/x86_64/os/
http://mirror.horizon.vn/centos/8.2.2004/AppStream/x86_64/os/
http://ftp.jaist.ac.jp/pub/Linux/CentOS/8.2.2004/AppStream/x86_64/os/
http://centosg9.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://packet01.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://mirror.s8.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://centoso7.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://centosh9.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://centosc8.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://centosg7.centos.org/centos/8.2.2004/AppStream/x86_64/os/

我也试过在.repo中使用baserurl,同样的错误

我还用 curl 返回的 URL 之一替换了 baseurl,同样的错误

我尝试了很多建议,例如yum/dnf error: Failed to download metadata for repo and similar,没有一个对我有用。一些文章指出了 $releaseserver 等环境变量中的错误。我也尝试用实际值替换。同样的错误。

由于 curl 结果,Internet 连接显然可以。没有使用代理。DNS 正常

cat /etc/redhat-release
CentOS Linux release 8.1.1911 (Core)

uname -a
Linux xxxx 4.18.0-147.5.1.el8_1.x86_64 #1 SMP Wed Feb 5 02:00:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

任何建议将不胜感激。

4

2 回答 2

0

由于一些奇怪的原因,在将名称服务器设置/etc/resolv.conf8.8.8.8并重新启动后,我解决了这个问题。

另外,我禁用了 Hyper-V VM 的动态内存。DNF 命令需要大量内存。

请试一试。

问候, Arockiasamy

于 2020-09-27T17:20:08.263 回答
0

唯一对我有用的是禁用和删除有问题的回购。

sudo yum --disablerepo=epel\* remove epel-release.noarch
于 2021-03-18T17:23:55.553 回答