Transitioning Software Streams
To switch software streams in AlmaLinux 9 without leaving orphaned packages, you must combine a module reset with a package synchronization command. The precise sequence is:
- Reset the module:
sudo dnf module reset <module_name>
- Enable the new stream:
sudo dnf module enable <module_name>:<stream_version>
- Synchronize packages:
sudo dnf distro-sync
If you are installing the software for the first time in the new stream, replace distro-sync with sudo dnf module install <module_name>.
The Role of dnf module reset
It is a common misconception that dnf module reset removes installed software. It does not.
The reset command only modifies the DNF metadata state. It clears the "enabled" flag and the specific stream selection for that module in the local database. It does not trigger the removal of any RPM packages currently residing on the disk. Consequently, if you enable a new stream and attempt to install it without a synchronization step, DNF may encounter dependency conflicts because the packages from the previous stream are still present and active.
Handling Orphaned Packages
Because reset only affects metadata, manual or synchronized intervention is required to clean the system:
- dnf distro-sync: This is the preferred method. It attempts to synchronize the installed packages to the versions available in the newly enabled stream, removing packages that are no longer part of the active stream.
- Manual Removal: In rare cases where a module is not designed for seamless transitions, you may need to manually remove the software (e.g.,
sudo dnf remove <package_name>) before performing the reset and enable sequence.
Verification Steps
To verify the transition was successful and no legacy versions remain, use the following commands:
# Check which stream is currently active
dnf module list --enabled
# Verify the actual installed version of the software
<software_command> --version
Diagnostic Detail Needed: Are you switching between streams of the same major version (e.g., Node.js 16 to 18) or moving from a modular stream to a standard non-modular package? The latter may require a full dnf remove of the module before the standard package can be installed.