Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

CentOS 7 yum "Cannot find a valid baseurl for repo: base/7/x86_64": the repository no longer answers

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

The message Cannot find a valid baseurl for repo: base/7/x86_64 means yum has no usable URL for the repository named base: its URL list is empty. For a repository that has a mirror list and no fixed baseurl, that means the mirror list gave no usable address; step 5 below tests whether yours does. CentOS Linux 7 reached end of life on June 30, 2024, and its packages are now archived on vault.centos.org. Pointing the repository at the archive lets packages install again, but the archive receives no security updates.

What the error means

yum builds a repository's URL list from its baseurl entries plus whatever its mirrorlist or metalink returns. Reading the yum source (_baseurlSetup and check in yum/yumRepo.py at commit 4ed25525ee4781907bd204018c27f44948ed83fe), the list is self.baseurl + self.mirrorurls, and when it is empty and no media is set the check raises Cannot find a valid baseurl for repo: %s. This is a reading of the code, not a statement in a manual.

The label base/7/x86_64 is the repository id plus the variables used in its URL. The source's _ui_id adds / and the value of a variable such as $releasever or $basearch for each one found in the repository's metalink, mirrorlist or baseurl. Here the id is base, $releasever is 7 and $basearch is x86_64. The yum.conf(5) page says yum version is the easiest way to see what $releasever is.

The yum.conf manual describes the two options:

  • baseurl is a list of URLs for the repository; the manual says "if one URL fails, another one is tried".
  • mirrorlist "Specifies a URL to a file containing a list of baseurls" and can be used instead of or with baseurl.

If a mirror list request fails or returns nothing, and no baseurl is set, the list is empty and the check fails. The yum source then deletes its cached copy of the mirror list when the list holds no valid mirrors.

The CentOS Blog post End dates are coming for CentOS Stream 8 and CentOS Linux 7, dated Tuesday, 11, April 2023 on the page, says: "After June 30, 2024, there will be no updates published for CentOS Linux 7." It also says the packages "will be archived on vault.centos.org after June 30, 2024". The vault page states that it is not an updated tree for installing CentOS Linux, and that "we do not put security updates into the trees on this server".

The post predates that date and does not say what the mirror list hosts do after it, so test them rather than assume.

If your server runs a current release with dnf, the guide dnf "Error: Failed to download metadata for repo": read the reason after the colon is the one to use.

Likely causes

Cause What you see How to confirm
The repository uses a mirror list that returns no mirrors, and has no baseurl The error for base, and also updates and extras The repo file has mirrorlist= and baseurl is commented out; fetching the mirror list URL by hand returns nothing useful
The server cannot reach the host at all (DNS, proxy or firewall) Other downloads fail in the same way DNS lookup and an HTTP request to the host from the server fail
baseurl points to a path that does not exist An error that names that path Fetching the URL with curl -I returns an error
A proxy setting is wrong in yum.conf or the repo file The error appears only on this server proxy= lines in the configuration
An old, disabled or outdated repository entry is the only one failing yum repolist shows others working Disable the failing one for one run with --disablerepo and compare

Prove the cause before changing anything

All of these only read.

1. Read the repository definitions.

grep -H -E '^(\[|baseurl|mirrorlist|metalink|enabled|proxy)' /etc/yum.repos.d/*.repo

Each section starts with [id]. Note which have mirrorlist and which have baseurl. If that folder does not exist, read reposdir in yum's main configuration file (the yum.conf manual documents it).

2. Show what yum sees.

yum repolist all

The yum(8) page says repolist lists configured repositories, and that all, enabled and disabled choose which. The page also says that in non-verbose mode yum ignores any repository errors and prints the information it can get, and its example shows the package counts zeroed out. So a repository that cannot be loaded shows zero packages here, not the error text. To read the error itself, use the failing command's own output or yum repolist -v.

3. See $releasever.

yum version

The yum.conf manual says this is the easiest way to see what $releasever is.

4. Test the archive.

curl -sI https://vault.centos.org/7.9.2009/os/x86_64/repodata/repomd.xml

A status line with 200 means the server can reach it. The vault directory listings for 7.9.2009/os/x86_64/repodata/, 7.9.2009/updates/x86_64/repodata/ and 7.9.2009/extras/x86_64/repodata/ show a repomd.xml file for the base tree and repodata folders for updates and extras. The same address with http in place of https answers 301 Moved Permanently and a Location: header that names the https address; that is a redirect, not a network fault. Any other result for the https address means DNS, proxy, firewall or certificate trouble on the server, not the repository definitions.

5. Test what the repository points at now.

curl -sI '<mirrorlist URL from step 1>'

Replace the placeholder with the exact URL from the repo file, with $releasever and $basearch replaced by 7 and x86_64. An error or empty answer is the cause.

Fix

Point the repositories at the archive

First save the repository file you will edit. The name below is an example; use the file the grep showed:

cp -p /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.2026-12-01

Risk: the next edit points the base, updates and extras repositories at a fixed archive tree for release 7.9.2009. The archive receives no updates, so a server pointed at it installs only the final packages and gets no new security fixes.

For each of the three sections, comment out the mirrorlist= line by putting # in front of it (so #mirrorlist=..., not deleting it) and set baseurl to the matching archive path. The paths below exist on vault.centos.org; keep $basearch, which yum replaces with the architecture:

[base]
baseurl=https://vault.centos.org/7.9.2009/os/$basearch/

[updates]
baseurl=https://vault.centos.org/7.9.2009/updates/$basearch/

[extras]
baseurl=https://vault.centos.org/7.9.2009/extras/$basearch/

Leave the other lines of each section (name, enabled, gpgcheck, gpgkey) as they are.

To undo it, restore the saved file and clear the cache (the cache step is described next, and yum clean all removes cached data only):

ls -l /etc/yum.repos.d/CentOS-Base.repo.2026-12-01
cp -p /etc/yum.repos.d/CentOS-Base.repo.2026-12-01 /etc/yum.repos.d/CentOS-Base.repo
yum clean all

Clear the cached metadata

The cache holds only copies of repository data, so there is nothing in it to save. Record its size for comparison:

du -sh /var/cache/yum > /root/yum-cache-size-before.2026-12-01.txt

Risk: the next command deletes yum's cached metadata and packages, so the next yum command downloads the repository metadata again. It does not change the installed software.

The yum(8) page says yum clean all removes all the cached categories:

yum clean all
yum repolist

To back out, there is nothing to restore; the cache is rebuilt from the repositories by the next yum repolist or yum makecache. The saved file shows the size it had.

Example (illustrative): web01 runs CentOS Linux 7.9. yum update prints Cannot find a valid baseurl for repo: base/7/x86_64. The grep shows mirrorlist= active and baseurl= commented out in the three sections. curl -sI against the mirror list URL returns an error, while curl -sI https://vault.centos.org/7.9.2009/os/x86_64/repodata/repomd.xml returns a 200 status line. The engineer saves the file, replaces mirrorlist= with archive baseurl= lines, runs yum clean all and yum repolist, and base now lists packages. The team schedules the move off CentOS 7 because the archive offers no new security updates.

Confirm the fix

  1. yum repolist lists base, updates and extras with package counts that are not zero. Because plain repolist hides repository errors, a count of zero means the repository still cannot be loaded.
  2. yum check-update or an install of a small package completes.
  3. grep -H -E '^(\[|baseurl|mirrorlist)' /etc/yum.repos.d/*.repo shows the archive baseurl lines you set.

What to watch afterwards

  • Plan the move off CentOS Linux 7. The CentOS post says RHEL 7 reaches end of maintenance on June 30, 2024 (the post's own spelling differs) and offered conversion to RHEL 7 with extended life-cycle support; the terms and price are Red Hat's, so check the current Red Hat page before relying on that.
  • Servers on the archive still need the other protections a server without security updates needs: network limits, application-level patching and monitoring.
  • A package that is not in 7.9.2009 may be in an add-on repository; read each remaining repo file for the same mirror list problem.

Risks and limits

  • These commands have not been run or lab-tested.
  • yum 3.x manuals describe the options; CentOS 7 packages may carry patches that the upstream manual does not show.
  • The repo file name above is an example for a standard install; check your own.
  • vault.centos.org states that it is not an updated tree. Treat the archive as a way to install the last published packages and nothing more.
  • Whether the old mirror list hosts still answer is not documented by CentOS or the yum project, which is why step 5 tests it.

Sources

  • End dates are coming for CentOS Stream 8 and CentOS Linux 7 — CentOS Blog, Tuesday, 11, April 2023, accessed 1 December 2026
  • CentOS Vault Mirror — CentOS Project, directory listing, no page date shown, accessed 1 December 2026
  • Index of /7.9.2009 — CentOS Vault Mirror, directory listing, no page date shown, accessed 1 December 2026
  • Index of /7.9.2009/os/x86_64/repodata — CentOS Vault Mirror, directory listing, no page date shown, accessed 1 December 2026
  • yum.conf(5) — yum project, manual source at commit 4ed25525ee4781907bd204018c27f44948ed83fe, no date shown, accessed 1 December 2026
  • yum(8) — yum project, manual source at commit 4ed25525ee4781907bd204018c27f44948ed83fe, no date shown, accessed 1 December 2026
  • yum/yumRepo.py — yum project source at commit 4ed25525ee4781907bd204018c27f44948ed83fe, no date shown, accessed 1 December 2026
  • yum/repos.py — yum project source at commit 4ed25525ee4781907bd204018c27f44948ed83fe, no date shown, accessed 1 December 2026