If you are seeing this error on RHEL 8:
Errors during downloading metadata for repository 'rhel-8-for-x86_64-baseos-rpms':
- Status code: 403 for https://cdn.redhat.com/content/dist/rhel8/8/x86_64/baseos/os/repodata/repomd.xmlOr the appstream variant:
Errors during downloading metadata for repository 'rhel-8-for-x86_64-appstream-rpms':
- Cannot download repomd.xml: All mirrors were triedThis guide covers every cause and fix.
Quick Diagnosis
Run these commands first to identify the root cause:
# Check subscription status
sudo subscription-manager status
# Check repo list
sudo subscription-manager repos --list-enabled
# Test CDN connectivity
curl -v https://cdn.redhat.comFix 1: Register or Re-register Subscription
The most common cause is an expired or unregistered subscription:
# Unregister first (if previously registered)
sudo subscription-manager unregister
# Register with your Red Hat account
sudo subscription-manager register --username=YOUR_USERNAME --password=YOUR_PASSWORD
# Auto-attach a subscription
sudo subscription-manager attach --auto
# Verify
sudo subscription-manager statusIf you see Overall Status: Current, your subscription is active.
Fix 2: Refresh Subscription Data
Sometimes the local subscription cache is stale:
# Refresh subscription data
sudo subscription-manager refresh
# Clean yum/dnf cache
sudo dnf clean all
sudo rm -rf /var/cache/dnf
# Retry
sudo dnf makecacheFix 3: Fix SSL Certificate Issues
The 403 error often means the entitlement certificates are missing or expired:
# Check if entitlement certs exist
ls /etc/pki/entitlement/
# If empty, the subscription is not properly attached
sudo subscription-manager remove --all
sudo subscription-manager attach --auto
# Verify certs are present
ls /etc/pki/entitlement/You should see .pem and -key.pem files.
Fix 4: CDN Connectivity and Proxy Issues
If you are behind a corporate proxy:
# Configure subscription-manager proxy
sudo subscription-manager config --server.proxy_hostname=proxy.example.com \
--server.proxy_port=8080 \
--server.proxy_user=proxyuser \
--server.proxy_password=proxypass
# Configure dnf proxy
echo "proxy=http://proxy.example.com:8080" | sudo tee -a /etc/dnf/dnf.confTest direct CDN access:
# Test with curl (should return 200)
curl -I --cert /etc/pki/entitlement/*.pem \
--key /etc/pki/entitlement/*-key.pem \
https://cdn.redhat.com/content/dist/rhel8/8/x86_64/baseos/os/repodata/repomd.xmlFix 5: Reset Repository Configuration
If repos are misconfigured:
# Disable all repos and re-enable the defaults
sudo subscription-manager repos --disable="*"
sudo subscription-manager repos \
--enable=rhel-8-for-x86_64-baseos-rpms \
--enable=rhel-8-for-x86_64-appstream-rpms
# Verify
sudo dnf repolistFix 6: RHEL 8 End of Life Considerations
RHEL 8 reaches End of Maintenance Support on May 31, 2029, but some minor versions may no longer receive updates. If you are on an older point release:
# Check your current version
cat /etc/redhat-release
# If locked to an old release, unlock
sudo subscription-manager release --unset
# Update to latest RHEL 8
sudo dnf updateFix 7: Use CentOS Stream 8 Repos (Alternative)
If you are running RHEL 8 without an active subscription (e.g., development):
# Note: CentOS Stream 8 reached EOL June 2024
# Consider migrating to RHEL 9 or CentOS Stream 9
# For RHEL 9, see our complete administration guide:Consider upgrading to RHEL 9 for continued support and modern features.
Fix 8: Clean and Rebuild Cache
After applying any fix above:
# Nuclear option: clean everything
sudo dnf clean all
sudo rm -rf /var/cache/dnf
sudo subscription-manager clean
sudo subscription-manager register --username=YOUR_USERNAME --password=YOUR_PASSWORD
sudo subscription-manager attach --auto
sudo dnf makecache
sudo dnf updateCommon Error Variants
All of these errors have the same root causes:
Status code: 403 for https://cdn.redhat.com/.../baseos/os/repodata/repomd.xmlStatus code: 403 for https://cdn.redhat.com/.../appstream/os/repodata/repomd.xmlCannot download repomd.xml: All mirrors were triedFailed to download metadata for repo 'rhel-8-for-x86_64-baseos-rpms'Error: Failed to download metadata for repo 'rhel-8-for-x86_64-baseos-rpms': Cannot download repomd.xml
Related Posts
About the Author
I am Luca Berton, AI and Cloud Advisor with deep Linux expertise. Book a consultation.