1. 程式人生 > >CentOS下的Cannot find a valid baseurl for repo: warning:fedora錯誤

CentOS下的Cannot find a valid baseurl for repo: warning:fedora錯誤

CentOS下的Cannot find a valid baseurl for repo: warning:fedora錯誤

前言

這是筆者在CentOS 7下執行yum update時所發生的錯誤。

錯誤訊息

Geladene Plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
One of the configured repositories failed (Unbekannt),
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. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> …
4. Disable the repository permanently, 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 <repoid>
or
subscription-manager repos --disable=<repoid>
5. 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=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: warning:fedora

解決方法

方法一

一個簡單的方法是在yum xxx後面加上--disablerepo=warning:fedora這個flag,即

yum update --disablerepo=warning:fedora

但這只一個治標不治本的方法。

方法二

筆者試過了CentOS 5 “cannot find a valid baseurl for repo” Error FixHow can I fix “cannot find a valid baseurl for repo” errors on CentOS?中的幾個方法,如:

  1. 修改/etc/yum.repos.d/CentOS-Base.repo
  2. rm /etc/yum.repos.d/Cen*

但是都起不了作用。

如果後續有發現真正從根本解決問題的方法,將再持續更新。

參考連結

CentOS 5 “cannot find a valid baseurl for repo” Error Fix
How can I fix “cannot find a valid baseurl for repo” errors on CentOS?