Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-38470

dnf removes packages when yum would not

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Normal Normal
    • rhel-9.5
    • rhel-8.10, rhel-9.4, rhel-10.0.beta
    • dnf
    • dnf-4.14.0-13.el9
    • None
    • None
    • sst_cs_software_management
    • ssg_core_services
    • 15
    • 17
    • 2
    • False
    • Hide

      None

      Show
      None
    • Yes
    • None
    • Bug Fix
    • Hide
      .`dnf remove-n` now removes only packages with the matching RPM names

      Previously, if you had installed some package and another package that has the name of the former package in the RPM Provides directive, a first invocation of the `dnf remove-n` command removed the former package. A repeated invocation of the command removed the latter package.

      With this update, the `dnf remove-n` command removes only packages with matching RPM names and does not consider the RPM Provides. As a result, only one invocation of `dnf remove-n` is now sufficient to remove all matching packages.
      Show
      .`dnf remove-n` now removes only packages with the matching RPM names Previously, if you had installed some package and another package that has the name of the former package in the RPM Provides directive, a first invocation of the `dnf remove-n` command removed the former package. A repeated invocation of the command removed the latter package. With this update, the `dnf remove-n` command removes only packages with matching RPM names and does not consider the RPM Provides. As a result, only one invocation of `dnf remove-n` is now sufficient to remove all matching packages.
    • Done
    • None

      On RHEL 7 one can do e.g. "yum remove 'nfs' 'sss'" to remove NFS and SSSD related packages from a set of systems. Doing this from the command line or with Ansible automation using the yum module works the same.

      On RHEL 8/9 "dnf remove 'nfs'" or "dnf remove 'sss'" works like the above only if there are such named packages present. On the second invocation dnf falls back to fileprovides and tries to remove kernel-core which luckily fails due to it being a protected package. Using the Ansible yum module on RHEL 8/9 uses dnf as a backend so it does the same.

      The workaround would be to use 'nfs*' 'lib*nfs*' or 'sss*' 'lib*sss*' instead. However this is different from yum, a bit clumsy, and a mistake in typing might make dnf fallback to fileprovides and if it finds only unprotected packages then the result could be very much unexpected.

      It should be considered that dnf would be changed to behave like yum in this regard.

      Wrt this change it could be argued that it's good that "dnf install 'foo'" and "dnf remove 'foo'" work symmetrically. However, as explained above, dnf remove behavior is currently inconsistent with itself (sometimes considers fileprovides, sometimes not) and in general installing new packages should not cause issues whereas removing unexpected packages might render the system or at least applications not working as they should.

      Thanks.

      dnf-4.14.0-11.el9 is affected.

              rhn-support-ppisar Petr Pisar
              myllynen Marko Myllynen
              packaging-team-maint packaging-team-maint
              Eva Mrakova Eva Mrakova
              Mariya Pershina Mariya Pershina
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: