Recurring error "Failed to download metadata for repo 'xyz': Cannot download repomd.xml: Curl error (28): Timeout was reached"

I have several servers running Rocky Linux 8.7.
I have no third party repositories enabled, only the official sources.

In logs I often see errors like these

Failed to download metadata for repo ‘xyz’: Cannot download repomd.xml: Curl error (28): Timeout was reached
nf.exceptions.RepoError: Failed to download metadata for repo ‘xyz’: Cannot download repomd.xml: Status code: 404 for URL

Repo can be any of baseos, extras and appstream.
Server causing the problem is usually different on different times. Somes error disappears the next day, sometimes it repeats for multiple days.

Erros are logged in /var/log/dnf.log and usually happen during scheduled task dnf makecache --timer.

I belive that the errors are caused by some problem on target repository mirrors.

I have not made any changes to repository configuration on these servers. Should the default repositories work without need to manually update lists and disable bad sources?

So far the problems have solved themselves in a few days. Should and could I do something to fix the errors faster?

Is there anything I could do to prevent these errors appearing in future?

Example of full log during recent error that lasted for a few days:>

2022-11-17T11:33:22+0000 DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, uploadprofile
2022-11-17T11:33:22+0000 DEBUG DNF version: 4.7.0
2022-11-17T11:33:22+0000 DDEBUG Command: dnf makecache --timer
2022-11-17T11:33:22+0000 DDEBUG Installroot: /
2022-11-17T11:33:22+0000 DDEBUG Releasever: 8
2022-11-17T11:33:22+0000 DEBUG cachedir: /var/cache/dnf
2022-11-17T11:33:22+0000 DDEBUG Base command: makecache
2022-11-17T11:33:22+0000 DDEBUG Extra commands: [‘makecache’, ‘–timer’]
2022-11-17T11:33:22+0000 DEBUG Making cache files for all metadata files.
2022-11-17T11:33:22+0000 DEBUG appstream: has expired and will be refreshed.
2022-11-17T11:33:22+0000 DEBUG baseos: has expired and will be refreshed.
2022-11-17T11:33:22+0000 DEBUG extras: has expired and will be refreshed.
2022-11-17T11:33:22+0000 DEBUG epel: has expired and will be refreshed.
2022-11-17T11:33:22+0000 DEBUG shibboleth: has expired and will be refreshed.
2022-11-17T11:33:22+0000 DEBUG zabbix: has expired and will be refreshed.
2022-11-17T11:33:22+0000 DEBUG zabbix-non-supported: has expired and will be refreshed.
2022-11-17T11:33:22+0000 DEBUG countme: no event for appstream: window already counted
2022-11-17T11:33:22+0000 DEBUG error: Status code: 404 for http://mirrors.ohost.bg/rockylinux/8.7/AppStream/x86_64/os/repodata/repomd.xml (IP: 93.123.22.23) (http://mirrors.ohost.bg/rockylinux/8.7/AppStream/x86_64/os/repodata/repomd.xml).
2022-11-17T11:33:22+0000 WARNING Errors during downloading metadata for repository ‘appstream’:

  • Status code: 404 for MIRROR (IP: 93.123.22.23)
    2022-11-17T11:33:22+0000 DDEBUG Cleaning up.
    2022-11-17T11:33:22+0000 SUBDEBUG
    Traceback (most recent call last):
    File “/usr/lib/python3.6/site-packages/dnf/repo.py”, line 573, in load
    ret = self._repo.load()
    File “/usr/lib64/python3.6/site-packages/libdnf/repo.py”, line 397, in load
    return _repo.Repo_load(self)
    libdnf._error.Error: Failed to download metadata for repo ‘appstream’: Cannot download repomd.xml: Status code: 404 for MIRROR (IP: 93.123.22.23)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/dnf/cli/main.py”, line 67, in main
return _main(base, args, cli_class, option_parser_class)
File “/usr/lib/python3.6/site-packages/dnf/cli/main.py”, line 106, in _main
return cli_run(cli, base)
File “/usr/lib/python3.6/site-packages/dnf/cli/main.py”, line 122, in cli_run
cli.run()
File “/usr/lib/python3.6/site-packages/dnf/cli/cli.py”, line 1055, in run
return self.command.run()
File “/usr/lib/python3.6/site-packages/dnf/cli/commands/makecache.py”, line 50, in run
return self.base.update_cache(timer)
File “/usr/lib/python3.6/site-packages/dnf/base.py”, line 370, in update_cache
self.fill_sack(load_system_repo=False, load_available_repos=True) # performs the md sync
File “/usr/lib/python3.6/site-packages/dnf/base.py”, line 399, in fill_sack
self._add_repo_to_sack(r)
File “/usr/lib/python3.6/site-packages/dnf/base.py”, line 139, in _add_repo_to_sack
repo.load()
File “/usr/lib/python3.6/site-packages/dnf/repo.py”, line 580, in load
raise dnf.exceptions.RepoError(str(e))
dnf.exceptions.RepoError: Failed to download metadata for repo ‘appstream’: Cannot download repomd.xml: Status code: 404 for MIRROR (IP: 93.123.22.23)
2022-11-17T11:33:22+0000 CRITICAL Error: Failed to download metadata for repo ‘appstream’: Cannot download repomd.xml: Status code: 404 for MIRROR (IP: 93.123.22.23)

There probably isn’t too much you can do from your side. If it couldn’t find the file on the mirror, chances are it wasn’t up-to-date completely when you hit it. I have experienced it from time to time, sometimes it’s easy enough to do:

dnf clean all
dnf update

and then all is well again. That said, sometimes the problems can be persistent, if you again end up connecting to a mirror that doesn’t have all the necessary files. Chances are it’s a one-off, from Rocky 8.7 just being released, and not all mirrors fully in sync.

If you are consistently getting problems continually in the near future, then let us know and perhaps we can get someone to take a look into it deeper.

Thank you for information.

If error states persist I will try the clean all command.
I will also keep eye on frequency of these errors.

1 Like