From d7158a284c686d482c19a5a358b63cc7e31063ef Mon Sep 17 00:00:00 2001 From: WANG Chao Date: Wed, 29 Jan 2014 16:24:33 +0800 Subject: [PATCH] ssh dump: create random-seed manually In ssh dump, we use random-seed to feed /dev/urandom. Since the systemd random-seed file could change location, it's better we create our own random-seed. The discussion is listed below for future reference: https://lists.fedoraproject.org/pipermail/kexec/2014-January/000340.html Signed-off-by: WANG Chao Acked-by: Vivek Goyal --- dracut-module-setup.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 0babc65..501d7f6 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -447,12 +447,25 @@ kdump_check_fence_kdump () { dracut_install -o $FENCE_KDUMP_CONFIG } +# Install a random seed used to feed /dev/urandom +# By the time kdump service starts, /dev/uramdom is already fed by systemd +kdump_install_random_seed() { + local poolsize=`cat /proc/sys/kernel/random/poolsize` + + if [ ! -d ${initdir}/var/lib/ ]; then + mkdir -p ${initdir}/var/lib/ + fi + + dd if=/dev/urandom of=${initdir}/var/lib/random-seed \ + bs=$poolsize count=1 2> /dev/null +} + install() { kdump_install_conf >"$initdir/lib/dracut/no-emergency-shell" if is_ssh_dump_target; then - dracut_install /var/lib/random-seed || exit $? + kdump_install_random_seed fi dracut_install -o /etc/adjtime /etc/localtime inst "$moddir/monitor_dd_progress" "/kdumpscripts/monitor_dd_progress"