Linux

CentOS 5.7 - 無法檢索儲存庫元數據

  • September 22, 2011

我今天遇到了這個奇怪的錯誤,我無法修復它:

root@server# yum -y update
Loaded plugins: allowdowngrade
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. </html>/
removing mirrorlist with no valid mirrors: /var/cache/yum/addons/mirrorlist.txt
Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its 
path and try again
root@server#

禁用回購“外掛”:

root@server# yum update --disablerepo=addons
Loaded plugins: allowdowngrade
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. </html>/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
root@server#

用“yum clean all”:

root@server# yum clean all
Loaded plugins: allowdowngrade
Cleaning up Everything
root@server# yum -y update
Loaded plugins: allowdowngrade
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. </html>/
removing mirrorlist with no valid mirrors: /var/cache/yum/addons/mirrorlist.txt
Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again
root@server#

編輯 22-09-2011: rpm –verify centos-release yum

root@server# rpm --verify centos-release yum
..5....T  c /etc/issue
..5....T  c /etc/issue.net
S.5....T  c /etc/yum.repos.d/CentOS-Base.repo
missing   c /etc/yum.repos.d/CentOS-Debuginfo.repo
S.5....T  c /etc/yum.repos.d/CentOS-Vault.repo
package yum is not installed
root@server#

我該如何解決這個問題?

“無法檢索儲存庫元數據”錯誤看起來像一個紅鯡魚。真正的錯誤似乎是這樣的:

YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. </html>/

您的 Yum 回購文件是否損壞?

和的文件由 和 包提供/etc/yum.conf(用 測試)。/etc/yum.repos.d/*.repo``yum``centos-release``rpm -q --whatprovides /etc/yum.conf /etc/yum.repos.d/*

嘗試/etc/yum.repos.d/根據 RPM 文件驗證文件。有沒有發生任何變化?

在以下範例中,文件 CentOS-Base.repo 已在本地修改:

% rpm --verify centos-release yum
S.5....T  c /etc/yum.repos.d/CentOS-Base.repo

如果您發現這些文件確實已被更改,那麼您可以嘗試重新安裝 rpms,或者僅提取您需要的幾個文件並手動將它們移動到位。首先備份您的舊文件,以便稍後進行調查。

引用自:https://serverfault.com/questions/314120