【问题标题】:Error using Yum DNF on Centos 8.1 Failed to download metadata for repo 'AppStream'在 Centos 8.1 上使用 Yum DNF 时出错 无法下载 repo 'AppStream' 的元数据
【发布时间】:2021-01-04 21:55:31
【问题描述】:

在尝试从任何 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 和类似的,没有一个对我有用。 一些文章指出了 $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

任何建议将不胜感激。

【问题讨论】:

  • 我也有同样的问题。现在真的是在敲我的头。

标签: yum centos8 dnf


【解决方案1】:

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

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

请试一试。

问候, Arockiasamy

【讨论】:

  • 我将 8.8.8.8 添加到 resolve.conf 并注释掉原始条目,然后重新启动服务器。这对我有用。谢谢!
  • *** 更新 *** 此更改仅在重新启动后才有效,但一段时间后问题又出现了。它发生在 4 台服务器上,然后我删除了 Cockpit 和繁荣!问题解决了!因此,如果您遇到此问题并安装了 Cockpit,请尝试禁用或删除,这可能会有所帮助。
【解决方案2】:

唯一对我有用的是禁用并删除有问题的 repo。

sudo yum --disablerepo=epel\* remove epel-release.noarch

【讨论】:

    猜你喜欢
    • 2020-05-16
    • 2015-03-29
    • 1970-01-01
    • 1970-01-01
    • 2020-08-22
    • 2017-12-19
    • 2012-03-04
    • 2022-01-08
    • 2016-11-03
    相关资源
    最近更新 更多