Detailed explanation of the problem of synchronous warehouse cache failure after CentOS8 replaces yum source

  • 2021-07-26 09:15:54
  • OfStack

Cause of the problem: 1 The default yum source for CentOS 8 works properly at first, but after installing Development Tools with the following command:


yum groupinstall -y "Development Tools"

I don't know why I started to fail to synchronize the warehouse cache, and I couldn't install some toolkits normally. The error prompt is as follows:


[root@localhost /etc/yum.repos.d]# yum makecache
CentOS-8.0 - AppStream                  19 B/s | 38 B   00:02  
CentOS-8.0 - Base                     24 B/s | 38 B   00:01  
CentOS-8.0 - Extras                    8.4 B/s | 38 B   00:04  
 Synchronous warehouse  'AppStream'  Cache failed, ignore this  repo . 
 Synchronous warehouse  'BaseOS'  Cache failed, ignore this  repo . 
 Synchronous warehouse  'extras'  Cache failed, ignore this  repo . 
 Metadata cache has been established. 
[root@localhost /etc/yum.repos.d]#

Therefore, according to the error message, I went online to find relevant solutions. Most of them said to replace Ali's yum source, and then replaced it according to the instructions of the official document:

https://developer.aliyun.com/mirror/centos

I thought it had been solved smoothly, but I didn't think there was a pit. When rebuilding the metadata cache, I still prompted that the synchronous warehouse cache failed:


[root@mesos-master /etc/yum.repos.d]# yum makecache
CentOS-8.0 - AppStream - mirrors.aliyun.com          0.0 B/s |  0 B   00:24  
CentOS-8.0 - Base - mirrors.aliyun.com            0.0 B/s |  0 B   00:32  
CentOS-8.0 - Extras - mirrors.aliyun.com           0.0 B/s |  0 B   00:32  
CentOS-8.0 - Epel                       2.3 MB/s | 6.0 MB   00:02  
WANdisco SVN Repo 1.9                     2.0 kB/s | 121 kB   01:01  
 Synchronous warehouse  'AppStream'  Cache failed, ignore this  repo . 
 Synchronous warehouse  'base'  Cache failed, ignore this  repo . 
 Synchronous warehouse  'extras'  Cache failed, ignore this  repo . 
 Last metadata expiration check: 0:00:01  Before, executed in  2020 Year 03 Month 23 Day   Week 1 10 Hour 26 Points 48 Seconds. 
 Metadata cache has been established. 
[root@mesos-master /etc/yum.repos.d]#

Then puzzled, I thought that the default yum source of the system may not be connected because of the network. The domestic source should not be ah, is there a problem with the configuration? As it turns out, the $releasever and $basearch placeholders in baseurl are somehow invalid. Therefore, the problem is solved after changing $releasever to 8 and $basearch to x86_64. The contents of each modified configuration file are as follows:


### cat CentOS-Base.repo ###
[base]
name=CentOS-8 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/
    http://mirrors.aliyuncs.com/centos/8/BaseOS/x86_64/os/
    http://mirrors.cloud.aliyuncs.com/centos/8/BaseOS/x86_64/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

### cat CentOS-AppStream.repo ###
[AppStream]
name=CentOS-8 - AppStream - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/8/AppStream/x86_64/os/
    http://mirrors.aliyuncs.com/centos/8/AppStream/x86_64/os/
    http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

### cat CentOS-Extras.repo ###
[extras]
name=CentOS-8 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/8/extras/x86_64/os/
    http://mirrors.aliyuncs.com/centos/8/extras/x86_64/os/
    http://mirrors.cloud.aliyuncs.com/centos/8/extras/x86_64/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

### cat CentOS-Epel.repo ###
[epel]
name=CentOS-$releasever - Epel
baseurl=http://mirrors.aliyun.com/epel/8/Everything/$basearch
enabled=1
gpgcheck=0

### cat CentOS-PowerTools.repo ###
[PowerTools]
name=CentOS-8 - PowerTools - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/8/PowerTools/x86_64/os/
    http://mirrors.aliyuncs.com/centos/8/PowerTools/x86_64/os/
    http://mirrors.cloud.aliyuncs.com/centos/8/PowerTools/x86_64/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

### cat CentOS-centosplus.repo ###
[centosplus]
name=CentOS-8 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/8/centosplus/x86_64/os/
    http://mirrors.aliyuncs.com/centos/8/centosplus/x86_64/os/
    http://mirrors.cloud.aliyuncs.com/centos/8/centosplus/x86_64/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

After the above modifications, the problem was solved, and there was no prompt that the synchronization of warehouse cache failed:


[root@localhost /etc/yum.repos.d]# yum makecache
CentOS-8 - AppStream - mirrors.aliyun.com           2.1 MB/s | 6.5 MB   00:03  
CentOS-8 - Base - mirrors.aliyun.com              1.6 MB/s | 5.0 MB   00:03  
CentOS-8 - Extras - mirrors.aliyun.com             1.8 kB/s | 4.2 kB   00:02  
CentOS-8.0 - Epel                       2.2 MB/s | 6.0 MB   00:02  
WANdisco SVN Repo 1.9                     10 kB/s | 121 kB   00:11  
 Metadata cache has been established. 
[root@localhost /etc/yum.repos.d]# 

Related articles: