日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

解決yum [Errno -1] Metadata file does not match checksum

發(fā)布時(shí)間:2025/5/22 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 解決yum [Errno -1] Metadata file does not match checksum 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

?yum clean all

yum clean metadata

yum makecache --disableplugin=fastestmirror

升級(jí)os:

yum update

?

You can try doing?sudo yum clean all?or?sudo rm -rf?
/var/cache/yum
.
Follow that with?yum check-update. You may still?
get those errors, if so, the
problem is on the other end, they have invalid?
or corrupted data and you'll have to wait
for your mirrors to resync with?
correct data.

If you don't want to wait, you can manually download the?
updates and use the
yum localinstall method.

分享到:?

? ?最近發(fā)現(xiàn),在使用yum更新包的時(shí)候,常報(bào)下面的錯(cuò)誤:

引用 Reading repository metadata in from local files
primary.xml.gz ? ? ? ? ? ?100% |=========================| 1.7 MB ? ?02:25
http://www.mirrorservice.org/sites/apt.sw.be/redhat/el4/en/i386/dag/repodata/primary.xml.gz:?
[Errno -1]?Metadata file does not match checksum
Trying other mirror.


? ?有時(shí)候當(dāng)替換了幾個(gè)鏡像后就可以了。但經(jīng)常也會(huì)發(fā)現(xiàn)最終是失敗的。由于我的系統(tǒng)是依賴yum更新的,若使用國(guó)外網(wǎng)絡(luò)源的時(shí)候出這樣的問題,影響挺大的。
? ?Google搜索了一下,是一個(gè)常見問題,也提供了一些方法。只是后來發(fā)現(xiàn),這些方法要不就是沒有說清楚,要不就是誤解。經(jīng)過測(cè)試,最終基本可以解決了。
一、原因
從該地址找到一段說明:點(diǎn)擊

引用 To reduce load, download.fedora.redhat.com (official host) contains the ~1kB checksum for the metadata. The metadata (usually ~1 - 2 MB) is downloaded off mirrors. After downloading metadata, Yum compares the two to make sure they're one and the same.
Now, think of this: download.fedora.redhat.com updates their metadata and checksums, so you're getting the new checksum. The mirror's cronjobs havn't gone yet, therefore no synching and the metadata isn't the newest, it doesn't match.

The solution is not to makecache; Although it may help it will take forever and still not 100% solve the problem. The main problem is not giving the mirrors enough synch time. Typically, cron runs every hour, and give it a bit of time to download the changes, so I'd say try running maybe 10 minutes after an hour and you'll have no problem (eg 3:10, 4:10, 5:10, etc...). If you get closer to :50 (3:50, :50, etc) you'll start seeing more syncing issues.

Again, this too isn't 100% perfect but more of a guideline. There's a lot of guesswork...


大概的意思是說:

引用 當(dāng) 生成metadata數(shù)據(jù)的時(shí)候,會(huì)一同產(chǎn)生校驗(yàn)數(shù)據(jù)。而傳輸?shù)臅r(shí)候,會(huì)用該校驗(yàn)數(shù)據(jù)判斷metadata是否完整。這時(shí)候就會(huì)產(chǎn)生一個(gè)問 題,mirror鏡像當(dāng)從源網(wǎng)絡(luò)拷貝數(shù)據(jù)回來時(shí),下載了metadata,但還沒下載校驗(yàn)數(shù)據(jù)(或由定時(shí)任務(wù)產(chǎn)生校驗(yàn)數(shù)據(jù),但這時(shí)定時(shí)任務(wù)還沒有執(zhí)行)。 這時(shí),如果剛好你正使用yum從該鏡像更新,就會(huì)發(fā)生Metadata file does not match checksum的問題了。
文中提供的解決方法是,根據(jù)大部分的鏡像都是每小時(shí)進(jìn)行一次數(shù)據(jù)同步或生成校驗(yàn)數(shù)據(jù)的,所以,不要選擇接近整點(diǎn)的時(shí)候更新數(shù)據(jù),而應(yīng)選擇整點(diǎn)過后再更新。但這只是建議,不能保證一定能解決該問題。


參考該文章的內(nèi)容,我們可以看看yum更新下載的數(shù)據(jù): /var/cache/yum,根據(jù)你定義的repo.d文件內(nèi)容,會(huì)分開多層目錄,每層代表一個(gè)更新路徑。

引用 例如:/var/cache/yum/rpmforge
其中,primary.xml.gz、filelists.xml.gz、和other.xml.gz就是metadata信息,而repomd.xml就是校驗(yàn)數(shù)據(jù)。其使用的是sha1進(jìn)行校驗(yàn)的。


找到原因,解決就不難了。

二、解決
1、清空緩存
執(zhí)行:

# yum clean all


先把就的緩存數(shù)據(jù)都去掉。

2、下載metadata和校驗(yàn)數(shù)據(jù)
先進(jìn)入yum對(duì)應(yīng)的目錄,再下載:

# cd /var/cache/yum/rpmforge
# wget --cache=off http://apt.sw.be/redhat/el4/en/i386/dag/repodata/repomd.xml
# wget --cache=off http://apt.sw.be/redhat/el4/en/i386/dag/repodata/primary.xml.gz
# wget --cache=off http://apt.sw.be/redhat/el4/en/i386/dag/repodata/filelists.xml.gz
# wget --cache=off http://apt.sw.be/redhat/el4/en/i386/dag/repodata/other.xml.gz



3、校驗(yàn)數(shù)據(jù)
執(zhí)行:

引用 # sha1sum other.xml.gz filelists.xml.gz primary.xml.gz
74fcc9f9e218cfdbc1ac2b5ac17ff7d912267bdf ?other.xml.gz
3f4b2e9a5efc67c0cdf329c69f041daa82a2346c ?filelists.xml.gz
bd2033e1fd7a7d1f1b92ce7b880919bd685217f8 ?primary.xml.gz


對(duì)比repomd.xml中的信息:

引用 # cat repomd.xml |grep -w 'checksum'|grep -v 'open-checksum'
? ?<checksum type="sha">74fcc9f9e218cfdbc1ac2b5ac17ff7d912267bdf</checksum>
? ?<checksum type="sha">3f4b2e9a5efc67c0cdf329c69f041daa82a2346c</checksum>
? ?<checksum type="sha">bd2033e1fd7a7d1f1b92ce7b880919bd685217f8</checksum>


若數(shù)據(jù)正確,則說明metadata和校驗(yàn)數(shù)據(jù)是匹配的。可以使用yum更新了,不會(huì)再重新下載metadata。
否則,可以再等待一下,或需要從其他的鏡像獲取更新咯。

三、建議
因?yàn)槲覀儾荒芸刂歧R像更新的速度和時(shí)間,而我們的工作只是避免了yum可能發(fā)生誤判的情況,但并不能完全保證上面的工作是成功的。
從盡可能避免該問題的角度出發(fā),有幾個(gè)建議:
1、選擇好的鏡像
設(shè)置yum.repos.d中baseurl或mirrorlist從好的鏡像下載。若知道某個(gè)鏡像速度快,則干脆用baseurl固定,而不要使用mirrorlist了。

2、排查網(wǎng)絡(luò)問題
網(wǎng)上提供的方法大部分是轉(zhuǎn)載這里的。其建議使用--cache=off參數(shù)(表示不使用服務(wù)器中的高速緩存中的數(shù)據(jù))。
但實(shí)際上,我發(fā)現(xiàn)除非網(wǎng)絡(luò)有問題,否則是否使用該參數(shù)拿回來的數(shù)據(jù)不應(yīng)該有有區(qū)別的。
如:

引用 # sha1sum primary.xml.gz*
bd2033e1fd7a7d1f1b92ce7b880919bd685217f8 ?primary.xml.gz
bd2033e1fd7a7d1f1b92ce7b880919bd685217f8 ?primary.xml.gz.1


※primary.xml.gz是使用--cache=off參數(shù)的,而primary.xml.gz.1是沒有使用該參數(shù)的。
所以,如果網(wǎng)絡(luò)出現(xiàn)問題,是會(huì)影響到y(tǒng)um下載數(shù)據(jù)的完整性的。而使用--cache=off既然沒壞,不妨使用咯。

四、參考資料
http://lists.freshrpms.net/pipermail/freshrpms-list/2005-May/013037.html
http://lists.freshrpms.net/pipermail/freshrpms-list/2004-November/011553.html
http://www.fedorachina.cn/index.php?topic=26.0
http://www.linuxsir.org/bbs/printthread.php?t=316600

http://sillyboy422.spaces.live.com/blog/cns!aab0c086212d33cc!195.entry?

轉(zhuǎn)載于:https://blog.51cto.com/2816056/1167211

總結(jié)

以上是生活随笔為你收集整理的解決yum [Errno -1] Metadata file does not match checksum的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。