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 <chaowang@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
WANG Chao 2014-01-29 16:24:33 +08:00
parent 75c9162996
commit d7158a284c

View File

@ -447,12 +447,25 @@ kdump_check_fence_kdump () {
dracut_install -o $FENCE_KDUMP_CONFIG 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() { install() {
kdump_install_conf kdump_install_conf
>"$initdir/lib/dracut/no-emergency-shell" >"$initdir/lib/dracut/no-emergency-shell"
if is_ssh_dump_target; then if is_ssh_dump_target; then
dracut_install /var/lib/random-seed || exit $? kdump_install_random_seed
fi fi
dracut_install -o /etc/adjtime /etc/localtime dracut_install -o /etc/adjtime /etc/localtime
inst "$moddir/monitor_dd_progress" "/kdumpscripts/monitor_dd_progress" inst "$moddir/monitor_dd_progress" "/kdumpscripts/monitor_dd_progress"