-
Sub-task
-
Resolution: Done
-
Undefined
-
None
-
None
-
False
-
False
-
-
2
-
Testable
The parent issue RHELC-1601 has the label that triggered autocreation of this subtask to track the relative story point estimation for the integration test part of the issue.
The parent issue description at the time of creation of this issue was:
Reproduced on OL9.3-x86_64-HVM-2024-02-02 updated to 9.4 with minimal reproducer on Rocky-9-EC2-Base-9.4-20240509.0.x86_64
With misconfigured /etc/default/grub file convert2rhel is unable to remove the old vendor kernel packages in both the main transaction and then in the [Convert: Prepare kernel] task.
The conversion then fails with many tasks to still go through, most importantly the bootloader and/or GRUB2 configurations.
The system is left in undetermined state.
Logs: https://artifacts.osci.redhat.com/testing-farm/a25532ba-6c63-4903-a94d-5f370263b850/work-changed_grub_invalidsqd1u01o/plans/tier1/destructive/modified_grub_file/changed_grub_invalid/execute/data/guest/default-0/tests/integration/tier1/destructive/changed-grub-file/invalid_changes_to_grub_file-1/output.txt
Running scriptlet: kernel-core-5.14.0-362.8.1.el9_3.x86_64 [789/789] WARNING - Scriptlet output: /etc/default/grub: line 9: GRUB_CMDLINE_LINUX: command not found depmod: WARNING: could not open modules.order at /lib/modules/5.14.0-362.8.1.el9_3.x86_64: No such file or directory depmod: WARNING: could not open modules.builtin at /lib/modules/5.14.0-362.8.1.el9_3.x86_64: No such file or directory dracut-install: Failed to find module 'virtio_pci' dracut: FAILED: /usr/lib/dracut/dracut-install -D /var/tmp/dracut.DQaCQP/initramfs --kerneldir /lib/modules/5.14.0-362.8.1.el9_3.x86_64/ -m xen_netfront xen_blkfront virtio_blk virtio_net virtio_pci virtio_balloon hyperv_keyboard hv_netvsc hid_hyperv hv_utils hv_storvsc hyperv_fb ahci libahci ahci_platform libahci_platform ena nvme nvme_core depmod: WARNING: could not open modules.order at /var/tmp/dracut.DQaCQP/initramfs/lib/modules/5.14.0-362.8.1.el9_3.x86_64: No such file or directory depmod: WARNING: could not open modules.builtin at /var/tmp/dracut.DQaCQP/initramfs/lib/modules/5.14.0-362.8.1.el9_3.x86_64: No such file or directory /etc/default/grub: line 9: GRUB_CMDLINE_LINUX: command not found warning: %posttrans(kernel-core-5.14.0-362.8.1.el9_3.x86_64) scriptlet failed, exit status 127
Minimal reproducer
- Get e.g. Rocky-9-EC2-Base-9.4-20240509.0.x86_64 machine
- Make the invalid changes to the grub file, prepare a repo for installation of oder kernel to be able to reproduce the removal and install the kernel
# mkdir bkp # cp /etc/default/grub bkp/ # sed -i 's/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX/' /etc/default/grub # grub2-mkconfig -o bkp/ /etc/default/grub: line 2: GRUB_CMDLINE_LINUX: command not found # cat /etc/default/grub GRUB_DEFAULT=saved GRUB_CMDLINE_LINUX GRUB_GFXMODE=auto GRUB_TERMINAL_INPUT="console" GRUB_TERMINAL_OUTPUT="gfxterm" GRUB_TIMEOUT=1 # grub2-mkconfig -o bkp/grub.cfg /etc/default/grub: line 2: GRUB_CMDLINE_LINUX: command not found # sed -i -e 's/^mirrorlist/#mirrorlist/' -e 's/\$contentdir\/\$releasever/vault\/9\.3/' -e 's/^#baseurl/baseurl/' /etc/yum.repos.d/rocky.repo # yum install -y --disablerepo * --enablerepo baseos https://download.rockylinux.org/vault/rocky/9.3/BaseOS/x86_64/os/Packages/k/kernel-5.14.0-362.24.1.el9_3.x86_64.rpm
- The kernel and kernel-core packages get installed, but posttrans scriptlet failure can be observed
Running scriptlet: kernel-core-5.14.0-362.24.1.el9_3.x86_64 4/4 /etc/default/grub: line 2: GRUB_CMDLINE_LINUX: command not found /etc/default/grub: line 2: GRUB_CMDLINE_LINUX: command not found warning: %posttrans(kernel-core-5.14.0-362.24.1.el9_3.x86_64) scriptlet failed, exit status 127 Error in POSTTRANS scriptlet in rpm package kernel-core
- Try to uninstall the kernel the same way as convert2rhel attemps to in the Prepare kernel step
# rpm -e --nodeps kernel-5.14.0-362.24.1.el9_3.x86_64 kernel-core-5.14.0-362.24.1.el9_3.x86_64 /etc/default/grub: line 2: GRUB_CMDLINE_LINUX: command not found /etc/default/grub: line 2: GRUB_CMDLINE_LINUX: command not found error: %preun(kernel-core-5.14.0-362.24.1.el9_3.x86_64) scriptlet failed, exit status 127 error: kernel-core-5.14.0-362.24.1.el9_3.x86_64: erase failed
- Only the kernel package gets removed with kernel-core failed erase and preuninstall scriptlet errors
convert2rhel reproducer
- follow steps 1 & 2 from the minimal reproducer and attempt a full conversion
convert2rhel -y --debug -u username -p password --serverurl url
This could be possibly prevented by early check of the grub file validity similarly as done in the minimal reproducer and cehck for the returncode.
We could raise an error during the analysis and ask the user to fix the grub file.
### INVALID FILE >>> import subprocess >>> subprocess.run(["grub2-mkconfig"], stdout=subprocess.DEVNULL) /etc/default/grub: line 2: GRUB_CMDLINE_LINUX: command not found CompletedProcess(args=['grub2-mkconfig'], returncode=127) ### VALID FILE >>> subprocess.run(["grub2-mkconfig"], stdout=subprocess.DEVNULL) Generating grub configuration file ... Adding boot menu entry for UEFI Firmware Settings ... done CompletedProcess(args=['grub2-mkconfig'], returncode=0)