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 2108243

Summary: redhat-upgrade-tool fails to update kernel entry in grub.conf
Product: Red Hat Enterprise Linux 6 Reporter: Pradeep Jagtap <prjagtap>
Component: redhat-upgrade-toolAssignee: Petr Stodulka <pstodulk>
Status: CLOSED DUPLICATE QA Contact: Release Test Team <release-test-team-automation>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.10CC: cchouhan, phracek, pstodulk, renju.roy, rmetrich, snavale, sujagtap
Target Milestone: rcKeywords: Extras
Target Release: ---   
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: 2023-03-13 16:37:32 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: 2166233    
Bug Blocks:    

Description Pradeep Jagtap 2022-07-18 16:41:42 UTC
Description of problem:
=======================
redhat-upgrade-tool fails to update kernel entry in grub.conf 


Version-Release number of selected component (if applicable):
============================================================
redhat-upgrade-tool-0.8.0-9.el6.noarch

How reproducible:
==================
Use latest RHEL 7.9 Installation repository


Steps to Reproduce:
==================
1. Once preupg is completed without error
2. Run upgrade with
     # redhat-upgrade-tool --network 7.9 --instrepo ftp-or-http-url --cleanup-post

3. System would be prompted for reboot. Reboot the system
4. Now system will boot with Upgrade initramfs
5. Once done it would fail to get proper entry of RHEL 7 kernel in grub and system fails.


Actual results:
================
Fails to see RHEL 7 kernel entry in grub.conf


Expected results:
====================
Grub.conf should have kernel entry with all older grub parameters


Additional info:
================
Issue is only see when Installation repository
kernel-3.10.0-1160.62.1.el7.x86_64.rpm or above version kernel

No issue found whne installation repository has older kernel than 
kernel-3.10.0-1160.62.1.el7.x86_64.rpm

Comment 10 Petr Stodulka 2023-03-09 09:48:55 UTC
The issue is caused by the change in the target kernel, which switched the adding of new kernel entry in grub configuration file from the %post phase to %posttrans phase, to add the new entry only after the initramfs is generated (bug #1893756). Regarding that, the update of the bootloader entries fails as there is no installed kernel when the scriptlet is running so it cannot obtain default kernel parameters.

snippet of the debug output: 

~~~
# /usr/sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --install 3.10.0-1160.88.1.el7.x86_64
.....[snip]
++ eval /sbin/grubby --grub -c /boot/grub/grub.conf --add-kernel=/boot/vmlinuz-3.10.0-1160.88.1.el7.x86_64 --initrd /boot/initramfs-3.10.0-1160.88.1.el7.x86_64.img '--title="Red' Hat Enterprise Linux Server '(3.10.0-1160.88.1.el7.x86_64)' 7.9 '(Maipo)$debugtitle"' --copy-default '--args="root=/dev/mapper/vg_rhelmin6-lv_root' LANG=en_US.UTF-8 '$debugargs"' '--remove-kernel="TITLE=Red' Hat Enterprise Linux Server '(3.10.0-1160.88.1.el7.x86_64)' 7.9 '(Maipo)$debugtitle"' --make-default
+++ /sbin/grubby --grub -c /boot/grub/grub.conf --add-kernel=/boot/vmlinuz-3.10.0-1160.88.1.el7.x86_64 --initrd /boot/initramfs-3.10.0-1160.88.1.el7.x86_64.img '--title=Red Hat Enterprise Linux Server (3.10.0-1160.88.1.el7.x86_64) 7.9 (Maipo)' --copy-default '--args=root=/dev/mapper/vg_rhelmin6-lv_root LANG=en_US.UTF-8 ' '--remove-kernel=TITLE=Red Hat Enterprise Linux Server (3.10.0-1160.88.1.el7.x86_64) 7.9 (Maipo)' --make-default
grubby fatal error: unable to find a suitable template
~~~

The probllem here is that `--copy-default` cannot find anything from where the parameters should be copied so it crashes. The workaround could be to call the grubby command during post-upgrade phase (after the rpm transaction), delivering all arguments on our own (e.g. copy /proc/cmdline when still booted in RHEL 6 system and delivery the stuff...). But I can imagine there could be bunch of corner cases doing this in this way and i consider much safer to actually fix (or revert the fix) in the target el7 kernel to run the scriptlet again during the post phase as before.

For more information, see the bug 2166233.

Comment 12 Petr Stodulka 2023-03-09 10:00:15 UTC
Just for the full info, the issue is affecting RHEL 6 systems on intel architecture - with BIOS or EFI boot, does not matter.

Comment 13 Petr Stodulka 2023-03-13 16:37:32 UTC
Closing the ticket as the bug is going to be fixed in rhel7 kernel. Follow please bug 2166233 for further updates.

It seems the bug will be fixed in kernel-3.10.0-1160.89.1.el7.x86_64.rpm or newer.

*** This bug has been marked as a duplicate of bug 2166233 ***