在我的CentOS 8服务器上,许多dnf
和yum
命令由于这个错误而失败:
未能下载回购的元数据
这似乎只适用于涉及https连接的存储库,例如:
/etc/yum.repos.d $ cat epel-modular.repo
[epel-modular]
name=Extra Packages for Enterprise Linux Modular $releasever - $basearch/pub/epel/$releasever/Modular/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=$basearch&infra=$infra&content=$contentdir
...
我使用wget
测试到这些站点的连接性,它是成功的,例如wget https://mirrors.fedoraproject.org
成功。
但是,各种dnf
或yum
命令都会失败:
$ dnf provides /bin/ls
Extra Packages for Enterprise Linux Modular 8 - x86_64 0.0 B/s | 0 B 00:00
Failed to download metadata for repo 'epel-modular'
Error: Failed to download metadata for repo 'epel-modular'
# dnf update --refresh
CentOS-8 - AppStream 20 kB/s | 4.3 kB 00:00
CentOS-8 - Base 19 kB/s | 3.8 kB 00:00
CentOS-8 - Extras 7.4 kB/s | 1.5 kB 00:00
CentOS-8 - PowerTools 20 kB/s | 4.3 kB 00:00
Remi's Modular repository for Enterprise Linux 8 - x86_64 4.1 kB/s | 3.5 kB 00:00
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 3.6 kB/s | 3.0 kB 00:00
Wazuh repository 0.0 B/s | 0 B 00:00
Failed to download metadata for repo 'wazuh_repo'
Error: Failed to download metadata for repo 'wazuh_repo'
我如何解决这个问题?
发布于 2020-02-07 05:02:12
发布于 2020-03-08 08:16:25
我在一个码头容器内的Centos8构建中也遇到了同样的错误。通过运行以下命令进行修正:
# Do on build
RUN dnf clean all && rm -r /var/cache/dnf && dnf upgrade -y && dnf update -y
错误之前(我运行的是yum更新而不是dnf):
Step 4/5 : RUN yum clean all && yum update -y && echo hostname -a
---> Running in 10d319da361d
0 files removed
CentOS-8 - AppStream 0.0 B/s | 0 B 00:05
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'
在以下方面取得成功:
---> 0b96049ee5eb
Step 4/5 : RUN dnf clean all && rm -r /var/cache/dnf && dnf upgrade -y && dnf update -y & echo hostname
---> Running in f928c6da6cb0
hostname
Removing intermediate
发布于 2020-04-29 22:41:50
我只是面对这个问题,所以我想我应该为我补充一下解决方案,因为决议很简单。对我来说,我忽略了这样一个事实,即每当我更改主机名时,它都会删除/etc/drv.conf中的所有内容,因此我:
nano -w /etc/resolv.conf
**yum update -y
)**注意:我在示例中使用了nano,只需将nano
部分替换为您自己选择的文本编辑器
https://stackoverflow.com/questions/59993633
复制相似问题