On 01/17/14 at 11:23am, Vivek Goyal wrote:
On Fri, Jan 17, 2014 at 04:34:29PM +0800, WANG Chao wrote:
[..]
> > There is a problem with kdump saving the seed. And that is kdump is
> > started at the beginning of boot and you are assuming that by then
> > systemd has restored the entropy pool from previously saved random seed.
>
> I looked into the systemd services dependencies[1], I found that kdump
> would always run after systemd-random-seed. That said, when kdump is
> starting, /dev/urandom is already feed. And actually systemd-random-seed
> service is started very early, same level with systemd-udevd,
> systemd-journald etc. and systemd-random-seed is only depending on the /
> mount.
>
> [1]: I got this data by running `systemctl list-dependencies kdump`
I was trying to avoid making assumptions on the system service start
order. It works this way today what if order changes tomorrow. This
assumption is kind of subtle that kdump depends on /dev/urandom being
fed by the time service starts.
Actually I'm quite confident that this kind of order will not change.
Given the fact that /dev/urandom will be used by all kinds of programs
during system start-up, I think /dev/uramdom have to be fed at very
early stage (way early than kdump service start time). This is
fundamental.
As for the random-seed file used for restore/save urandom across boots,
I think this is the one that we want to avoid cause it could probably
change its location in the future like this time.
So I prefer that you first look for random-seed file so that we don't
assume service order dependencies. But if you don't like this, it is
ok. I am not too particular about it and can live with saving
/dev/urandom.
I'm just trying to stand up for my point. If you have better idea that
makes sense to me, trust me, I'm willing to change to it.
So how about the following pacth?
-- >8 --
From f257d34a7156e24dbbe35706a55a449e7c56f2d0 Mon Sep 17 00:00:00 2001
From: WANG Chao <chaowang(a)redhat.com>
Date: Mon, 23 Dec 2013 13:40:19 +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 its place, 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(a)redhat.com>
---
dracut-module-setup.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index c013430..93e3490 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -392,13 +392,25 @@ kdump_check_iscsi_targets () {
}
}
+# Install a random seed used to feed /dev/urandom
+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"
--
1.8.4.2