Hi, Baoquan
Seems I did not found the patch in my mutt client, but I see it in webmail, thus reply here.
The sed does not work with my below test, anything wrong?
bash-4.2$ cat kdump.conf /var/crash/ssh-key bash-4.2$ sed -i -e "s#^path[[:space:]]+$_save_path##" ./kdump.conf bash-4.2$ cat kdump.conf /var/crash/ssh-key
----- Original Message ----- From: "Baoquan He" bhe@redhat.com To: kexec@lists.fedoraproject.org Cc: chaowang@redhat.com Sent: Friday, December 26, 2014 4:02:26 PM Subject: [PATCH] adding the parsed path to etc/kdump.conf of kdump initrd
Steve found a bug. When mount a disk in /var and not specify path in /etc/kdump.conf, the vmcore will be dumped into /var/crash of that disk, but not /crash on that disk.
This is because when write the parsed path into /tmp/$$-kdump.conf in default_dump_target_install_conf() of mkdumprd, it uses below sed command. So if no path specified at all, this sed command won't add it to /tmp/$$-kdump.conf. Then in 2nd kernel it will take default path, namely "/var/crash" as path if no path in /etc/kdump.conf in 2nd kernel.
sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
In this new version, according to Dave Young's suggestion, erase the old path line and then insert the parsed path. This can fix it.
sed -i -e "s#^path[[:space:]]+$_save_path##" /tmp/$$-kdump.conf echo "path $_path" >> /tmp/$$-kdump.conf
Signed-off-by: Baoquan He bhe@redhat.com --- dracut-module-setup.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 793495a..8200317 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -331,7 +331,10 @@ default_dump_target_install_conf() echo "$_fstype $_target" >> /tmp/$$-kdump.conf
_path=${_save_path##"$_mntpoint"} - sed -i -e "s#^path[[:space:]]+$_save_path#path $_path#" /tmp/$$-kdump.conf + + #erase the old path line, then insert the parsed path + sed -i -e "s#^path[[:space:]]+$_save_path##" /tmp/$$-kdump.conf + echo "path $_path" >> /tmp/$$-kdump.conf fi
}