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

dnf autoremove attempts to remove installonlypkgs

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • rhel-10.0
    • rhel-10.0.beta
    • dnf
    • dnf-4.20.0-1.el10
    • None
    • Moderate
    • rhel-sst-cs-software-management
    • ssg_core_services
    • 8
    • False
    • Hide

      None

      Show
      None
    • Yes
    • None
    • Bug Fix
    • Hide
      Cause: Removing unneeded packages with "dnf autoremove" command if an installed package is marked as "installonly" (i.e. multiple versions of that package can be installed in parallel).
      Consequence: "installonly" packages were removed despite that dnf(8) manual excludes "installonly" packages from "dnf autoremove" operations.
      Fix: The manual was fixed not to exclude "installonly" packages from "dnf autoremove" command operations. Also dnf tool was corrected to correctly infer a package installation reason from an installation history in case of multiple "installonly" packages.
      Result: "dnf autoremove" command behavior and the documentation are aligned. An installation reason used by that command is now properly respected. If "dnf autoremove" still insists on removing needed packages, users are advised to mark them with "dnf mark install PACKAGE".
      Show
      Cause: Removing unneeded packages with "dnf autoremove" command if an installed package is marked as "installonly" (i.e. multiple versions of that package can be installed in parallel). Consequence: "installonly" packages were removed despite that dnf(8) manual excludes "installonly" packages from "dnf autoremove" operations. Fix: The manual was fixed not to exclude "installonly" packages from "dnf autoremove" command operations. Also dnf tool was corrected to correctly infer a package installation reason from an installation history in case of multiple "installonly" packages. Result: "dnf autoremove" command behavior and the documentation are aligned. An installation reason used by that command is now properly respected. If "dnf autoremove" still insists on removing needed packages, users are advised to mark them with "dnf mark install PACKAGE".
    • Proposed
    • None

      What were you trying to do that didn't work?

      `dnf autoremove` attempts to remove installonlypkgs

      Please provide the package NVR for which bug is seen:

      dnf-4.7.0-16.el8_8.noarch
      libdnf-0.63.0-14.el8_8.x86_64
      dnf-plugins-core-4.0.21-19.el8_8.noarch

      dnf-4.14.0-5.el9_2.noarch
      dnf-plugins-core-4.3.0-5.el9_2.noarch
      libdnf-0.69.0-3.el9_2.x86_64

      Steps to reproduce

      1. `dnf autoremove` > identify a package that will be removed
      2. `echo "installonlypkgs=that-package" >> /etc/dnf/dnf.conf
      3.  `dnf autoremove` > still attempts to remove the package

      Expected results

             Packages listed in installonlypkgs are never automatically removed by this command.

       

      man dnf
         Autoremove Command
             Command: autoremove
             Aliases for explicit NEVRA matching: autoremove-n, autoremove-na, autoremove-nevra
             dnf [options] autoremove
                Removes all "leaf" packages from the system that were originally installed  as  dependencies
                of user-installed packages, but which are no longer required by any such package.
             Packages listed in installonlypkgs are never automatically removed by this command.
      
       

      Actual results

       

      Note:

      This came up when a customers dnf autoremove command attempted to remove kernel packages. Our only suspicion is that they ran dnf mark remove on the kernel packages, which then allowed dnf to `autoremove` them. But that shouldn't be the case regardless as these are installonlypkgs.

      RHEL 10 (dnf-4.19.0-2.el10.noarch) is affected.

              Unassigned Unassigned
              rhn-support-jcastran John Castranio
              packaging-team-maint packaging-team-maint
              Software Management QE Software Management QE
              Mariya Pershina Mariya Pershina
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: