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 patch add a judgement, if user specified path let's use sed command to replace it with parsed path. Otherwise execute a echo command to add the path:
echo "path $_path" >> /tmp/$$-kdump.conf
Signed-off-by: Baoquan He bhe@redhat.com --- dracut-module-setup.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 9299b5d..19792ea 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -342,7 +342,12 @@ default_dump_target_install_conf() echo "$_fstype $_target" >> /tmp/$$-kdump.conf
_path=${_save_path##"$_mntpoint"} - sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf + + if [ -n "$(grep ^path "/etc/kdump.conf"| cut -d' ' -f2)" ]; then + sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf + else + echo "path $_path" >> /tmp/$$-kdump.conf + fi fi
}
Cc Steve
On 12/12/14 at 03:34pm, Baoquan He wrote:
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 patch add a judgement, if user specified path let's use sed command to replace it with parsed path. Otherwise execute a echo command to add the path:
echo "path $_path" >> /tmp/$$-kdump.conf
Signed-off-by: Baoquan He bhe@redhat.com
dracut-module-setup.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 9299b5d..19792ea 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -342,7 +342,12 @@ default_dump_target_install_conf() echo "$_fstype $_target" >> /tmp/$$-kdump.conf
_path=${_save_path##"$_mntpoint"}
sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
if [ -n "$(grep ^path "/etc/kdump.conf"| cut -d' ' -f2)" ]; then
sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
else
echo "path $_path" >> /tmp/$$-kdump.conf
fifi
}
1.9.0
On 12/12/14 at 03:34pm, Baoquan He wrote:
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 patch add a judgement, if user specified path let's use sed command to replace it with parsed path. Otherwise execute a echo command to add the path:
echo "path $_path" >> /tmp/$$-kdump.conf
Hi, Baoquan
Two minor nits inline.
Signed-off-by: Baoquan He bhe@redhat.com
dracut-module-setup.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 9299b5d..19792ea 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -342,7 +342,12 @@ default_dump_target_install_conf() echo "$_fstype $_target" >> /tmp/$$-kdump.conf
_path=${_save_path##"$_mntpoint"}
sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
if [ -n "$(grep ^path "/etc/kdump.conf"| cut -d' ' -f2)" ]; then
I think you can use "get_option_value path" for both here and where you get $_save_path
sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
I think there's a potential bug here. Say user configure kdump.conf like the following:
kdump_post /var/crash/post.sh path /var/crash
Then sed may replace "/var/crash/post.sh" with something else, depanding on mount point.
I think it's worth to send another patch to fix all sed command with the exact matching syntax. For example:
sed -i -e "s#^path[[:space:]]+$_save_path#path $_path#"
Thanks WANG Chao
else
echo "path $_path" >> /tmp/$$-kdump.conf
fifi
}
1.9.0
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 12/15/14 at 03:10pm, WANG Chao wrote:
On 12/12/14 at 03:34pm, Baoquan He wrote:
echo "$_fstype $_target" >> /tmp/$$-kdump.conf
_path=${_save_path##"$_mntpoint"}
sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
if [ -n "$(grep ^path "/etc/kdump.conf"| cut -d' ' -f2)" ]; then
I think you can use "get_option_value path" for both here and where you get $_save_path
Good idea, will use it.
sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
I think there's a potential bug here. Say user configure kdump.conf like the following:
kdump_post /var/crash/post.sh path /var/crash
Then sed may replace "/var/crash/post.sh" with something else, depanding on mount point.
I think it's worth to send another patch to fix all sed command with the exact matching syntax. For example:
sed -i -e "s#^path[[:space:]]+$_save_path#path $_path#"
Good catch, will change it.
Thanks
Thanks WANG Chao
else
echo "path $_path" >> /tmp/$$-kdump.conf
fifi
}
1.9.0
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec