centos8.0 软件仓库报错Failed to synchronize cache for repo ‘base‘, ignoring this repo.

2022/2/3 7:12:36

本文主要是介绍centos8.0 软件仓库报错Failed to synchronize cache for repo ‘base‘, ignoring this repo.,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

遇到的问题

以使用curl命令安装阿里centos8的镜像仓库,使用dnf repolist查看仓库时遇见如下报错

[root@localhost ~]# yum repolist
CentOS-8 - AppStream - mirrors.aliyun.com                   0.0  B/s |   0  B     00:24    
CentOS-8 - Base - mirrors.aliyun.com                        0.0  B/s |   0  B     00:24    
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Failed to synchronize cache for repo 'base', ignoring this repo.
Last metadata expiration check: 0:23:35 ago on Wed 02 Feb 2022 08:52:22 AM EST.
repo id                    repo name                                                  status
extras                     CentOS-8 - Extras - mirrors.aliyun.com                     38

解决方法

查看dnf日志文件(/var/log/dnf.log)

2022-02-02T14:37:46Z DEBUG Cannot download 'https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried.
2022-02-02T14:37:46Z DEBUG repo: downloading from remote: base
2022-02-02T14:37:56Z DEBUG not found other for: CentOS-8 - Base - mirrors.aliyun.com
2022-02-02T14:37:56Z DEBUG not found modules for: CentOS-8 - Base - mirrors.aliyun.com

发现报错原因,并参试使用浏览器访问该网站,发现访问不了,可能是阿里方面维护或下线了该仓库

将软件仓库更改成华为仓库

# 删除原来的阿里软件仓库
[root@localhost ~]# rm -rf /etc/yum.repos.d/CentOS-Base.repo
# 下载华为centos8版本的软件仓库
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo

再次测试仓库是否可用

# 清理仓库缓存
[root@localhost ~]# dnf clean all
# 重新生成缓存并查看仓库软件包数量
[root@localhost ~]# dnf repolist
CentOS-8 - AppStream - repo.huaweicloud.com                 2.0 MB/s | 8.4 MB     00:04    
CentOS-8 - Base - repo.huaweicloud.com                      1.6 MB/s | 4.6 MB     00:02    
CentOS-8 - PowerTools - repo.huaweicloud.com                866 kB/s | 2.3 MB     00:02    
CentOS-8 - Extras - repo.huaweicloud.com                    4.3 kB/s |  10 kB     00:02    
repo id                   repo name                                                   status
AppStream                 CentOS-8 - AppStream - repo.huaweicloud.com                 5,596
BaseOS                    CentOS-8 - Base - repo.huaweicloud.com                      1,896
PowerTools                CentOS-8 - PowerTools - repo.huaweicloud.com                1,693
extras                    CentOS-8 - Extras - repo.huaweicloud.com                       38

可以看到,软件仓库已经没有问题



这篇关于centos8.0 软件仓库报错Failed to synchronize cache for repo ‘base‘, ignoring this repo.的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程