File kdump-nsswitch.conf-filtering.patch of Package kdump.8867
From b90cdf181259403f83b5ba72ee38b9f043e4cdec Mon Sep 17 00:00:00 2001
From: Lance Wang <lzwang@suse.com>
Date: Mon, 4 Dec 2017 16:14:06 +0800
Subject: [PATCH] Copy /etc/hosts and /etc/nsswitch.conf in
setup-kdump.functions
Only filter field hosts from /etc/nsswitch.conf to avoid ssh login failure.
It is better to copy files in kdump dracut module than via the cmdline
to dracut.
---
init/mkdumprd | 3 ---
init/setup-kdump.functions | 2 ++
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/init/mkdumprd b/init/mkdumprd
index 061894c..73d88e9 100755
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -142,9 +142,6 @@ function run_dracut()
# Make resolved variables visible to the dracut module
kdump_export_targets
- # Include additional files in the kdump initial ram disk
- DRACUT_ARGS="$DRACUT_ARGS --install '/etc/hosts /etc/nsswitch.conf'"
-
DRACUT_ARGS="$DRACUT_ARGS --add 'kdump' $INITRD $KERNELVERSION"
echo "Regenerating kdump initrd ..." >&2
eval "bash -$- $DRACUT $DRACUT_ARGS"
diff --git a/init/setup-kdump.functions b/init/setup-kdump.functions
index 0bb84a3..445908c 100644
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -866,6 +866,8 @@ function kdump_modify_config() # {{{
KDUMP_SAVEDIR="${KDUMP_SAVEDIR}file://${kdump_Realpath[i]}"
elif [ "$protocol" != "srcfile" ] ; then
KDUMP_SAVEDIR="${KDUMP_SAVEDIR}${kdump_URL[i]}"
+ cp /etc/hosts "${dest}/etc"
+ grep '^hosts:' /etc/nsswitch.conf > "${dest}/etc/nsswitch.conf"
fi
#
--
2.13.6