This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 2161740 - Please generate /etc/kernel/cmdline so that kernel installed in ks post script can boot
Summary: Please generate /etc/kernel/cmdline so that kernel installed in ks post scrip...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: anaconda
Version: 9.2
Hardware: s390
OS: Unspecified
urgent
urgent
Target Milestone: rc
: ---
Assignee: Radek Vykydal
QA Contact: Release Test Team
URL: https://bugzilla.redhat.com/show_bug....
Whiteboard:
Depends On:
Blocks: 2172862 2144442 2162669 2162670
TreeView+ depends on / blocked
 
Reported: 2023-01-17 18:24 UTC by Marta Lewandowska
Modified: 2023-09-18 16:06 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2162669 2162670 (view as bug list)
Environment:
Last Closed: 2023-09-18 16:06:05 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   RHEL-4763 0 None Migrated None 2023-09-18 16:06:04 UTC
Red Hat Issue Tracker RHELPLAN-145409 0 None None None 2023-01-17 18:24:59 UTC
Red Hat Issue Tracker RTT-5130 0 None None None 2023-01-24 18:43:39 UTC
Red Hat Issue Tracker RTT-5131 0 None None None 2023-01-24 18:43:44 UTC
Red Hat Issue Tracker RTT-5132 0 None None None 2023-01-24 18:43:48 UTC

Description Marta Lewandowska 2023-01-17 18:24:31 UTC
Description of problem:
Installing / upgrading kernel in kickstart post installation script creates a boot entry without root set and with the wrong kernel cmdline arguments such that the entry boots into the emergency shell

Version-Release number of selected component (if applicable):
s390utils-core-2.22.0-2.el9.s390x

How reproducible:
always

Steps to Reproduce:
1. Add another kernel / installation repo in %post
2. dnf install -y kernel in %post

Actual results:
root= is not set, kernel cmdline arguments passed to new kernel come from installation (/proc/cmdline)
Machine reboots to emergency shell

Expected results:
root and cmdline arguments are set correctly and machine boots new kernel

Additional info:
This was fixed incidentally on all others arches that use grub2 as a bootloader:
https://bugzilla.redhat.com/show_bug.cgi?id=1940288
rharwood has already opened a PR which should fix this issue: https://src.fedoraproject.org/rpms/s390utils/pull-request/5
This is a high priority bug which customers are waiting for and will need to be quickly backported to RHEL 9.0

Comment 1 Marta Lewandowska 2023-01-18 12:34:50 UTC
I tested Robbie's scratch build with the PR, and it works as intended.

https://beaker.engineering.redhat.com/recipes/13248677

from beaker xml:
      <ks_appends>
        <ks_append><![CDATA[
        %post
curl -o /etc/yum.repos.d/s390utils.repo http://brew-task-repos.usersys.redhat.com/repos/scratch/rharwood/s390utils/2.25.0/999.el9/s390utils-2.25.0-999.el9-scratch.repo
dnf install -y s390utils

curl -o /etc/yum.repos.d/kernel.repo http://brew-task-repos.usersys.redhat.com/repos/official/kernel/5.14.0/235.el9/kernel-5.14.0-235.el9.repo
dnf update -y kernel
        %end
      ]]></ks_append>
      </ks_appends>

[root@rtt4 ~]# grubby --info ALL
index=0
kernel="/boot/vmlinuz-5.14.0-235.el9.s390x"
args="crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.dasd=0.0.4018 rd.dasd=0.0.4118 rd.dasd=0.0.4218 rd.dasd=0.0.4318 rd.dasd=0.0.4019 rd.dasd=0.0.4119 rd.dasd=0.0.4219 rd.dasd=0.0.4319 rd.lvm.lv=rhel_rtt4/root rd.lvm.lv=rhel_rtt4/swap cio_ignore=all,!condev rd.znet=qeth,0.0.0a00,0.0.0a01,0.0.0a02,layer2=1,portno=0"
root="/dev/mapper/rhel_rtt4-root"
initrd="/boot/initramfs-5.14.0-235.el9.s390x.img"
title="(5.14.0-235.el9.s390x) "
id="3276f4c6bea34a489ceee2954dde2036-5.14.0-235.el9.s390x"
index=1
kernel="/boot/vmlinuz-5.14.0-230.el9.s390x"
args="crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.dasd=0.0.4018 rd.dasd=0.0.4118 rd.dasd=0.0.4218 rd.dasd=0.0.4318 rd.dasd=0.0.4019 rd.dasd=0.0.4119 rd.dasd=0.0.4219 rd.dasd=0.0.4319 rd.lvm.lv=rhel_rtt4/root rd.lvm.lv=rhel_rtt4/swap cio_ignore=all,!condev rd.znet=qeth,0.0.0a00,0.0.0a01,0.0.0a02,layer2=1,portno=0"
root="/dev/mapper/rhel_rtt4-root"
initrd="/boot/initramfs-5.14.0-230.el9.s390x.img"
title="(5.14.0-230.el9.s390x) "
id="3276f4c6bea34a489ceee2954dde2036-5.14.0-230.el9.s390x"
index=2
kernel="/boot/vmlinuz-0-rescue-3276f4c6bea34a489ceee2954dde2036"
args="crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.dasd=0.0.4018 rd.dasd=0.0.4118 rd.dasd=0.0.4218 rd.dasd=0.0.4318 rd.dasd=0.0.4019 rd.dasd=0.0.4119 rd.dasd=0.0.4219 rd.dasd=0.0.4319 rd.lvm.lv=rhel_rtt4/root rd.lvm.lv=rhel_rtt4/swap cio_ignore=all,!condev rd.znet=qeth,0.0.0a00,0.0.0a01,0.0.0a02,layer2=1,portno=0"
root="/dev/mapper/rhel_rtt4-root"
initrd="/boot/initramfs-0-rescue-3276f4c6bea34a489ceee2954dde2036.img"
title="(0-rescue-3276f4c6bea34a489ceee2954dde2036) "
id="3276f4c6bea34a489ceee2954dde2036-0-rescue"

[root@rtt4 ~]# uname -r
5.14.0-235.el9.s390x

[root@rtt4 ~]# cat /etc/kernel/cmdline 
root=/dev/mapper/rhel_rtt4-root crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.dasd=0.0.4018 rd.dasd=0.0.4118 rd.dasd=0.0.4218 rd.dasd=0.0.4318 rd.dasd=0.0.4019 rd.dasd=0.0.4119 rd.dasd=0.0.4219 rd.dasd=0.0.4319 rd.lvm.lv=rhel_rtt4/root rd.lvm.lv=rhel_rtt4/swap cio_ignore=all,!condev rd.znet=qeth,0.0.0a00,0.0.0a01,0.0.0a02,layer2=1,portno=0

Comment 3 Marta Lewandowska 2023-01-19 08:18:15 UTC
Yes, you need to use s390utils-core-2.22.0-2.el9.s390x to reproduce this. 

This bug is contingent on doing the kernel update during the installation. Kernel installation scripts read their arguments from /proc/cmdline, which-- only during installation-- contains arguments passed to the installer: https://bugzilla.redhat.com/show_bug.cgi?id=1940288#c21

Comment 4 Dan Horák 2023-01-19 11:19:05 UTC
I am wondering how the change in the kernel install script will work with the scenario described in bug #1899759 ... The change has been pushed to Fedora, so hopefully tomorrow there will be an ISO to try.

Comment 10 Marta Lewandowska 2023-01-20 17:15:47 UTC
If I inst.addrepo (to s390utils) on the kernel cmdline, there is a failure in kernel post trans scriptlet: https://beaker.engineering.redhat.com/jobs/7451863

from console log of that job:
[  110.173248] anaconda[2552]: Configuring kernel-core.s390x                     
[  112.202201] anaconda[2552]: The installation was stopped due to an error whic 
h occurred while running in non-interactive cmdline mode. Since there cannot be  
any questions in cmdline mode, edit your kickstart file and retry installation.  
                                                                                 
[  112.202250] anaconda[2552]: The exact error message is:                       
[  112.202270] anaconda[2552]: Non interactive installation failed: DNF error: E 
rror in POSTTRANS scriptlet in rpm package kernel-core.                          
[  112.202288] anaconda[2552]: The installer will now terminate.  


But if I add the repo in the post installation script, the machine boots: https://beaker.engineering.redhat.com/jobs/7452156

[root@rtt4 ~]# grubby --info ALL
index=0
kernel="/boot/vmlinuz-5.14.0-235.el9.s390x"
args="crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.dasd=0.0.4018 rd.dasd=0.0.4118 rd.dasd=0.0.4218 rd.dasd=0.0.4318 rd.dasd=0.0.4019 rd.dasd=0.0.4119 rd.dasd=0.0.4219 rd.dasd=0.0.4319 rd.lvm.lv=rhel_rtt4/root rd.lvm.lv=rhel_rtt4/swap cio_ignore=all,!condev rd.znet=qeth,0.0.0a00,0.0.0a01,0.0.0a02,layer2=1,portno=0"
root="/dev/mapper/rhel_rtt4-root"
initrd="/boot/initramfs-5.14.0-235.el9.s390x.img"
title="(5.14.0-235.el9.s390x) "
id="61dc6f783d574d01b7fda64c66ee4fe6-5.14.0-235.el9.s390x"
index=1
kernel="/boot/vmlinuz-5.14.0-230.el9.s390x"
args="crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.dasd=0.0.4018 rd.dasd=0.0.4118 rd.dasd=0.0.4218 rd.dasd=0.0.4318 rd.dasd=0.0.4019 rd.dasd=0.0.4119 rd.dasd=0.0.4219 rd.dasd=0.0.4319 rd.lvm.lv=rhel_rtt4/root rd.lvm.lv=rhel_rtt4/swap cio_ignore=all,!condev rd.znet=qeth,0.0.0a00,0.0.0a01,0.0.0a02,layer2=1,portno=0"
root="/dev/mapper/rhel_rtt4-root"
initrd="/boot/initramfs-5.14.0-230.el9.s390x.img"
title="(5.14.0-230.el9.s390x) "
id="61dc6f783d574d01b7fda64c66ee4fe6-5.14.0-230.el9.s390x"
index=2
kernel="/boot/vmlinuz-0-rescue-61dc6f783d574d01b7fda64c66ee4fe6"
args="crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.dasd=0.0.4018 rd.dasd=0.0.4118 rd.dasd=0.0.4218 rd.dasd=0.0.4318 rd.dasd=0.0.4019 rd.dasd=0.0.4119 rd.dasd=0.0.4219 rd.dasd=0.0.4319 rd.lvm.lv=rhel_rtt4/root rd.lvm.lv=rhel_rtt4/swap cio_ignore=all,!condev rd.znet=qeth,0.0.0a00,0.0.0a01,0.0.0a02,layer2=1,portno=0"
root="/dev/mapper/rhel_rtt4-root"
initrd="/boot/initramfs-0-rescue-61dc6f783d574d01b7fda64c66ee4fe6.img"
title="(0-rescue-61dc6f783d574d01b7fda64c66ee4fe6) "
id="61dc6f783d574d01b7fda64c66ee4fe6-0-rescue"
[root@rtt4 ~]# uname -r
5.14.0-235.el9.s390x

[root@rtt4 ~]# rpm -qa s390utils\*
s390utils-core-2.25.0-2.el9.s390x
s390utils-iucvterm-2.25.0-2.el9.s390x
s390utils-mon_statd-2.25.0-2.el9.s390x
s390utils-cpuplugd-2.25.0-2.el9.s390x
s390utils-osasnmpd-2.25.0-2.el9.s390x
s390utils-base-2.25.0-2.el9.s390x
s390utils-ziomon-2.25.0-2.el9.s390x
s390utils-2.25.0-2.el9.s390x

[root@rtt4 ~]# cat /etc/kernel/cmdline 
root=/dev/mapper/rhel_rtt4-root crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.dasd=0.0.4018 rd.dasd=0.0.4118 rd.dasd=0.0.4218 rd.dasd=0.0.4318 rd.dasd=0.0.4019 rd.dasd=0.0.4119 rd.dasd=0.0.4219 rd.dasd=0.0.4319 rd.lvm.lv=rhel_rtt4/root rd.lvm.lv=rhel_rtt4/swap cio_ignore=all,!condev rd.znet=qeth,0.0.0a00,0.0.0a01,0.0.0a02,layer2=1,portno=0

Comment 11 Dan Horák 2023-01-20 17:41:40 UTC
I wonder if the patched script works for installing the first kernel when doing the installation ...

Comment 12 Dan Horák 2023-01-23 11:30:27 UTC
so yes, the 20-zipl-kernel.install script is broken for the initial kernel installation :-(

Jan 23 08:06:29 fedora anaconda[1831]: anaconda: modules.payloads.payload.dnf.transaction_progress: Configuring (running scriptlet for): kernel-core-6.2.0-0.rc4.20230120git>
Jan 23 08:06:29 fedora anaconda[2519]: dnf: awk: fatal: cannot open file `/boot/loader/entries/*.conf' for reading: No such file or directory
                                       Could not determine the kernel command line parameters.
                                       Please specify the kernel command line in /etc/kernel/cmdline!
                                       warning: %posttrans(kernel-core-6.2.0-0.rc4.20230120gitd368967cb103.35.fc38.s390x) scriptlet failed, exit status 1
Jan 23 08:06:29 fedora anaconda[2519]: dnf: Error in POSTTRANS scriptlet in rpm package kernel-core

Comment 13 Dan Horák 2023-01-23 12:12:09 UTC
I think we should move the creation of /etc/kernel/cmdline (if it doesn't exist yet) to
https://src.fedoraproject.org/rpms/s390utils/blob/rawhide/f/20-zipl-kernel.install#_111
after the BLS entry will be created. And keep the previous logic of determining the BOOT_OPTIONS.

Robbie, what do you think?

Comment 14 Dan Horák 2023-01-23 13:09:04 UTC
and it won't work as well ...

using the following patch instead

diff --git a/20-zipl-kernel.install b/20-zipl-kernel.install
index 4fadd1d..365330b 100755
--- a/20-zipl-kernel.install
+++ b/20-zipl-kernel.install
@@ -101,6 +101,17 @@ case "$COMMAND" in
                     "${BOOT_OPTIONS[*]}" >"${BLS_TARGET}"
             fi
 
+            if [[ ! -f /etc/kernel/cmdline ]]; then
+                last=''
+                for entry in "${BLS_DIR}"/*.conf; do
+                    last="$entry"
+                done
+                if [[ ! -z "$last" ]]; then
+                    args="$(awk '/options/{$1="";$0=$0;$1=$1;print}' $last)"
+                    echo "$args" > /etc/kernel/cmdline
+                fi
+            fi
+
             if [[ "$KERNEL_VERSION" == *\+* ]] && [ "x$DEFAULTDEBUG" != "xyes" ]; then
                 UPDATEDEFAULT="no"
             fi


I am getting the following after a successful instalation

[anaconda root@fedora /]# cat /etc/kernel/cmdline 
inst.ks=file:/vm.ks inst.sshd inst.addrepo=s390utils,http://junkyard.khw1.lab.eng.bos.redhat.com/f38/s390x/repo/ inst.repo=https://kojipkgs.fedoraproject.org/compose/rawhide/Fedora-Rawhide-20230122.n.0/compose/Everything/s390x/os/

[anaconda root@fedora entries]# cat 975fff50b3df4c7b87f8b949bd7dac61-6.2.0-0.rc4.20230120gitd368967cb103.35.fc38.s390x.conf
title  (6.2.0-0.rc4.20230120gitd368967cb103.35.fc38.s390x) 
version 6.2.0-0.rc4.20230120gitd368967cb103.35.fc38.s390x
linux /boot/vmlinuz-6.2.0-0.rc4.20230120gitd368967cb103.35.fc38.s390x
initrd /boot/initramfs-6.2.0-0.rc4.20230120gitd368967cb103.35.fc38.s390x.img
options root=UUID=04808e15-2c7d-4c1c-829f-356f3b3a248f
id -20230123123011-6.2.0-0.rc4.20230120gitd368967cb103.35.fc38.s390x
grub_users $grub_users
grub_arg --unrestricted
grub_class kernel

which means the initial BLS snippet contain the "garbage" from /proc/cmdline, but it is fixed later.

I believe writing of the initial (install time) /etc/kernel/cmdline must happen at the same time (or later) when the "options" in the BLS snipped get converted to the final/working state. And it might be somewhere in anaconda.

Comment 16 Dan Horák 2023-01-23 14:07:00 UTC
I think
https://github.com/rhinstaller/anaconda/blob/master/pyanaconda/modules/storage/bootloader/zipl.py#L110
is the place where /etc/kernel/cmdline should be created. But only from the options for the production kernel IMO.

The question is how it is handled by other platforms? And another question is how "/etc/kernel/cmdline" is defined, what component is responsible for providing it?

Comment 17 Robbie Harwood 2023-01-23 18:34:52 UTC
I think creating it in anaconda is a good way to go.

On other platforms, grub spits it out during mkconfig, and there's some logic to run that when needed from kernel-install.  Because mkconfig isn't run after install, grubby can also produce it when needed.  Since existing systems would need an upgrade path anyway, I didn't want to involve anaconda... but if there's no other way to get the initial correct arguments on s390x, then I guess we have to.

Comment 18 Robbie Harwood 2023-01-23 18:41:04 UTC
addendum: grubby will also update this file (and can create it if it doesn't exist) but only when args are added/removed.

Comment 19 Dan Horák 2023-01-24 08:52:38 UTC
I think writing /etc/kernel/cmdline initially by anaconda should be done on all platforms, because it sets the initial cmdline. In the grub2 case, there is write_defaults() in https://github.com/rhinstaller/anaconda/blob/master/pyanaconda/modules/storage/bootloader/grub2.py#L253 and it could create /etc/kernel/cmdline. Then instead of having GRUB_CMDLINE_LINUX="arg1 arg2 ..." it could do GRUB_CMDLINE_LINUX=$(cat /etc/kernel/cmdline) like it does for GRUB_DISTRIBUTOR.

Then we can say
- /etc/kernel/cmdline is the default place for setting kernel boot parameters
- it is written initially by the installer
- (and probably more, but I can't recall now :-))


Marta, could you bring it to the installer team? I can draft an initial PR (for Rawhide, it will need some time in Fedora) for the change, but it shouldn't be difficult.

Comment 20 Marta Lewandowska 2023-01-24 10:16:41 UTC
Of course. Thank you, Dan.

Comment 21 Marta Lewandowska 2023-01-24 11:35:55 UTC
I have brought this to the attention of anaconda folks and am reassigning as per comment#19

Comment 33 RHEL Program Management 2023-09-18 16:04:11 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 34 RHEL Program Management 2023-09-18 16:06:05 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


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