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

dnf autoremove attempts to remove installonlypkgs

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Major Major
    • rhel-9.5
    • rhel-8.8.0.z, rhel-9.2.0.z
    • dnf
    • dnf-4.14.0-11.el9
    • None
    • Moderate
    • rhel-sst-cs-software-management
    • ssg_core_services
    • 10
    • 12
    • 8
    • False
    • Hide

      None

      Show
      None
    • Yes
    • None
    • Bug Fix
    • Hide
      .The `dnf autoremove` command behavior is now consistent with the man page documentation and the command now considers the package installation reason

      Previously, when you removed unnecessary packages by using the `dnf autoremove` command, installed packages marked as `installonly` were removed. However, the `dnf(8)` man page documentation contained information that `installonly` packages were excluded from the `dnf autoremove` operations.

      With this update, the following fixes were provided:

      * The `dnf(8)` man page documentation now conveys that `installonly` packages are not excluded from `dnf autoremove`.
      * DNF now correctly infers a package installation reason from the installation history if multiple `installonly` packages are included in the `dnf autoremove` operation.

      As a result, the `dnf autoremove` command behavior is now consistent with the man page documentation and the command now considers the package installation reason.

      NOTE: If `dnf autoremove` insists on removing the required packages, mark these packages as `dnf mark install _<package>_`.
      Show
      .The `dnf autoremove` command behavior is now consistent with the man page documentation and the command now considers the package installation reason Previously, when you removed unnecessary packages by using the `dnf autoremove` command, installed packages marked as `installonly` were removed. However, the `dnf(8)` man page documentation contained information that `installonly` packages were excluded from the `dnf autoremove` operations. With this update, the following fixes were provided: * The `dnf(8)` man page documentation now conveys that `installonly` packages are not excluded from `dnf autoremove`. * DNF now correctly infers a package installation reason from the installation history if multiple `installonly` packages are included in the `dnf autoremove` operation. As a result, the `dnf autoremove` command behavior is now consistent with the man page documentation and the command now considers the package installation reason. NOTE: If `dnf autoremove` insists on removing the required packages, mark these packages as `dnf mark install _<package>_`.
    • Done
    • 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.

              rhn-support-ppisar Petr Pisar
              rhn-support-jcastran John Castranio
              packaging-team-maint packaging-team-maint
              Jan Blazek Jan Blazek
              Mariya Pershina Mariya Pershina
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: