centos 7.2執行yum -y install報錯Metadata file does not match checksum
分析結論
1,Metadata file does not match checksum報錯在于元文件的校驗值與元文件不匹配
2,元數據是指 mnt/repodata/436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz 這種文件
其所在路徑為 光盤/repodata
3,yum的配置文件分為主配置文件和 各自獨立的配置文件
4,yum主配置文件在/etc/yum.conf
5, yum各自獨立的配置文件在/etc/yum.repos.d/不同的子目錄
6,續上,這個不同的子目錄對應于自定義的yum配置源配置文件
7,yum的本地cache緩存可見yum主配置文件/etc/yum.conf獲取
8,關于元文件的校驗值與元文件的配置信息在 repomd.xml獲取,其具體內容如下:
42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454 --sha256校驗算法
3464f99938d4614cd1c9048a8e78a8016b5fc0732d2aed9108f45a1e58cf3e80
--sha256校驗算法對應的元數據或元文件
1449702849
10
2958583
13557760
9,上述的配置在本地及光盤皆存在
分析明細
1,yum安裝報錯 Metadata file does not match checksum
[root@card2 yum.repos.d]# yum -y install gcc
已加載插件:fastestmirror
base | 3.6 kB 00:00:00
base/group_gz FAILED
file:///mnt/repodata/436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz: [Errno -1] Metadata file does not match checksum 0 B --:--:-- ETA
正在嘗試其它鏡像。
base/primary_db FAILED [ ] 0.0 B/s | 20 kB --:--:-- ETA
file:///mnt/repodata/42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2: [Errno -1] Metadata file does not match checksum/s | 20 kB --:--:-- ETA
正在嘗試其它鏡像。
Determining fastest mirrors
base/primary_db FAILED [ ] 0.0 B/s | 20 kB --:--:-- ETA
file:///mnt/repodata/42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2: [Errno -1] Metadata file does not match checksum/s | 20 kB --:--:-- ETA
正在嘗試其它鏡像。
base/primary_db | 20 kB 00:00:14
file:///mnt/repodata/42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2: [Errno -1] Metadata file does not match checksum
正在嘗試其它鏡像。
2,可見上述的base對應如下配置文件中的[base]
[root@card2 yum.repos.d]# pwd
/etc/yum.repos.d
[root@card2 yum.repos.d]# ll
總用量 8
-rw-r--r--. 1 root root 63 9月 13 09:06 local.repo
-rw-r--r--. 1 root root 557 9月 12 18:28 ori.x
[root@card2 yum.repos.d]# pwd
/etc/yum.repos.d
[root@card2 yum.repos.d]# more local.repo
[base]
name=local-vcd
baseurl=file:///mnt
enabled=1
gpgcheck=0
[root@card2 yum.repos.d]#
3,從報錯可知是加載光盤中的如下很長的文件校驗好像與什么不匹配
[root@card2 yum.repos.d]# ls -l /mnt/repodata/436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
-r--r--r--. 1 root root 158802 12月 10 2015 /mnt/repodata/436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
[root@card2 yum.repos.d]#
上述長文件打不開
[root@card2 yum.repos.d]# strings /mnt/repodata/436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
[root@card2 yum.repos.d]# ^C
4,會不會上述加載光盤中的長文件與光盤對應目錄的配置文件repomd.xml有什么關系呢
[root@card2 repodata]# pwd
/mnt/repodata
[root@card2 repodata]# more repomd.xml
1449702798
3eda3fefdbaf4777fcab430c80bc438293c512f22fd706b12c6567d535b2142a
1449702849
746824
cfa741341d5d270d5b42d6220e2908d053c39a2d8346986bf48cee360e6f7ce8
cf0c38f2d85b81e960c77d48e6abd48f521caa9ec83662e308dbb53bc62c0ead
1449702839
2997550
37183151
---可見是這個報錯了,里面內容包括 checksum校驗值以及引用的文件
436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98
3eda3fefdbaf4777fcab430c80bc438293c512f22fd706b12c6567d535b2142a
1449702849
158802
6990209f63a9fd811f13e830ac3c6de4c5d70a42b1c6873e4329b523d394c3bd
76a6786b724d57813cba57980917809d4dc3eefba5a6a11a2432d6bbd2fd6233
1449702839
1430575
11601661
42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454
3464f99938d4614cd1c9048a8e78a8016b5fc0732d2aed9108f45a1e58cf3e80
1449702849
10
2958583
13557760
9710c85f1049b4c60c74ae5fd51d3e98e4ecd50a43ab53ff641690fb164a6d63
a0422ef0698b20718bf4c013cbb1c4f10456432eaf5d3a4afd9955ed6968aaf7
1449702841
10
1259881
7371776
40bac61f2a462557e757c2183511f57d07fba2c0dd63f99b48f0b466b7f2b8d2
46168cc31d3f6872bbccf30d495bd8e5d8f631669285b693e2bd66373aa32f9c
1449702839
975743
7907616
d863fcc08a4e8d47382001c3f22693ed77e03815a76cedf34d8256d4c12f6f0d
3f18b4fee4a56bb57bed280bbc9d0f285d94c2bab6cddd4292681b7073dbe27c
1449702846
10
2995501
18021376
[root@card2 repodata]#
5,從本地來看,校驗值也是匹配的
[root@card2 base]# pwd
/var/cache/yum/x86_64/7/base
436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98
3eda3fefdbaf4777fcab430c80bc438293c512f22fd706b12c6567d535b2142a
1449702849
158802
6,再嘗試另一個角度分析,對比現在不正常的這個與集群節點1正常的對應目錄進行對比分析
---當前節點不正常
[root@card2 base]# pwd
/var/cache/yum/x86_64/7/base
[root@card2 base]# ll
總用量 8
drwxr-xr-x. 2 root root 6 9月 13 09:06 gen
drwxr-xr-x. 2 root root 6 9月 12 14:18 packages
-rw-r--r--. 1 root root 3732 12月 10 2015 repomd.xml
---集群節點正常
[root@card1 c7-media]# pwd
/var/cache/yum/x86_64/7/c7-media
[root@card1 c7-media]# ll
總用量 3064
-rw-r--r--. 1 root root 2958583 12月 10 2015 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2
-rw-r--r--. 1 root root 158802 12月 10 2015 436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
-rw-r--r--. 1 root root 0 9月 12 15:49 cachecookie
drwxr-xr-x. 2 root root 30 9月 12 15:49 gen
drwxr-xr-x. 2 root root 6 9月 12 15:48 packages
-rw-r--r--. 1 root root 3732 12月 10 2015 repomd.xml
[root@card1 c7-media]#
7,根據上述分析,從光盤對應目錄把上述的長文件復制到本地對應目錄中
[root@card2 repodata]# cp 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2 /var/cache/yum/x86_64/7/base
cp:是否覆蓋"/var/cache/yum/x86_64/7/base/42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2"? yes
cp: 讀取"42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2" 時出錯: 輸入/輸出錯誤
cp: 擴展"/var/cache/yum/x86_64/7/base/42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2" 失敗: 輸入/輸出錯誤
[root@card2 repodata]# cp 436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz /var/cache/yum/x86_64/7/base
cp: 讀取"436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz" 時出錯: 輸入/輸出錯誤
cp: 擴展"/var/cache/yum/x86_64/7/base/436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz" 失敗: 輸入/輸出錯誤
[root@card2 repodata]#
[root@card2 base]# touch cachecookie
[root@card2 base]# ll
總用量 28
-r--r--r--. 1 root root 20480 9月 13 10:15 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2
-r--r--r--. 1 root root 0 9月 13 10:16 436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
-rw-r--r--. 1 root root 0 9月 13 10:17 cachecookie
drwxr-xr-x. 2 root root 6 9月 13 09:06 gen
drwxr-xr-x. 2 root root 6 9月 12 14:18 packages
-rw-r--r--. 1 root root 3732 12月 10 2015 repomd.xml
8,繼續分析找解決方法
---集群正常節點的
[root@card1 c7-media]# pwd
/var/cache/yum/x86_64/7/c7-media
[root@card1 c7-media]# ll
總用量 3064
-rw-r--r--. 1 root root 2958583 12月 10 2015 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2
-rw-r--r--. 1 root root 158802 12月 10 2015 436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
-rw-r--r--. 1 root root 0 9月 12 15:49 cachecookie
drwxr-xr-x. 2 root root 30 9月 12 15:49 gen
drwxr-xr-x. 2 root root 6 9月 12 15:48 packages
-rw-r--r--. 1 root root 3732 12月 10 2015 repomd.xml
[root@card1 c7-media]# sha256sum 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2
42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2
[root@card1 c7-media]# sha256sum 436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98 436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
[root@card1 c7-media]#
[root@card1 c7-media]# more repomd.xml |grep 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454
42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454
[root@card1 c7-media]#
[root@card1 repodata]# pwd
/mnt/repodata
[root@card1 repodata]# sha256sum 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2
42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2
[root@card1 repodata]#
[root@card1 repodata]# sha256sum 436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98 436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
[root@card1 repodata]#
----節點不正常的
[root@card2 repodata]# pwd
/mnt/repodata
[root@card2 repodata]# sha256sum 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2
sha256sum: 42a80e759522768b2cc357553bb64bd7345b06abeb60187f881089b859a63454-primary.sqlite.bz2: 輸入/輸出錯誤
[root@card2 repodata]#
[root@card2 repodata]# sha256sum 436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz
sha256sum: 436345f4b666f0a461d479ccfabc2c22823d4f2173c2653e5250fea62f0afe98-c7-x86_64-comps.xml.gz: 輸入/輸出錯誤
[root@card2 repodata]#
[root@card2 repodata]# sha256sum 9710c85f1049b4c60c74ae5fd51d3e98e4ecd50a43ab53ff641690fb164a6d63-other.sqlite.bz2
sha256sum: 9710c85f1049b4c60c74ae5fd51d3e98e4ecd50a43ab53ff641690fb164a6d63-other.sqlite.bz2: 輸入/輸出錯誤
[root@card2 repodata]#
[root@card2 ~]# umount /mnt
[root@card2 ~]# mount /dev/cdrom /mnt
mount: /dev/sr0 寫保護,將以只讀方式掛載
[root@card2 ~]# df -h
文件系統 容量 已用 可用 已用% 掛載點
/dev/mapper/centos-root 50G 886M 50G 2% /
devtmpfs 24G 0 24G 0% /dev
tmpfs 24G 0 24G 0% /dev/shm
tmpfs 24G 26M 24G 1% /run
tmpfs 24G 0 24G 0% /sys/fs/cgroup
/dev/mapper/centos-home 1.6T 33M 1.6T 1% /home
/dev/sda1 497M 127M 370M 26% /boot
tmpfs 4.7G 0 4.7G 0% /run/user/0
/dev/sr0 4.1G 4.1G 0 100% /mnt
[root@card2 ~]#
9,可見可能是不正常節點上面掛載的光盤有問題,嘗試替換正常節點的光盤,問題解決