commit: 4860fce5434f46d90e913ff10515a9a256fc6c6a
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 4 22:25:12 2020 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Aug 4 23:02:40 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4860fce5
sys-apps/kexec-tools: runscript: do not append root= if --reuse-cmdline is used
Always appending root= can cause problems when auto-detection is used
when real system and initramfs don't agree on naming (i.e. when
current system detects root as /dev/dm-4 but on next boot, initramfs
will detect root as /dev/dm-5).
Package-Manager: Portage-3.0.1, Repoman-2.3.23
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
sys-apps/kexec-tools/files/kexec-r2.init | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/sys-apps/kexec-tools/files/kexec-r2.init
b/sys-apps/kexec-tools/files/kexec-r2.init
index 2a3b63ad526..0578f51aea1 100644
--- a/sys-apps/kexec-tools/files/kexec-r2.init
+++ b/sys-apps/kexec-tools/files/kexec-r2.init
@@ -119,12 +119,22 @@ load_image() {
fi
fi
+ local is_rootpart_autodetected=no
if [ -z "${ROOTPART}" ]; then
ROOTPART="$(readlink -f "$(sed -n '/^\/[^ ]* \/ / s,^\([^
]*\).*,\1,p' /proc/mounts)")"
+ is_rootpart_autodetected=yes
fi
+ local is_reusing_cmdline=no
if [ -z "${KPARAM}" ]; then
kparamopt="--reuse-cmdline"
+ is_reusing_cmdline=yes
+ fi
+
+ if ! yesno "${is_rootpart_autodetected}" || ! yesno
"${is_reusing_cmdline}"; then
+ # Only append root when explicit set in config or
+ # if we aren't re-using kernel cmdline
+ KPARAM="${KPARAM:+"${KPARAM} "}root=${ROOTPART}"
fi
if [ -n "${initrd}" ]; then
@@ -137,7 +147,7 @@ load_image() {
ebegin "Using kernel image ${img}${msg} for kexec"
kexec ${KEXEC_OPT_ARGS} ${kparamopt} \
- -l "${img}" --append="root=${ROOTPART} ${KPARAM}" ${initrdopt}
+ -l "${img}" ${KPARAM:+--append="${KPARAM}"} ${initrdopt}
local ret=$?
${mounted} && umount "${BOOTPART}"