From 4860fce5434f46d90e913ff10515a9a256fc6c6a Mon Sep 17 00:00:00 2001 From: Thomas Deutschmann Date: Wed, 5 Aug 2020 00:25:12 +0200 Subject: 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 --- sys-apps/kexec-tools/files/kexec-r2.init | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sys-apps') diff --git a/sys-apps/kexec-tools/files/kexec-r2.init b/sys-apps/kexec-tools/files/kexec-r2.init index 2a3b63ad5263..0578f51aea19 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}" -- cgit v1.2.3-65-gdbad