- add a default entry in zipl.conf if there isn't one present (#1698363)

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
This commit is contained in:
Javier Martinez Canillas 2020-07-03 17:26:20 +02:00 committed by Dan Horák
parent b8f75bde3c
commit 6f6a4deece
2 changed files with 14 additions and 5 deletions

View File

@ -132,8 +132,12 @@ case "$COMMAND" in
fi fi
fi fi
if [ -n "$NEWDEFAULT" ]; then if [ -n "$NEWDEFAULT" ] && [ -f "${ZIPLCFG}" ]; then
if grep -q "^default=" "${ZIPLCFG}"; then
sed -i -e "s,^default=.*,default=${NEWDEFAULT}," "${ZIPLCFG}" sed -i -e "s,^default=.*,default=${NEWDEFAULT}," "${ZIPLCFG}"
else
echo "default=${NEWDEFAULT}" >> "${ZIPLCFG}"
fi
fi fi
exit 0 exit 0
@ -151,8 +155,10 @@ case "$COMMAND" in
BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf"
BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")"
if [ -f "${BLS_TARGET}" ] && [ -f "${ZIPLCFG}" ]; then
TITLE="$(grep '^title[ \t]' "${BLS_TARGET}" | sed -e 's/^title[ \t]*//')" TITLE="$(grep '^title[ \t]' "${BLS_TARGET}" | sed -e 's/^title[ \t]*//')"
sed -i -e "/^default=${TITLE}/d" "${ZIPLCFG}" sed -i -e "/^default=${TITLE}/d" "${ZIPLCFG}"
fi
if [[ -f "${BLS_DEBUG}" ]]; then if [[ -f "${BLS_DEBUG}" ]]; then
TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')" TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')"

View File

@ -6,7 +6,7 @@
Name: s390utils Name: s390utils
Summary: Utilities and daemons for IBM z Systems Summary: Utilities and daemons for IBM z Systems
Version: 2.13.0 Version: 2.13.0
Release: 3%{?dist} Release: 4%{?dist}
Epoch: 2 Epoch: 2
License: MIT License: MIT
ExclusiveArch: s390 s390x ExclusiveArch: s390 s390x
@ -794,6 +794,9 @@ User-space development files for the s390/s390x architecture.
%changelog %changelog
* Fri Jul 03 2020 Javier Martinez Canillas <javierm@redhat.com> - 2:2.13.0-4
- add a default entry in zipl.conf if there isn't one present (#1698363)
* Tue Jun 09 2020 Jakub Čajka <jcajka@redhat.com> - 2:2.13.0-3 * Tue Jun 09 2020 Jakub Čajka <jcajka@redhat.com> - 2:2.13.0-3
- split off core package with basic functionalities and reduced deps from base sub-package - split off core package with basic functionalities and reduced deps from base sub-package