12

Sometimes when trying to remove a package via 'dnf remove package-name', dnf will list a lot of other packages as 'dependencies' and try to remove them too. I have found that it even does this with seemingly unrelated packages, like removing firewalld somehow declare 'spotify-client' as a dependency.

How do I get dnf to only remove packages related to or installed as dependencies of the package I'm trying to actually remove?

Jeff
  • 809

2 Answers2

20

If you'd like to keep as default the current behavior, and only stop autoremove for specific transactions, you can supply the --noautoremove argument to dnf remove as in:

dnf remove --noautoremove <package-name>

This is especially useful when autoremove erroneously triggers "unused dependencies".
In my opinion the logic for unused dependencies should have only been libs, never executables, but that ship has sailed long ago.
To modify the default behavior, follow Jeff's solution

Dani_l
  • 301
3

Edit the file '/etc/dnf/dnf.conf' changing clean_requirements_on_remove=True to clean_requirements_on_remove=False then run dnf clean all.

Jeff
  • 809