We get following error on the systems that have everything built-in and no
initrd is used.
Kernel dev name of /dev/root is not found.
Dump target /dev/root is probably not mounted.
It happens because `df $path` gets /dev/root from /proc/self/mountinfo.
Fix this by identifying real target device when `df $path` returns
Filesystem as /dev/root.
Reported-and-tested-by: Michael Holzheu <holzheu(a)linux.vnet.ibm.com>
Signed-off-by: Pratyush Anand <panand(a)redhat.com>
---
kdump-lib.sh | 6 +++++-
kdumpctl | 6 +++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index e59449673b94..406bbc714b3e 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -176,7 +176,11 @@ get_mntpoint_from_path()
get_target_from_path()
{
- echo $(df $1 | tail -1 | awk '{print $1}')
+ local _target
+
+ _target=$(df $1 2>/dev/null | tail -1 | awk '{print $1}')
+ [[ "$_target" == "/dev/root" ]] && [[ ! -e /dev/root ]]
&& _target=$(get_root_fs_device)
+ echo $_target
}
get_fs_type_from_target()
diff --git a/kdumpctl b/kdumpctl
index 04bbe8d66f9a..ccb1e1e4d4a6 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -389,9 +389,9 @@ check_dump_fs_modified()
_new_fstype=$(blkid $_target | awk -F"TYPE=" '{print $2}' | cut -d
'"' -f 2)
else
_path=$(get_save_path)
- set -- $(df -T $_path 2>/dev/null | tail -1 | awk '{ print $1, $2}')
- _target=$(to_dev_name $1)
- _new_fstype=$2
+ _target=$(get_target_from_path $_path)
+ _target=$(to_dev_name $_target)
+ _new_fstype=$(get_fs_type_from_target $_target)
if [[ -z "$_target" || -z "$_new_fstype" ]];then
echo "Dump path $_path does not exist"
return 2
--
2.7.4