If you’re using a RHEL-based Linux distribution like Rocky Linux, AlmaLinux, or CentOS, you may have encountered an error with dnf-automatic
that looks something like this:
No available modular metadata for modular package 'redis'
This issue often occurs when the package manager, dnf
, runs into problems fetching or processing modular metadata for certain packages. Fortunately, the root causes of this error are generally straightforward to diagnose and resolve. In this blog post, we’ll walk through the most common causes and solutions to get your system updates running smoothly again.
Understanding the Error
Modular packages allow you to install and use different versions of software on RHEL-based distributions. For instance, you might want to run Redis version 6 in one environment and version 7 in another. This flexibility is achieved through modular streams. The error “No available modular metadata” typically points to one of these issues:
- Outdated metadata cache: Your system’s cached metadata doesn’t include updated modular data from the repositories.
- Inactive or misconfigured modules: The specific module (like
redis
) isn’t enabled or configured properly. - Repository issues: Repositories may be disabled or improperly configured, preventing metadata retrieval.
Step-by-Step Solution
Here’s how you can resolve the error and prevent it from occurring again in the future:
1. Clean the Metadata Cache
Outdated metadata can cause this issue. Start by clearing the cache and forcing dnf
to rebuild it:
sudo dnf clean all
sudo dnf makecache
Once done, retry updating:
sudo dnf update
If this resolves the issue, the problem was simply stale metadata.
2. Check the Module’s Status
The error often relates to a specific module (e.g., redis
). Check the current status of the module with the following command:
dnf module list redis
This will display the available streams and their statuses (enabled, disabled, or available). If the module isn’t enabled, you can activate it:
sudo dnf module enable redis
Then, try running the update again.
3. Switch or Reset the Module Stream
Sometimes, the active stream is misconfigured or not available. You can reset the module to its default state and enable a specific stream:
sudo dnf module reset redis
sudo dnf module enable redis:<stream>
Replace <stream>
with the desired version, such as 6
or 7
, based on the output of dnf module list redis
.
4. Verify Repositories
Ensure that all required repositories are enabled and working correctly. Use the following command to check the status of your repositories:
dnf repolist all
If a required repository is disabled, enable it:
sudo dnf config-manager --enable <repository>
Replace <repository>
with the appropriate repository name.
5. Reinstall the Affected Package or Module
If the above steps don’t resolve the issue, try removing and reinstalling the affected package or module:
sudo dnf remove redis
sudo dnf module disable redis
Then, reinstall:
sudo dnf install redis
This ensures that all dependencies and metadata are correctly fetched.
6. Check dnf-automatic Configuration
If the error occurs specifically when using dnf-automatic
, review its configuration file:
sudo nano /etc/dnf/automatic.conf
Ensure that settings related to modules and repositories are correct. For instance, make sure updates are allowed for enabled modules.
Summary
The “No available modular metadata” error in dnf-automatic
can be frustrating, but it’s usually straightforward to fix by clearing metadata, enabling or resetting modules, and verifying repository configurations. These steps not only resolve the immediate issue but also help maintain a stable and up-to-date system.
By following this guide, you’ll ensure that your system’s package manager functions efficiently, keeping your environment secure and optimized. If you run into further issues, don’t hesitate to reach out or dive deeper into the documentation for dnf
and modularity.