Bug 2108243 - redhat-upgrade-tool fails to update kernel entry in grub.conf
Summary: redhat-upgrade-tool fails to update kernel entry in grub.conf
Keywords:
Status: CLOSED DUPLICATE of bug 2166233
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: redhat-upgrade-tool
Version: 6.10
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Petr Stodulka
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On: 2166233
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-18 16:41 UTC by Pradeep Jagtap
Modified: 2023-03-13 16:37 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-03-13 16:37:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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 ***


Note You need to log in before you can comment on or make changes to this bug.