Patch 1 is just a cleanup for removing duplicate statements. Patch 2 is the actual resolution to fix target identification for systems without initrd. It resolves https://bugzilla.redhat.com/show_bug.cgi?id=1373958.
Pratyush Anand (2): kdumpctl: remove duplicate statement kdumpctl: fix target identification for systems without initrd
kdump-lib.sh | 6 +++++- kdumpctl | 10 +++------- 2 files changed, 8 insertions(+), 8 deletions(-)
Since we also check for mount point of $_target after if/else loop, so there is no need to do the same thing specifically in else loop as well.
Remove those duplicate statement from else loop.
Signed-off-by: Pratyush Anand panand@redhat.com --- kdumpctl | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 8d0ab81b983b..04bbe8d66f9a 100755 --- a/kdumpctl +++ b/kdumpctl @@ -402,10 +402,6 @@ check_dump_fs_modified() _new_dev=$_target else _new_dev=$(kdump_get_persistent_dev $_target $_new_fstype) - if ! findmnt $_target >/dev/null; then - echo "Dump target $_target is probably not mounted." - return 2 - fi fi
if ! findmnt $_target >/dev/null; then
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@linux.vnet.ibm.com Signed-off-by: Pratyush Anand panand@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