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 1739286

Summary: kernel.spec: Old kernel bootloader entries are left after removing old kernel packages
Product: Red Hat Enterprise Linux 8 Reporter: Ian Wienand <iwienand>
Component: kernelAssignee: Prarit Bhargava <prarit>
kernel sub component: Other QA Contact: Red Hat Kernel QE team <kernel-qe>
Status: CLOSED WORKSFORME Docs Contact:
Severity: unspecified    
Priority: unspecified CC: nhorman
Version: 8.0Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-10 14:24:47 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 Ian Wienand 2019-08-09 00:53:43 UTC
Description of problem:

After uninstalling original kernel packages, boot entries are left in /boot/loader/entries

Version-Release number of selected component (if applicable):

Tested with ./rhel-8.0-update-1-x86_64-kvm.qcow2

Steps to Reproduce:

1. boot above image; entries for the active kernel are present.

---
[root@rhl8-test cloud-user]# ls /boot/loader/entries
e1b088c6ab1348649040e16d35eebe6b-0-rescue.conf  
1b088c6ab1348649040e16d35eebe6b-4.18.0-80.4.2.el8_0.x86_64.conf
---

2. upgrade kernel; new entries are present (but with the machine-id of the host now)

---
$ dnf install kernel
...
  Verifying        : linux-firmware-20190111-92.gitd9fb2ee6.el8.noarch
  Verifying        : kernel-4.18.0-80.7.2.el8_0.x86_64
  Verifying        : kernel-modules-4.18.0-80.7.2.el8_0.x86_64
  Verifying        : kernel-core-4.18.0-80.7.2.el8_0.x86_64
---

---
[root@rhl8-test cloud-user]# ls -l /boot/loader/entries
total 16
-rw-r--r--. 1 root root 408 Jun 18 13:08 e1b088c6ab1348649040e16d35eebe6b-0-rescue.conf
-rw-r--r--. 1 root root 371 Jun 18 13:08 e1b088c6ab1348649040e16d35eebe6b-4.18.0-80.4.2.el8_0.x86_64.conf
-rw-r--r--. 1 root root 408 Aug  8 20:29 fbe7f11dbeb44acaac82560ee97c0414-0-rescue.conf
-rw-r--r--. 1 root root 371 Aug  8 20:29 fbe7f11dbeb44acaac82560ee97c0414-4.18.0-80.7.2.el8_0.x86_64.conf
---

3. reboot to get new kernel going

4. remove old kernel(s)

---
[root@rhl8-test cloud-user]# dnf remove kernel-0:4.18.0-80.4.2.el8_0.x86_64 kernel-core-0:4.18.0-80.4.2.el8_0.x86_64 kernel-modules-0:4.18.0-80.4.2.el8_0.x86_64
...
Running transaction
...
Erasing          : kernel-4.18.0-80.4.2.el8_0.x86_64                                                                                                                                                                                                   Erasing          : kernel-modules-4.18.0-80.4.2.el8_0.x86_64                                                                                                                                                                                           Erasing          : kernel-core-4.18.0-80.4.2.el8_0.x86_64                                                                                                                                                                                            
...
Complete!
---

5. Old bootloader entries remain despite the kernel being removed

---
[root@rhl8-test cloud-user]# ls -l /boot/loader/entries
total 16
-rw-r--r--. 1 root root 408 Jun 18 13:08 e1b088c6ab1348649040e16d35eebe6b-0-rescue.conf
-rw-r--r--. 1 root root 371 Jun 18 13:08 e1b088c6ab1348649040e16d35eebe6b-4.18.0-80.4.2.el8_0.x86_64.conf
-rw-r--r--. 1 root root 408 Aug  8 20:29 fbe7f11dbeb44acaac82560ee97c0414-0-rescue.conf
-rw-r--r--. 1 root root 371 Aug  8 20:29 fbe7f11dbeb44acaac82560ee97c0414-4.18.0-80.7.2.el8_0.x86_64.conf
---

Expected results:

Only the available kernels are listed there


Additional info:

I can only presume this is because the machine-id on the .qcow2 image is re-generated, and the uninstall scripts don't want to touch bootloader entries that don't match the current machine-id.  But then this also means that grub has invalid entries in the boot menu.

I'm not really sure if this is a kernel problem, or a systemd problem (if that owns the install scripts), or perhaps an image generation problem.

Comment 2 Prarit Bhargava 2020-09-10 14:24:47 UTC
Going back through some older bugs.  It looks like we fixed this at some point:

[10:08 AM root@intel-whitley-03 rhel]# rhget -i kernel-4.18.0-231.el8
installing ... Verifying...                                                     ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:kernel-core-4.18.0-231.el8       ################################# [ 33%]
   2:kernel-modules-4.18.0-231.el8    ################################# [ 67%]
   3:kernel-4.18.0-231.el8            ################################# [100%]
[10:08 AM root@intel-whitley-03 rhel]# rhget -i kernel-4.18.0-232.el8
installing ... Verifying...                                                     ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:kernel-core-4.18.0-232.el8       ################################# [ 33%]
   2:kernel-modules-4.18.0-232.el8    ################################# [ 67%]
   3:kernel-4.18.0-232.el8            ################################# [100%]
[10:12 AM root@intel-whitley-03 rhel]# rhget -i kernel-4.18.0-233.el8
installing ... Verifying...                                                     ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:kernel-core-4.18.0-233.el8       ################################# [ 33%]
   2:kernel-modules-4.18.0-233.el8    ################################# [ 67%]
   3:kernel-4.18.0-233.el8            ################################# [100%]
[10:16 AM root@intel-whitley-03 ~]# cd /boot/loader/entries/
[10:17 AM root@intel-whitley-03 entries]# ls
23fda7f6dca049b0892e0647df33aeed-0-rescue.conf
23fda7f6dca049b0892e0647df33aeed-4.18.0-231.el8.x86_64.conf
23fda7f6dca049b0892e0647df33aeed-4.18.0-232.el8.x86_64.conf
23fda7f6dca049b0892e0647df33aeed-4.18.0-233.el8.x86_64.conf
23fda7f6dca049b0892e0647df33aeed-4.18.0-234.el8.x86_64.conf
[10:17 AM root@intel-whitley-03 rhel]# rpm -e kernel-core-4.18.0-231.el8 kernel-modules-4.18.0-231.el8 kernel-4.18.0-231.el8
[10:17 AM root@intel-whitley-03 rhel]# 
[10:17 AM root@intel-whitley-03 entries]# ls
23fda7f6dca049b0892e0647df33aeed-0-rescue.conf
23fda7f6dca049b0892e0647df33aeed-4.18.0-232.el8.x86_64.conf
23fda7f6dca049b0892e0647df33aeed-4.18.0-233.el8.x86_64.conf
23fda7f6dca049b0892e0647df33aeed-4.18.0-234.el8.x86_64.conf

so there is no longer a -231 /boot/loader/entries conf file.

P.