From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A025B13835A for ; Tue, 4 Aug 2020 23:02:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AE3C3E0903; Tue, 4 Aug 2020 23:02:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7AFB3E0903 for ; Tue, 4 Aug 2020 23:02:53 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D617234F106 for ; Tue, 4 Aug 2020 23:02:51 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 47A90304 for ; Tue, 4 Aug 2020 23:02:50 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1596582160.4860fce5434f46d90e913ff10515a9a256fc6c6a.whissi@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/kexec-tools/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-apps/kexec-tools/files/kexec-r2.init X-VCS-Directories: sys-apps/kexec-tools/files/ X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 4860fce5434f46d90e913ff10515a9a256fc6c6a X-VCS-Branch: master Date: Tue, 4 Aug 2020 23:02:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9d182a80-5aef-4633-87e2-905ccf1bc09b X-Archives-Hash: c8380133f63470e6421c04260edb6ab0 commit: 4860fce5434f46d90e913ff10515a9a256fc6c6a Author: Thomas Deutschmann gentoo org> AuthorDate: Tue Aug 4 22:25:12 2020 +0000 Commit: Thomas Deutschmann gentoo 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 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}"