Sample Header Ad - 728x90

Where does the value of `$releasever` come from on RHEL?

1 vote
1 answer
143 views
I'm installing epel-release in two different RHEL 9.4-based containers:
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm  -E %{rhel}).noarch.rpm
One is based on:
$ grep ^VERSION /etc/os-release
VERSION="9.20241104.0.4 (Plow)"
VERSION_ID=9.4
And the other is based on:
$ grep ^VERSION /etc/os-release
VERSION="9.20241008.0.4 (Plow)" 
VERSION_ID=9.4
In the 9.20241008.0.4 variant, this works fine:
bash-5.1# yum --disablerepo=\* --enablerepo=epel makecache
[...]
Extra Packages for Enterprise Linux 9 - x86_64                                                                119 kB/s |  35 kB     00:00
Metadata cache created.
But on the 9.20241104.0.4 version, accessing EPEL fails with a 404 error:
bash-5.1# yum --disablerepo=\* --enablerepo=epel makecache
[...]
Extra Packages for Enterprise Linux 9.4 - x86_64                                                               83 kB/s | 144 kB     00:01
Errors during downloading metadata for repository 'epel':
  - Status code: 404 for https://mirrors.fedoraproject.org/metalink?repo=epel-9.4&arch=x86_64&infra=$infra&content=$contentdir  (IP: 152.19.134.198)
  - Status code: 404 for https://mirrors.fedoraproject.org/metalink?repo=epel-9.4&arch=x86_64&infra=$infra&content=$contentdir  (IP: 38.145.60.21)
  - Status code: 404 for https://mirrors.fedoraproject.org/metalink?repo=epel-9.4&arch=x86_64&infra=$infra&content=$contentdir&countme=1  (IP: 8.43.85.67)
  - Status code: 404 for https://mirrors.fedoraproject.org/metalink?repo=epel-9.4&arch=x86_64&infra=$infra&content=$contentdir  (IP: 8.43.85.67)
Error: Failed to download metadata for repo 'epel': Cannot prepare internal mirrorlist: Status code: 404 for https://mirrors.fedoraproject.org/metalink?repo=epel-9.4&arch=x86_64&infra=$infra&content=$contentdir  (IP: 38.145.60.21)
In the second instance, $releasever is being replaced by 9.4, which causes a 404 error (which is itself probably *also* a problem, since RHEL 9.4 has been out since April and 9.3, 9.2, and 9.1 work as expected). Where does the value of releasever come from, and how do I see it? [This answer from unix.stackexhange.com](https://unix.stackexchange.com/a/20226/4989) suggests:
/usr/libexec/platform-python -c '
import dnf, json
db = dnf.dnf.Base()
print(json.dumps(db.conf.substitutions, indent=2))'
Which produces identical output in both environments:
{
  "arch": "x86_64",
  "basearch": "x86_64",
  "releasever": "9"
}
Given the about output, where is that 9.4 coming from? (As a workaround, I'm simply running sed -i "s/\\\$releasever/$(rpm -E '%{rhel}')/g" /etc/yum.repos.d/*.repo, which works fine, but I'm curious why this is necessary.) --- For the record: both environments have the same versions of redhat-release, dnf, and rpm:
bash-5.1# grep '^VERSION=' /etc/os-release
VERSION="9.20241104.0.4 (Plow)"
bash-5.1# rpm -q redhat-release rpm dnf
redhat-release-9.4-0.5.el9.x86_64
rpm-4.16.1.3-29.el9.x86_64
dnf-4.14.0-9.el9.noarch
bash-5.1# grep '^VERSION=' /etc/os-release
VERSION="9.20241008.0.4 (Plow)"
bash-5.1# rpm -q redhat-release rpm dnf
redhat-release-9.4-0.5.el9.x86_64
rpm-4.16.1.3-29.el9.x86_64
dnf-4.14.0-9.el9.noarch
Asked by larsks (38332 rep)
Dec 5, 2024, 06:37 PM
Last activity: Dec 5, 2024, 08:32 PM