DNF module stream cache expiration behavior with metadata_expire
0 reputation · 13 Mar 2022, 23:15 UTC
0 reputation · 13 Mar 2022, 23:15 UTC
Rocky Linux 9.2 and later use DNF with modular package streams, where dnf module list displays available streams and profiles. The DNF configuration directive metadata_expire (default 6h) controls how long repository metadata is considered fresh before a forced refresh.
Understand whether the metadata_expire timer applies uniformly to both base repository metadata and module stream metadata, or if module stream data follows a separate expiration policy.
The DNF documentation describes metadata_expire for repository metadata, but module streams introduce an additional metadata layer (modulemd). It is unclear whether a single expiration governs both, or if module metadata can become stale while base metadata remains fresh, leading to dnf module list showing outdated stream availability after a stream is added or removed upstream.
metadata_expire control expiration of module stream metadata (modulemd) in the same way as primary repository metadata?dnf module install to fail with a stream-not-found error even when dnf repolist shows current repository data?34775 reputation · 14 Mar 2022, 04:33 UTC
1. Does metadata_expire control module stream metadata? Yes. DNF treats the modulemd files that describe streams and profiles as part of the repository metadata tree, so the same metadata_expire value applies to them.
2. Is there a separate expiration setting? No. There is no dedicated option; the default timer governs all metadata DNF downloads.
3. Can stale module metadata cause install failures? Absolutely. If the cached modulemd list is older than metadata_expire, dnf module list may still show an outdated stream list. A subsequent dnf module install will then return "stream not found" even though dnf repolist shows a current repo.
When DNF resolves a command, it first checks the local metadata cache. If the cache age exceeds metadata_expire (default 6 h), DNF re‑downloads all repository metadata, including the modulemd payloads. Because module streams are stored in the same cache directory, the expiration logic is identical. There is no separate timestamp for modulemd.
dnf module list and note the available streams.metadata_expire interval elapses, or set metadata_expire=0 in /etc/dnf/dnf.conf to force an immediate refresh.dnf module list again. If the list still shows the old streams, run dnf clean metadata and retry.dnf module install <stream>. A “stream not found” error indicates that the modulemd cache was stale.Stale module metadata typically surfaces when an upstream repo updates its module streams shortly after you last ran dnf module list. Because dnf repolist only shows repository existence, it can be misleading: the repo may be up‑to‑date, but the cached module list is not.
dnf clean metadata clears both base and module metadata, forcing a fresh download on the next command.metadata_expire=0 in /etc/dnf/dnf.conf disables the timer, making DNF always fetch the latest metadata.dnf clean metadata nightly to keep the module cache fresh.In Rocky Linux 9.x, metadata_expire is a single, global expiration policy that covers both repository and module‑stream metadata. A stale module cache can cause install failures even when the repository list appears current, and the simplest remedy is to clear or refresh the metadata cache.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.