Bug 1249427

Summary: upon install or upgrade, dnf removes kernel even if there are fewer than installonly_limit kernels installed
Product: [Fedora] Fedora Reporter: Dominik 'Rathann' Mierzejewski <dominik>
Component: dnfAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: jsilhan, mluscon, packaging-team-maint, pnemade, rholy, tim.lauridsen, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-03 11:08:31 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:

Description Dominik 'Rathann' Mierzejewski 2015-08-02 22:23:07 UTC
Description of problem:
Upon install or upgrade, dnf removes one existing kernel even if there are fewer than installonly_limit kernels installed.

Version-Release number of selected component (if applicable):
$ rpm -qa  \*dnf\* \*hawkey\*|sort
dnf-1.0.2-3.fc22.noarch
dnf-conf-1.0.2-3.fc22.noarch
dnf-langpacks-0.11.1-1.fc22.noarch
dnf-plugins-core-0.1.9-1.fc22.noarch
dnf-yum-1.0.2-3.fc22.noarch
hawkey-0.5.9-3.fc22.x86_64
python-dnf-1.0.2-3.fc22.noarch
python-dnf-plugins-core-0.1.9-1.fc22.noarch
python-dnf-plugins-extras-common-0.0.9-1.fc22.noarch
python-dnf-plugins-extras-migrate-0.0.9-1.fc22.noarch
python-dnf-plugins-extras-repomanage-0.0.9-1.fc22.noarch
python-hawkey-0.5.9-3.fc22.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. Have the following kernels installed:
$ rpm -q kernel
kernel-4.0.7-300.fc22.x86_64
kernel-4.0.8-300.fc22.x86_64
2. Make sure installonly_limit is more than 2:
$ grep installonly /etc/dnf/dnf.conf 
installonly_limit=3
3. dnf upgrade or dnf install kernel

Actual results:
dnf tries to install kernel-4.1.3-200.fc22 (expected) and remove kernel-4.0.7-300.fc22 (not expected!)

Expected results:
dnf should only install the requested kernel, not remove any that are below installonly_limit.

Comment 1 Dominik 'Rathann' Mierzejewski 2015-08-02 23:38:06 UTC
Actually, bumping installonly_limit to 4 makes dnf keep 3 kernels as expected, so I'm suspecting an off-by-one error in the code. Could this be a duplicate of bug 1214562 or is this another issue?

Comment 2 Dominik 'Rathann' Mierzejewski 2015-08-03 11:08:31 UTC
Sorry for the noise. I found that I only removed kernel, but kernel-core and kernel-modules were still there, so everything works as designed.