0

I was trying to use yum on a Centos 7 cluster to install a package, and I was getting the following error:

One of the configured repositories failed (Unknown), 
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: [...]

I tried several suggested solutions online (yum clean all; deleting the cache; deleting the repo-databases and rebuilding, etc.) and nothing worked.

After hours of troubleshooting, I managed to find a workaround. On the /etc/yum.repos.d/CentOS-Base.repo file, I uncommented the baseurl line and replaced the $releasever variable with "7" (i.e. the version of the OS). For some reason, yum could not recognize $releasever and could not find the repo.

So instead of:

baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

I have:

baseurl=http://mirror.centos.org/centos/7/os/$basearch/

after which both yum update and yum install seem to work fine. However, I don't know if this is a permanent solution to the issue.

Can someone tell me what's going on and if there's a more proper way to fix this problem?

Thanks.

3
  • What does this command return? rpm -q --qf "%{VERSION}\n" --whatprovides redhat-release
    – jsbillings
    Commented Apr 8, 2020 at 15:47
  • @jsbillings It returns 7.
    – johnymm
    Commented Apr 8, 2020 at 21:18
  • for me it returned "7.9" which is no good as $releasever should be "7Server" in my case!
    – anthony
    Commented Dec 14, 2023 at 2:08

2 Answers 2

1

I recently had this problem. Setting releasever worked for me. I also found that I could fix the distroverpkg setting in /etc/yum.conf.

I set it to:

distroverpkg=centos-release

This worked for me.

0

I found the solution.

yum --installroot=/usr/local install nginx --releasever=7

but why it is failed was still not figured out.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .