Repository updates is listed more than once in the configuration问题的解决方法

这种情况会出现在你配置多个源的时候,直接用官网上源的配置方法配置多个源不做修改就会出现这个问题

Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration

 原因也很简单,从上面的提示就可以看出来在某个配置(configuration)文件里updates, updates-debuginfo , updates-source等出现了不只一次,所以我们很自然的想到观察一下这些源的相关配置

回想到我们在配置源的时候只用到了.repo结尾的文件,所以我们从自己配置的.repo 文件中寻找出路

执行下列指令

 cat /etc/yum.repos.d/fedora-updates.repo 

你会发现类似以下输出(因为我的fedora-updates.repo是阿里的所以你的输出会和我的有一些区别)

[updates]
name=Fedora $releasever - $basearch - Updates - aliyun
failovermethod=priority 
baseurl=http://mirrors.aliyun.com/fedora/updates/$releasever/$basearch/ 
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch 
enabled=1 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch 
 
[updates-debuginfo] 
name=Fedora $releasever - $basearch - Updates - Debug -aliyun
failovermethod=priority 
baseurl=http://mirrors.aliyun.com/fedora/updates/$releasever/$basearch/debug/ 
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch 
enabled=0 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch 
 
[updates-source] 
name=Fedora $releasever - Updates Source - aliyun
failovermethod=priority 
baseurl=http://mirrors.aliyun.com/fedora/updates/$releasever/SRPMS/ 
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch 
enabled=0 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch 

观察每一段的开头就可以发现,每一段开头中括号里的内容就是上述列出的单词,当你在查看其他*-updates.repo文件时可以发现同样的输出,这便是症结所在

解决的方法也很简单就是把这些段落开头的中括号里的内容修改一下,比如我的中科大源的更新的配置(fedora-ustc-updates.repo)

[updates-ustc]
name=Fedora $releasever - $basearch - Updates - ustc
failovermethod=priority
baseurl=https://mirrors.ustc.edu.cn/fedora/updates/$releasever/$basearch/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

[updates-ustc-debuginfo]
name=Fedora $releasever - $basearch - Updates - Debug - ustc
failovermethod=priority
baseurl=https://mirrors.ustc.edu.cn/fedora/updates/$releasever/Everything/$basearch/debug/tree/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

[updates-ustc-source]
name=Fedora $releasever - Updates Source - ustc
failovermethod=priority
baseurl=https://mirrors.ustc.edu.cn/fedora/updates/$releasever/Everything/source/tree/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

只是把段落开头的中括号里的updates改为updates-ustc 把updates-debuginfo改为updates-ustc-debuginfo等,如果你还有其他源也可以这样修改就行了

全部修改完毕后更新一下就好

 sudo dnf makecache 

另外中科大源的更新有点小问题,下一篇文章会记录下来。

原文地址:https://www.cnblogs.com/mrway/p/9626255.html