This reverts commit 77693cd7eb.
Although it fixes the situation when a new kernel is being installed in
a %post script, it breaks the initial kernel installation, because the
BLS snippet doesn't exists yet.
Don't fall back to reading /proc/cmdline: that will likely reflect the
installer environment which will result in a non-booting kernel entry.
See-also: rhbz#1940288
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
When a kernel-debug package is installed, it should only be set as default
if DEFAULTDEBUG=yes is set in /etc/sysconfig/kernel. But currently there's
no default field set in /etc/zipl.conf so the implicit order used to sort
boot entries is used.
The debug kernels contains a +debug suffix which makes them be sorted with
more precedence than non-debug kernels by the RPM sorting algorithm:
rpm --eval '%{lua: print(rpm.vercmp("4.18.0-193.el8.s390x+debug", "4.18.0-193.el8.s390x"))}'
1
So using the implicit order when a debug kernel is installed and a default
is not set leads to a wrong behavior.
The zipl kernel-install script attempts to set a default entry if has to,
but only if one is present in the zipl.conf file. Take also into account
the case when there isn't one to avoid using the implicit sorting and not
cover these corner cases like the one with the debug kernel.
Resolves: rhbz#1698363
The bootloaders add a BOOT_IMAGE parameter that is present in the kernel
command line exposed via the /proc/cmdline virtual file. If this param
is added to the kernel cmdline in the BLS snippet, it will be duplicated.
Resolves: #1782321
In the commit 63205a4dc4c400f75571869d87682c0cdb475830, there was
introduced a change in the decision logic of the 20-zipl-kernel.install
script. Specifically, whether the Boot Loader Specification (BLS) is
used. Instead of just checking the existence of the /sbin/new-kernel-pkg
file, the existence of the /boot/loader/entries directory is also
checked.
More thorough testing revealed that the above commit covers only the
case when a new kernel is added. However, the remaining cases should
also be covered. That means the case when a rescue kernel is added and
the case when some kernel is removed.
Resolves: #1778243Fixes: #1755899
Signed-off-by: Jan Hlavac <jhlavac@redhat.com>
The /usr/lib/kernel/install.d/20-zipl-kernel.install script checks if the
/sbin/new-kernel-pkg script exists to determine whether a BLS config has
to be used or not.
This file should not exist in RHEL8 but it does in some corner cases for
example when doing an in-place upgrade from RHEL7 to RHEL8 since it is
required by the LEAPP tool for the RPM transaction to succeeded.
To cover that, not only check if the /sbin/new-kernel-pkg is not present
but also if the /boot/loader/entries directory exists and use either of
these as a condition to use a BLS configuration.
The kernel-install script created unconditionally a $BOOT_DIR_ABS directory
that was used by the sd-boot bootloader. The kernel-install plugins checked
the existence of that directory to decide whether the BLS snippets would be
created in the path expected by sd-boot or the one expected by zipl.
But the $BOOT_DIR_ABS contains the machine ID that's set in the environment
variable $KERNEL_INSTALL_MACHINE_ID. If there's no machine ID set, then the
$BOOT_DIR_ABS is set to a temporary directory that's removed after all the
kernel-install plugins exit.
The $KERNEL_INSTALL_MACHINE_ID isn't set for example when kernel-install is
executed in a container since there won't be an /etc/machine-id file. This
causes 20-zipl-kernel.install script to wrongly remove the /tmp directory.
So if $KERNEL_INSTALL_MACHINE_ID isn't set, just exit the script since the
BLS snippets can't be installed anyways since their filename also contain
the machine ID.
Also, don't attempt to remove $BOOT_DIR_ABS because kernel-install doesn't
create this directory anymore and instead is created only when sd-boot is
installed.
The 91-zipl.install kernel-install script attempts to execute zipl when a
kernel is installed, but this will fail if there isn't a zipl confg file.
Also, the kernel-install scripts are using ',' as the sed delimiter when
updating the kernel command line options in the BLS fragment file. But it
is valid to have that character in a cmdline so instead use '#' for that.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Add patches to support population IPL sections using BootLoaderSpec files
instead of having them defined in the zipl.conf file. This allows to have
a static zipl.conf file, and update the boot entries by just dropping BLS
fragments files in a directory.
In this configuration the grubby tool isn't used, and instead all needed
tasks (copy kernel, generate an initramfs, copy BLS configs, etc) should
be made by kernel-install scripts.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>