Bug 2178329

Summary: dnf5 doesn't replace the oldest installed non-running kernel with a newer one during upgrade
Product: [Fedora] Fedora Reporter: Tomáš Bajer <tbajer>
Component: dnf5Assignee: Marek Blaha <mblaha>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: 38CC: amatej, jkolarik, mblaha, nsella, orion, pkratoch, rpm-software-management
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf5-5.0.11-2.fc38 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-28 01:03:06 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 Tomáš Bajer 2023-03-14 21:36:15 UTC
Description of problem:
dnf5 doesn't replace the oldest installed non-running kernel with a newer one during upgrade 

Version-Release number of selected component (if applicable):
# dnf5 --version
dnf5 version 5.0.6
dnf5 plugin API version 1.0
libdnf5 version 5.0.6
libdnf5 plugin API version 1.0


How reproducible:
always

Steps to Reproduce:
1. Have 3 kernels installed, the oldest one is the running one
# rpm -q kernel
kernel-6.2.0-63.fc38.x86_64
kernel-6.2.2-300.fc38.x86_64
kernel-6.2.5-300.fc38.x86_64

# uname -r
6.2.0-63.fc38.x86_64

2. # dnf5 upgrade kernel
3.

Actual results:
Failed to resolve the transaction:
Problem: The operation would result in removing of running kernel: kernel-core-0:6.2.0-63.fc38.x86_64

Expected results:
Same as microdnf in Fedora 37 would produce - replacing the oldest non-running installed kernel for a newer version:
# rpm -q kernel
kernel-6.0.7-301.fc37.x86_64
kernel-6.1.15-200.fc37.x86_64
kernel-6.1.16-200.fc37.x86_64

# uname -r
6.0.7-301.fc37.x86_64

# microdnf upgrade kernel 
Package                                                                                                                                                                Repository                                                         Size
Installing:                                                                                                                                                                                                                                   
 kernel-6.1.18-200.fc37.x86_64                                                                                                                                         updates                                                        123.4 kB
 kernel-core-6.1.18-200.fc37.x86_64                                                                                                                                    updates                                                         51.0 MB
 kernel-modules-6.1.18-200.fc37.x86_64                                                                                                                                 updates                                                         61.0 MB
Removing:                                                                                                                                                                                                                                     
 kernel-6.1.15-200.fc37.x86_64                                                                                                                                         @System                                                         0 bytes
 kernel-core-6.1.15-200.fc37.x86_64                                                                                                                                    @System                                                         94.9 MB
 kernel-modules-6.1.15-200.fc37.x86_64                                                                                                                                 @System                                                         59.4 MB
 kernel-modules-extra-6.1.15-200.fc37.x86_64                                                                                                                           @System                                                          3.3 MB
 kernel-modules-internal-6.1.15-200.fc37.x86_64                                                                                                                        @System                                                        735.6 kB
Transaction Summary:
 Installing:        3 packages
 Reinstalling:      0 packages
 Upgrading:         0 packages
 Obsoleting:        0 packages
 Removing:          5 packages
 Downgrading:       0 packages
Is this ok [y/N]: y
Downloading packages...
Running transaction test...
Installing: kernel-core;6.1.18-200.fc37;x86_64;updates
Installing: kernel-modules;6.1.18-200.fc37;x86_64;updates
Installing: kernel;6.1.18-200.fc37;x86_64;updates
Removing: kernel-modules-internal;6.1.15-200.fc37;x86_64;installed
Removing: kernel-modules-extra;6.1.15-200.fc37;x86_64;installed
Cleanup: kernel;6.1.15-200.fc37;x86_64;installed
Cleanup: kernel-modules;6.1.15-200.fc37;x86_64;installed
Cleanup: kernel-core;6.1.15-200.fc37;x86_64;installed
Complete.

Additional info:
Expected the same behaviour due to full feature parity microdnf:dnf5

Comment 2 Marek Blaha 2023-04-03 08:35:00 UTC
*** Bug 2156954 has been marked as a duplicate of this bug. ***

Comment 3 Fedora Update System 2023-05-19 11:05:58 UTC
FEDORA-2023-c8fb79e192 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-c8fb79e192

Comment 4 Fedora Update System 2023-05-20 09:20:19 UTC
FEDORA-2023-c8fb79e192 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-c8fb79e192`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-c8fb79e192

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2023-05-28 01:03:06 UTC
FEDORA-2023-c8fb79e192 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.