Module dependency resolution
Module streams are groups of RPM packages which provide alternatives to the default content which is present in a RPM repository. Module streams contain RPM packages which can have the same name as non-module RPM packages of the default content of a RPM repository. To be able to deliver the correct content to your system a few changes need to be introduced to the dependency resolution algorithm inside the DNF libraries and tools.
In the next couple of paragraphs we will try to explain how DNF is processing requests for enabling, installing and switching module streams. The first example below represents the state of a RPM repository on a fresh system. Nothing is installed from the RPM repository. The RPM repository is a modular RPM repository as it contains two module streams perl:5.24
and perl:5.32
. It also contains some non-modular packages perl, perl-VSP, foo and bar.
The following examples are more a higher level overview how modularity works under the hood. For specific instruction how to use module streams with DNF check the section Using modules. |
Example 1. basic state of a modular repository
non-modular | perl:5.24 | perl:5.32 |
---|---|---|
perl-1-f36.rpm | perl-2-module_524.rpm | perl-3-module_532.rpm |
perl-Fedora-VSP-1-f36.rpm | perl-Fedora-VSP-2-module_524.rpm | perl-Fedora-VSP-1-module_532.rpm |
foo-1-f36.rpm | foo-1-module_524.rpm | bar-2-module_532.rpm |
bar-1-f36.rpm |
un-available, can't be installed | |
available, not enabled | |
available, can be installed | |
installed |
The color coding illustrates the state of the software content and how DNF sees it. All the non-modular content is available for installation right from the get go as usual. All the content which is available for installation is color coded green. Also all the green content is included in a DNF dependency resolution transaction and content set creation when installing. The module streams are not available for installation as module streams need to be enabled first. Content which is available but not enabled is color coded yellow. Yellow content is not considered for DNF dependency resolution transactions and content set creation. If the content is in a state where it can not be installed it is color coded red. Red content is also not considered for DNF dependency resolution transactions and content set creation. Any installed content is color coded blue.
Enabling a module stream
Example 2. state of the RPM repository when the 5.24 stream is enabled
non-modular | perl:5.24 | perl:5.32 |
---|---|---|
perl-1-f36.rpm | perl-2-module_524.rpm | perl-3-module_532.rpm |
perl-Fedora-VSP-1-f36.rpm | perl-Fedora-VSP-2-module_524.rpm | perl-Fedora-VSP-1-module_532.rpm |
foo-1-f36.rpm | foo-1-module_524.rpm | bar-2-module_532.rpm |
bar-1-f36.rpm |
un-available, can't be installed | |
available, not enabled | |
available, can be installed | |
installed |
A module stream needs to be enabled before its content can be installed. In example two we enabled the perl:5.24
module stream. All the packages provided by the 5.24
stream are now available for installation.
If we try to install the perl
package the DNF transaction will include the package from the 5.24
stream. The non-modular packages will be filtered out by modular filtering
during content set creation. The non-modular packages and the RPM file NEVRAs are not considered for installation.
If there is a non-modular package with the same name as a package from an enabled module stream, this non-modular package is filtered out for the purpose of installation by modular filtering
. Modular filtering guarantees that the correct packages are chosen for the DNF content set creation and for the following installation to your system.
The only package which is not included in the 5.24
stream, but is also a non-modular package in the repository, is the bar
package. The bar
package can be still installed as normal as the enablement of 5.24
stream does not affect it as it is not a part of the 5.24
stream.
Everytime you choose to add a module stream to your RPM repository it can be used to replace already existing non-modular packages when enabled and installed. Please always check if your module stream will not break your dependencies of your other installed software, after enablement and installation of your module streams. |
The 5.32
stream is still available for enabling, but only one stream of the module name perl
can be enabled at a time on a system. To be able to enable stream 5.32
we first need to reset and remove the installation of the 5.24
stream and all its packages.
Installing a module stream
Example 3. state of the RPM repository when all the available packages are installed
non-modular | perl:5.24 | perl:5.32 |
---|---|---|
perl-1-f36.rpm | perl-2-module_524.rpm | perl-3-module_532.rpm |
perl-Fedora-VSP-1-f36.rpm | perl-Fedora-VSP-2-module_524.rpm | perl-Fedora-VSP-1-module_532.rpm |
foo-1-f36.rpm | foo-1-module_524.rpm | bar-2-module_532.rpm |
bar-1-f36.rpm |
un-available, can't be installed | |
available, not enabled | |
available, can be installed | |
installed |
When a module stream is enabled you can install all the packages which are included in the enabled module streams. Also you can install all non-modular packages which have a different package name as packages include in the enabled module stream. All other non-modular packages are filtered out by modular filtering. Module stream RPM files can have different NEVRAS (newer or older) than the non-modular RPM files. That is why we need modular filtering to ensure that only the correct RPM file NEVRAs are used for defining what is the latest content for the purpose of updating the installed software.
Switching a module stream
Example 4. state of the RPM repository when switching to 5.32 stream
non-modular | perl:5.24 | perl:5.32 |
---|---|---|
perl-1-f36.rpm | perl-2-module_524.rpm | perl-3-module_532.rpm |
perl-Fedora-VSP-1-f36.rpm | perl-Fedora-VSP-2-module_524.rpm | perl-Fedora-VSP-1-module_532.rpm |
foo-1-f36.rpm | foo-1-module_524.rpm | bar-2-module_532.rpm |
bar-1-f36.rpm |
un-available, can't be installed | |
available, not enabled | |
available, can be installed | |
installed |
Before we can enable another module stream from the same module we have to first reset the already enabled module stream and remove it. In our situation in Example 3 we have enabled the 5.24
stream of the perl
module and installed it. To enable the 5.32
stream and install it we first need to uninstall all the packages from the 5.24
stream and reset it.
The reset of the stream ensures that the state of the module stream in the DNF database is updated. Only after resetting a module stream, a new stream can be enabled and installed.
Always remove all installed packages from a module stream before resetting. It is possible to reset a module stream without removing the old RPM packages. The problem is that when enabling a new module stream and installing it, the new module stream will try to upgrade/downgrade the existing installed RPM packages. This is not desired and can cause broken dependency issues. More about this in the section Using Modules. |
Want to help? Learn how to contribute to Fedora Docs ›