正在加载...
2008-2
22
发表于: linux/unix, 杂谈 | 作者: xurenlu
标签: ,

今天想把fedora8升级到fedora9,结果先把fedora-release*的包升级以后,发现系统fedora源已经全部变成fedora9的了,但是因几个基本包有问题,我用yum安装什么包都装不了了。
只好回退,结果遇上这样一个问题:

  1. Cannot retrieve repository metadata (repomd.xml) for repository:/var/cache/yum/fedora/mirrorlist.txt

到处查,都搞不懂为什么。最后只好自己查查yum的源代码,再加上我天才般的瞎猜,终于整出来了:
记下过程:
手工建立/var/cache/yum/fedora/和/var/cache/yum/updates两个目录。
编辑/var/cache/yum/fedora/mirrorlist.txt为

  1. # repo = fedora-8 arch = x86_64 country = CN country = RU country = JP country = HK country = KR country = TW country = TH country = IN
  2. http://fedora.candishosting.com.cn/pub/fedora/linux/releases/8/Everything/x86_64/os
  3. http://opensource.nchc.org.tw/fedora/linux/releases/8/Everything/x86_64/os
  4. http://ftp.twaren.net/Linux/Fedora/linux/releases/8/Everything/x86_64/os
  5. http://linux.ntcu.net/ftp/dists/fedora/releases/8/Everything/x86_64/os
  6. http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/releases/8/Everything/x86_64/os
  7. http://ftp.hostrino.com/pub/fedora/linux/releases/8/Everything/x86_64/os
  8. ftp://ftp.rhd.ru/pub/fedora/linux/releases/8/Everything/x86_64/os
  9. http://ftp.cse.yzu.edu.tw/pub/Linux/Fedora/releases/8/Everything/x86_64/os
  10. http://ftp.chg.ru/pub/Linux/fedora/linux/releases/8/Everything/x86_64/os
  11. http://ftp.jaist.ac.jp/pub/Linux/Fedora/releases/8/Everything/x86_64/os
  12. http://ftp.ncnu.edu.tw/Linux/Fedora/linux/releases/8/Everything/x86_64/os
  13. http://allotter.yandex.net/fedora/linux/releases/8/Everything/x86_64/os
  14. http://ftp.kddilabs.jp/Linux/packages/fedora/releases/8/Everything/x86_64/os
  15. http://ftp.kaist.ac.kr/pub/fedora/linux/releases/8/Everything/x86_64/os
  16. ftp://ftp.sfc.wide.ad.jp/pub/Linux/Fedora/releases/8/Everything/x86_64/os
  17. http://ftp.riken.jp/Linux/fedora/releases/8/Everything/x86_64/os
  18. http://spreader.yandex.net/fedora/linux/releases/8/Everything/x86_64/os

编辑/var/cache/yum/updates/mirrorlist.txt为:

  1. # repo = updates-released-f8 arch = x86_64 country = RU country = JP country = HK country = CY country = SG country = TW country = TH country = IN
  2. http://spreader.yandex.net/fedora/linux/updates/8/x86_64
  3. http://ftp.kddilabs.jp/Linux/packages/fedora/updates/8/x86_64
  4. http://allotter.yandex.net/fedora/linux/updates/8/x86_64
  5. http://ftp.hostrino.com/pub/fedora/linux/updates/8/x86_64
  6. http://ftp.riken.jp/Linux/fedora/updates/8/x86_64
  7. ftp://ftp.oss.eznetsols.org/linux/fedora/updates/8/x86_64
  8. ftp://ftp.sfc.wide.ad.jp/pub/Linux/Fedora/updates/8/x86_64
  9. http://opensource.nchc.org.tw/fedora/linux/updates/8/x86_64
  10. http://ftp.jaist.ac.jp/pub/Linux/Fedora/updates/8/x86_64
  11. http://mirrors.cytanet.com.cy/linux/fedora/linux/updates/8/x86_64

大功告成。
再运行yum install mplayer,一切正常。
原因(个人瞎猜版):
/var/cache/yum/下是yum的缓存目录。当我运行yum clean all时,把这两个目录下的一些文件清空了。但是可能yum存在一个bug,
/var/cache/yum/fedora/repomd.xml能重新下载生成,/var/cache/yum/fedora/mirrotlist.txt却不能正常生成。因此需要我们手工构造这个文件。
那我是怎么构造这个文件的内容的呢?
注意看/etc/yum.repos.d/fedora.repod文件,中有

  1. mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch

$releasever应该是8(我用的是fedora 8),$basearch是架构的意思,我的是x86_64,替换上,访问之,得到:

  1. # repo = fedora-8 arch = x86_64 country = CN country = RU country = JP country = HK country = KR country = TW country = TH country = IN
  2. http://fedora.candishosting.com.cn/pub/fedora/linux/releases/8/Everything/x86_64/os
  3. http://opensource.nchc.org.tw/fedora/linux/releases/8/Everything/x86_64/os
  4. http://ftp.twaren.net/Linux/Fedora/linux/releases/8/Everything/x86_64/os
  5. http://linux.ntcu.net/ftp/dists/fedora/releases/8/Everything/x86_64/os
  6. http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/releases/8/Everything/x86_64/os
  7. http://ftp.hostrino.com/pub/fedora/linux/releases/8/Everything/x86_64/os
  8. ftp://ftp.rhd.ru/pub/fedora/linux/releases/8/Everything/x86_64/os
  9. http://ftp.cse.yzu.edu.tw/pub/Linux/Fedora/releases/8/Everything/x86_64/os
  10. http://ftp.chg.ru/pub/Linux/fedora/linux/releases/8/Everything/x86_64/os
  11. http://ftp.jaist.ac.jp/pub/Linux/Fedora/releases/8/Everything/x86_64/os
  12. http://ftp.ncnu.edu.tw/Linux/Fedora/linux/releases/8/Everything/x86_64/os
  13. http://allotter.yandex.net/fedora/linux/releases/8/Everything/x86_64/os
  14. http://ftp.kddilabs.jp/Linux/packages/fedora/releases/8/Everything/x86_64/os
  15. http://ftp.kaist.ac.kr/pub/fedora/linux/releases/8/Everything/x86_64/os
  16. ftp://ftp.sfc.wide.ad.jp/pub/Linux/Fedora/releases/8/Everything/x86_64/os
  17. http://ftp.riken.jp/Linux/fedora/releases/8/Everything/x86_64/os
  18. http://spreader.yandex.net/fedora/linux/releases/8/Everything/x86_64/os

这就是/var/cache/yum/fedora/mirrorlist.txt的内容了。
对应地,查看/etc/yum.repos.d/fedora-updates.repo,去访问对应的地址,取得内容写入到/var/cache/yum/updates/mirrorlist.txt.

: http://www.162cm.com/archives/597.html

本文相关评论 - 才 2 条评论
匿名
2008-02-23 11:38:24

要你的电话

2008-02-23 12:06:47

可以邮件给我吧?
xurenlu#126.com