CentOS 8: Failed to download metadata for repo ‘appstream’

I’m not a fan of CentOS, on the contrary, I kindly hate it!
However, sometime you have to deal with such distributions, and in my case I was managing a CentOS 8 system, and I faced the well know and established harsh update policy that switched CentOS from its “base” branch to the stream one.
The symptom was that any software installation resulted in an error like Failed to download metadata for repo 'appstream'.
Dealing with that was simple, even if it took time: I needed to switch the distribution to the stream release. That took two commands:

% sudo dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
% sudo dnf distro-sync
% sudo reboot


On my old and out of date system, it required 560 packages to be upgraded. The reboot is not mandatory, but clearly recommended.

The article CentOS 8: Failed to download metadata for repo 'appstream' has been posted by Luca Ferrari on February 4, 2022