[Linux] 在 CentOS 7 上安裝 Dropbox 後,yum 無法使用的問題
最近在電腦上新安裝了 CentOS 7,今天也裝好了 Dropbox (for Fedora 版本),
正想用 yum 裝其他東西的時候,意外的出現了錯誤訊息:
Loaded plugins: fastestmirror, langpacks http://linux.dropbox.com/fedora/7/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found Trying other mirror. One of the configured repositories failed (Dropbox Repository), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Disable the repository, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable Dropbox 4. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=Dropbox.skip_if_unavailable=true failure: repodata/repomd.xml from Dropbox: [Errno 256] No more mirrors to try. http://linux.dropbox.com/fedora/7/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
感覺上像是 yum 連不上 dropbox 的 repository (不知道為啥 dropbox 會加一個 repository?)
試了一下它出現錯誤的網址 http://linux.dropbox.com/fedora/7/repodata/repomd.xml,
的確是 HTTP 404 error 連不到…
看一下 /etc/yum.repos.d/dropbox.repo,
它的內容長這樣:
[Dropbox] name=Dropbox Repository baseurl=http://linux.dropbox.com/fedora/$releasever/ gpgkey=https://linux.dropbox.com/fedora/rpm-public-key.asc
嗯,看來那個 baseurl 裡面的 $releasever 很可疑…
從 Yum: How can I view variables like $releasever, $basearch & $YUM0? 這篇,
查到可以用 python 程式查出 $releasever 的值,執行如下:
$ python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)' Loaded plugins: fastestmirror, langpacks {'arch': 'ia32e', 'basearch': 'x86_64', 'infra': 'stock', 'releasever': '7', 'uuid': '76cc7204-376a-442a-ae97-52bcd092b3c9'}
也就是說,將 $releasever 替換成 7 (我的 CentOS 版本) 之後,
Dropbox 這個 repository 會試著去連 http://linux.dropbox.com/fedora/7/ …
不過連上去 http://linux.dropbox.com/fedora/ 的話,
可以注意到並沒有 7 的目錄,只有像是 19, 20 之類的 Fedora 的版號…
嗯… 試試看 http://linux.dropbox.com/ 下面有沒有其他給 CentOS 用的目錄…
看來沒有,只有 debian/fedora/ubuntu…
雖說 CentOS 一般是企業用戶在使用,但既然它跟 Fedora/RHEL 系出同門,
總覺得應該 Dropbox 也要給他一個專用的目錄…
要不然至少修好這個問題…
目前的 workaround 就是,把 /etc/yum.repos.d/dropbox.repo 裡面那個 $releasever 改掉,
換成 19 或 20 (因為 CentOS 7 是用 Fedora 19 再加上 Fedora 20 的一些 fix),
就可以囉 (或是要關掉也可以啦)~
改完後像這樣:
[Dropbox] name=Dropbox Repository #baseurl=http://linux.dropbox.com/fedora/$releasever/ baseurl=http://linux.dropbox.com/fedora/20/ gpgkey=https://linux.dropbox.com/fedora/rpm-public-key.asc