Many administrators still treat DNF as a simple successor to YUM with a slightly refreshed syntax. However, a completely new architecture lies under the hood. In newer Fedora releases, the default DNF5 abandons Python in favor of pure C++ – and this change significantly impacts overall performance, plugin structure, and the compatibility of existing scripts.
DNF vs YUM – it's not just a different syntax
DNF debuted as the default package manager in Fedora 22 in May 2015, and in the Red Hat Enterprise Linux ecosystem, it replaced the aging YUM with the release of RHEL 8 in May 2019. Although quite some time has passed since those events, the myth persists that the entire migration boils down to replacing the yum install command with dnf install. Reality quickly verifies this simplification.
YUM was written in Python and relied on its own, sometimes inefficient, dependency resolution algorithms. DNF4 – the version known from RHEL 9 and older Fedora releases – is based on the external libsolv library, originally developed as part of the openSUSE project. This has translated into faster and more predictable conflict resolution, lower memory usage, and a more stable API libdnf/hawkey. In DNF4, most critical tasks are performed by code written in C with a Python wrapper, rather than pure Python.
In RHEL 8 and 9, the yum command is merely a symbolic link to dnf. This ensures convenient backward compatibility, but it still runs the new manager underneath. The cache format (now stored in /var/cache/dnf/), error handling logic, and exit codes have changed – DNF reports any irregularities much more rigorously. If your administrative scripts rely on the old Python API from the YUM era, the symlink alone will not help, and they will need to be rewritten for libdnf.
DNF5 – evolution towards C++
With the release of Fedora 41 at the end of 2024, DNF5 became the default package manager – a version completely rewritten from scratch in C++. In newer distribution releases, this solution is the standard. The difference is visible to the naked eye: package operations take less time, and RAM usage has dropped significantly. However, the plugin architecture has also changed.
Some extensions known from the dnf-plugins-core package in DNF4 do not work directly with DNF5. They require adaptation or replacement with new, native modules. This is an important signal for anyone involved in automation. Scripts parsing the text output of dnf using tools like grep or awk may suddenly stop working because the message format has changed. Similarly, some aliases and options specific to older plugins have simply been removed.
It is worth remembering that RHEL 9 still uses the proven DNF4. In enterprise-class environments, the API stability of this version remains crucial. Before deploying DNF5-based systems, it is worth thoroughly testing all administrative scripts in an isolated environment. In times when AI is accelerating coding and automation in the terminal, manual package management still requires solid foundations and caution during migrations.
Security, transaction history, and auditing
One of the biggest advantages of DNF is precise auditing and the ability to easily roll back changes. The dnf history command displays a chronological list of transactions along with a unique identifier, date, operator, and the command invoked. The entire history database is located in the /var/lib/dnf/history/ directory. You can analyze the details of a specific operation using dnf history info <ID>, and then undo its effects via dnf history undo <ID> or restore the system to the state before a given change using dnf history rollback <ID>.
However, one must keep in mind an important limitation: undo and rollback operations will only succeed if older versions of packages are still available in active repositories or in the local cache. If a given RPM file has been removed from the source, rolling back the transaction may fail.
DNF also allows for the selective installation of patches based on official bulletins. The dnf updateinfo command shows available patch notifications: security (RHSA), bug fixes (RHBA), and enhancements (RHEA). Thanks to this, you can limit system updates solely to security patches using dnf upgrade --security or only to bug fixes via dnf upgrade --bugfix. In DNF5, this mechanism has been preserved, although the data presentation format itself may differ slightly from the older solution.
Modularity and advanced repository management
The concept of modularity (appstream) introduced in RHEL 8 allows for installing different versions of the same software in isolated streams – this applies to, among others, Node.js, Ruby, or Python environments. Commands dnf module list, dnf module enable <nazwa>:<stream>, dnf module install, and dnf module reset are used to manage them. In RHEL 9, modularity is still supported, although its scope has been slightly limited compared to the previous version of the system.
Working with external sources requires knowledge of several useful tools. Community COPR repositories are activated with the dnf copr enable <user>/<repo> command, while a standard .repo configuration file can be added using dnf config-manager --add-repo <URL>. Before installing an unknown package, it is worth checking its contents: dnf repoquery -l <pakiet> will show a list of files that will be added to the system, and dnf repoquery --requires <pakiet> will display its dependencies. A quick preview of active sources using dnf repolist is an absolute basic for daily work.
Automation, offline work, and synchronization
In environments disconnected from the internet or subject to restrictive security policies, DNF offers flexible mechanisms for offline work. The dnf install --downloadonly --downloaddir=/ścieżka <pakiet> command allows you to download RPM files without installing them immediately. When preparing an update for an entire distribution, you can use dnf system-upgrade download --releasever=<wersja>, and perform the deployment process safely after restarting the computer.
The dnf-automatic tool is used for automatic downloading and installing of patches, configured in the /etc/dnf/automatic.conf file and run via systemd (dnf-automatic.timer). It allows for unattended system maintenance according to a set schedule. If there is a need to create a local repository mirror, the dnf reposync command proves helpful, and the dnf repodiff tool allows you to quickly compare the contents of two different sources. Just as pip 26.2 changes the game in Python dependency management, system package managers must also evolve to meet the requirements of modern, isolated environments.
Migration pitfalls and script compatibility
The transition from YUM to DNF4 seems painless at first glance – until we look at the scripts. Although old commands work thanks to symlinks, Python scripts directly referencing the old YUM API will stop working. DNF uses a completely different programming interface, and its exit codes are much more rigorous.
In turn, the jump to DNF5 brings new compatibility challenges. Scripts parsing text output may require fixes due to the new message format. Some specific plugin options known from DNF4 are no longer supported. In the older version, the groupinstall and group install commands were treated as identical, while the newer release is more restrictive regarding the handling of such aliases. In the world of enterprise systems, where Red Hat and OWASP balance speed and security, the stability and predictability of the package manager are key issues. Therefore, every change in tool version requires prior testing of procedures in a safe test environment.
In summary: modern DNF is not just a cosmetic facelift of the old YUM. It is a mature ecosystem that, in the DNF5 version, sets new requirements for administrators regarding compatibility and script structure. A good knowledge of transaction history, modules, and offline work methods is an essential element in the arsenal of every Linux system administrator today.
Sources
- https://www.tecmint.com/dnf-commands-linux/
- https://dnf.readthedocs.io/en/latest/
- https://github.com/rpm-software-management/dnf
- https://github.com/rpm-software-management/dnf5
- https://docs.fedoraproject.org/en-US/quick-docs/dnf/
- https://fedoraproject.org/wiki/Changes/DNF5
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_software_with_the_dnf_tool/index
- https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/html/installing_managing_and_removing_user-space_components/index
Comments