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