Does dnf upgrade
install additional packages if required?
Yes. I tested dnf upgrade --releasever=28
on Fedora 27, and it proposed installing additional packages.
Could dnf upgrade
ever remove packages?
dnf upgrade
will remove packages which are no longer needed (and were not manually installed?), if the obsoletes
option is set. Despite man dnf
showing an option --obsoletes
, the obsoletes
option is actually enabled by default. (And dnf.conf
does not unset the default, unless you changed it).
(dnf upgrade
is basically trying to mimic yum upgrade
. See also this answer: In CentOS, what is the difference between yum update and yum upgrade?)
There is also an option --allowerasing
, "Allow erasing of installed packages to resolve dependencies." In this case, I can only assume that the option is not enabled by default. And hence if you don't specify the option, the day-to-day dnf
commands will never erase installed packages to resolve dependencies. (Although you don't have to pass this option to the command for distribution version upgrades, dnf system-upgrade
).
dnf
man page does not explicitly say one way or the other. Since theapt
man page does, I am looking for some confirmation. In fact, a different section of thednf
man page appears to explicitly say thatdnf upgrade
does not auto-remove, which would be surprising to users used todnf remove
. I am asking for an explicit answer to remove surprises. If simply quoting the dnf man page would provide such an answer, why not do so? Comments are not intended for answers. – sourcejedi Sep 01 '18 at 15:16dnf-2.7.5-12.fc28.noarch
. – sourcejedi Sep 01 '18 at 15:18