Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1926261

Summary: dnf should not allow an installonly_limit less than 2
Product: Red Hat Enterprise Linux 8 Reporter: jcastran
Component: dnfAssignee: Marek Blaha <mblaha>
Status: CLOSED ERRATA QA Contact: Jan Blazek <jblazek>
Severity: high Docs Contact:
Priority: high    
Version: 8.3CC: dstreit, james.antill, mblaha, pkratoch
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-4.7.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:52:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1951409, 1951411    
Bug Blocks:    

Description jcastran 2021-02-08 14:16:14 UTC
Description of problem:
When the installonly_limit is set to 1, dnf fails to update the kernel and does not clearly indicate why. DNF should not allow for an installonly_limit of 1

Version-Release number of selected component (if applicable):
dnf-4.2.23-4.el8.noarch

How reproducible:
Everytime

Steps to Reproduce:
1. Have a kernel update available or install a lower kernel
2. # yum update kernel --setopt=installonly_limit=1
3.

Actual results:
Error:
 Problem: The operation would result in removing the following protected packages: kernel-core
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)


Expected results:
yum/dnf prevents the installonly_limit being set less than 2. 


Additional info:
RHEL 7 implemented this in 2008

https://github.com/rpm-software-management/yum/commit/b31133149f5b25e0fb01d6bfa07f4d6f699c9142

When this is set on RHEL 7, yum stops you.

Options error: Error parsing "installonly_limit = '1'": out of range integer value

Comment 1 Marek Blaha 2021-02-16 08:54:24 UTC
According to `man dnf.conf` (see https://dnf.readthedocs.io/en/latest/conf_ref.html#installonly-limit-label for a html version) values 0 or 1 in installonly_limit configuration option means that unlimited number of installonly packages is being kept. Apparently, due to a bug in dnf only value 0 is accepted as such.
Is fixing the dnf to behave according the documentation acceptable solution? I.e. if installonly_limit is 1, no error is raised and dnf allows any number of kernels installed.

Comment 2 Marek Blaha 2021-02-17 09:09:49 UTC
The other option of fixing it is what you actually proposed - change the documentation that 1 is not allowed value and raise similar error as RHEL 7 did.

Comment 3 jcastran 2021-02-17 12:58:29 UTC
My vote is to change the documentation and not allow a value of 1. 

This would prevent cases where it was assumed 1 meant only 1 kernel is allowed and they inevitably run out of space in /boot. Better to allow 0 to be unlimited, but make 1 output a message telling them they can't do that.

Comment 5 Marek Blaha 2021-03-05 15:59:03 UTC
PR that disallows installonly_limit=1 configuration option - https://github.com/rpm-software-management/libdnf/pull/1155
PR that changes documentation accordingly and prints the warning to the user - https://github.com/rpm-software-management/dnf/pull/1740

Comment 6 Marek Blaha 2021-03-05 16:10:40 UTC
PR with test: https://github.com/rpm-software-management/ci-dnf-stack/pull/970

Comment 16 errata-xmlrpc 2021-11-09 19:52:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: dnf security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:4464