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

dnf removes packages when yum would not

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • rhel-10.0.beta
    • rhel-8.10, rhel-9.4, rhel-10.0.beta
    • dnf
    • dnf-4.20.0-2.el10
    • None
    • None
    • sst_cs_software_management
    • ssg_core_services
    • 16
    • 19
    • None
    • False
    • Hide

      None

      Show
      None
    • No
    • None
    • Bug Fix
    • Hide
      Cause: Having installed both a package and another package which RPM-provides the former package name. Then uninstalling the package with "dnf remove-n" command.
      Consequence: A first invocation of the command removed the former package. Repeated invocation of the same command removed the latter package.
      Fix: It fixes "dnf remove-n" command to ensure only packages with the matching rpm names will be removed.
      Result: "dnf remove-n" command removes only packages matching the specifiied package name. RPM-provides are not taken into account. One "dnf remove-n" command is enough to remove all matching packages. Subsequent invocations are idempotent.
      Show
      Cause: Having installed both a package and another package which RPM-provides the former package name. Then uninstalling the package with "dnf remove-n" command. Consequence: A first invocation of the command removed the former package. Repeated invocation of the same command removed the latter package. Fix: It fixes "dnf remove-n" command to ensure only packages with the matching rpm names will be removed. Result: "dnf remove-n" command removes only packages matching the specifiied package name. RPM-provides are not taken into account. One "dnf remove-n" command is enough to remove all matching packages. Subsequent invocations are idempotent.
    • Proposed
    • 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.

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

                Created:
                Updated: