- 1 yum replaced by dnf
- 1.1 dnf behavior
- 1.1.1 Updates that don't work are skipped
- 1.1.2 Repos that don't work are skipped
- 1.1.3 Update and Upgrade are the same
- 1.1.4 Dependencies are not upgraded on package installation
- 1.1.5 Clean on remove
- 1.1.6 Repo cache refresh schedule
- 1.1.7 Repository Actions =
- 1.1.8 Listing dependencies
- 1.1.9 dnf will remove kernels
- 1.1.10 Replacing packages
- 1.1 dnf behavior
yum replaced by dnf
yum package manager has been replaced in Fedora 22 by its successor, dnf. The yum fork has been available in Fedora for testing since Fedora 18, and is now the default command line package manager.
Most dnf commands use directives that are familiar to yum users, and it uses the same RPM package repositories. Behind the scenes, dnf uses an improved dependency solver,
hawkey, along with
librepo for repository operations and
libcomps for package groups.
The behavior of dnf differs from yum in some areas:
Updates that don't work are skipped
If a portion of a transaction is not viable, dnf will automatically exclude it and transparently continue with the portions that will work. For example, if a package has unmet dependencies during a
dnf update action, that package will not be updated, but others will. This is similar to yum's "--skip-broken" directive, but evaluates the impact of the problem against the entire transaction. Because this is the default behavior, there is no "--skip-broken" switch for dnf.
To review details about a problematic package direction, you can use the "--best" option.
dnf update --best will force dnf to resolve the transaction using the latest versions of involved packages, and report any problems instead of skipping them.
Repos that don't work are skipped
If a configured and enabled repository does not respond, dnf will skip it and continue the transaction with the available repos. This differs from yum, which would immediately stop if a repository was not available.
Update and Upgrade are the same
dnf update and
dnf upgrade are equivalent. This differs from yum, where
yum upgrade would have the same effect as
yum update --obsoletes, and take obsolete packages into account.
Dependencies are not upgraded on package installation
When installing a new package, previously installed dependencies will not be upgraded. Yum offered an option for this behavior, upgrade_requirements_on_install. To upgrade with dnf, use
Clean on remove
When removing a package, dnf will automatically remove any dependent packages that were not explicitly installed by the user. If a package was independently installed, it won't be uninstalled this way.
This behavior is configured by the "clean_requirements_on_remove" option in /etc/dnf/dnf.conf.
Repo cache refresh schedule
By default, dnf will check for updates in configured repositories hourly, starting ten minutes after the system boots. The action is controlled by a systemd timer unit, /usr/lib/systemd/system/dnf-makecache.timer.
To adjust this, copy the timer file to /etc/systemd/system/dnf-makecache.timer and edit it.
Alternatively, setting the metadata_timer_sync in /etc/dnf/dnf.conf to a number of seconds configures the minimum number of seconds between makecache operations. If the timer has not expired,
dnf makecache will exit immediately.
dnf will also honor the metadata_expire option set in individual repo configs, and refresh repo metadata at runtime if it is too old. This option is described in
Repository Actions =
The "repository-packages" directive can be used to search for or get info about packages in a specific repository, list installed packages frrom that repository, and more. This simplifies operations that would have required use of "--excluderepo" and "--includerepo" options with yum, and is especially useful for managing similar packages from different repositories.
To find out what package supplies a particular provide, use the
dnf provides foo command. This replaces
yum resolvedep foo.
To list the dependencies of a package, use
dnf repoquery --requires foo. This replaces
yum deplist foo.
dnf will remove kernels
kernel packages are not protected by dnf. Unlike with yum, you can remove all kernel packages, including the running package, if you direct it to. Be cautious with removing kernels, and specify the full package and version
When a system requires the capabilities of a package you want to replace, use the --allowerasing option. For example,
dnf --allowerasing mariadb will allow you to replace mysql with mariadb, without disrupting packages that require capabilities provided by both packages. This replaces
yum shell and
yum swap functionality.