Steel /stēl/ Verb: Mentally prepare (oneself) to do or face something difficult.

20Aug/180

On $releasever and rpmdb

A few days ago a coworker inquired about an odd error:

https://cdn.redhat.com/content/dist/rhel/server/7/%24releasever/x86_64/optional/os/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

The inclusion of the '%24relesever" in the URL was extremely weird, the question was how did it get there? The answer is a bit complicated.

As most folks who are reading this will probably be aware the yum.conf file can substitute certain variables listed in a repo defintion, from man yum.conf:

REPO VARIABLES
       Right side of every repo option can be enriched by the following  variables:

       $arch
          Refers to the system’s CPU architecture e.g, aarch64, i586, i686 andx86_64.

       $basearch
          Refers to the base architecture of the system. For example, i686 and i586  machines  both have a base architecture of i386, and AMD64 and Intel64 machines have a base architecture of x86_64.

       $releasever
          Refers to the release version of operating system which DNF  derivesfrom information available in RPMDB.

But where exactly does releasever come from? It turns out the answer is this query:

rpm -q --provides $(rpm -q --whatprovides "system-release(releasever)") | grep "^system-release(releasever)"

So on a redhat 7.5 server system, system-release(releasever) is provided by the redhat-release-server package and the system-release(releasever) is set to 7Server.

After re-installing that package, RPM was again able to provide that information to YUM and the error went away since the variable had a value. It was certainly a strange error to run into...

Tagged as: , No Comments
   
This work by Erinn Looney-Triggs is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States.