问题描述
在尝试从任何存储库更新任何软件包时,很难找到导致以下错误的原因。我已经通过将所有其他仓库都设置为禁用来测试了多个仓库。我已经清理了所有缓存并删除了所有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返回的网址之一替换了基本网址,同样的错误
我尝试了许多建议,例如yum/dnf error: Failed to download metadata for repo 类似的,对我没有用。 一些文章指出$ releaseserver等环境变量中的错误。我也尝试过用实际值替换。同样的错误。
由于卷曲结果,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
任何建议将不胜感激。
解决方法
出于某些奇怪的原因,将/etc/resolv.conf
中的名称服务器设置为8.8.8.8
,然后重新启动为我解决了该问题。
此外,我禁用了Hyper-V VM的动态内存。 DNF命令期望大量内存。
请尝试一下。
关于, Arockiasamy
,唯一对我有用的是禁用和删除有问题的存储库。
sudo yum --disablerepo=epel\* remove epel-release.noarch