Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1373958 - kexec-tools/kdumpctl: Does not work without initrd on Fedora 24
Summary: kexec-tools/kdumpctl: Does not work without initrd on Fedora 24
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: kexec-tools
Version: 24
Hardware: s390x
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Pratyush Anand
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ZedoraTracker
TreeView+ depends on / blocked
 
Reported: 2016-09-07 14:23 UTC by IBM Bug Proxy
Modified: 2016-11-30 15:31 UTC (History)
9 users (show)

Fixed In Version: kexec-tools-2.0.13-5.fc25
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-27 00:39:24 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
kdumpctl-f24-fix-dev-root.patch (1.91 KB, patch)
2016-09-07 14:23 UTC, IBM Bug Proxy
no flags Details | Diff
kdumpctl-kdump-lib-fix-dev-root.patch (2.32 KB, patch)
2016-09-08 18:51 UTC, IBM Bug Proxy
no flags Details | Diff
Patch to fix target identification for systems without initrd (1.94 KB, patch)
2016-09-09 16:46 UTC, Pratyush Anand
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
IBM Linux Technology Center 145940 0 None None None 2019-05-10 11:40:32 UTC

Description IBM Bug Proxy 2016-09-07 14:23:06 UTC

Comment 1 IBM Bug Proxy 2016-09-07 14:23:10 UTC
For our kernel development on s390x we use Linux systems with kernels that have everything built-in and we don't use initrds.

The script /bin/kdumpctl has changed from Fedora23 to Fedora24 and does now the following:

1) /bin/kdumpctl:check_dump_fs_modified(): "df -T /var/crash" is called.
2) This command reads "/proc/self/mountinfo" which returns "/dev/root" if no initrd has been used. I have no idea why.
3) /lib/kdump/kdump-lib.sh:kdump_get_persistent_dev() "/dev/root" is called.
4) This function returns "device node not found" because "/dev/root" does not exist.

This results in the following error:

Sep 02 14:00:20 s35lp54 systemd[1]: Starting Crash recovery kernel arming...
Sep 02 14:00:23 s35lp54 kdumpctl[20275]: Kernel dev name of /dev/root is not found.
Sep 02 14:00:23 s35lp54 kdumpctl[20275]: Dump target /dev/root is probably not mounted.
Sep 02 14:00:23 s35lp54 kdumpctl[20275]: Starting kdump: [FAILED]

Interestingly when I boot with intird "df -T /var/crash" returns "/dev/dasda1" and *not* "/dev/root".

# cat /proc/self/mountinfo | grep dasda
55 0 94:1 / / rw,relatime shared:1 - ext4 /dev/dasda1 rw,data=ordered

kdumpctl: Support also systems without initrd

The script /bin/kdumpctl has changed from Fedora 23 to 24 and does now the
following on systems without initrd where the kernel has everything built-in:

 1) /bin/kdumpctl:check_dump_fs_modified(): "df -T /var/crash" is called.
 2) This command reads "/proc/self/mountinfo" which returns "/dev/root"
    if no initrd has been used. I have no idea why.
 3) /lib/kdump/kdump-lib.sh:kdump_get_persistent_dev() "/dev/root" is called.
 4) This function returns "device node not found" because "/dev/root" does not
    exist.

This results in the following error:

 systemd[1]     : Starting Crash recovery kernel arming...
 kdumpctl[20275]: Kernel dev name of /dev/root is not found.
 kdumpctl[20275]: Dump target /dev/root is probably not mounted.
 kdumpctl[20275]: Starting kdump: [FAILED]

When we boot with intird, "df -T /var/crash" returns "/dev/dasda1" and *not*
"/dev/root":

 # cat /proc/self/mountinfo | grep dasda
 55 0 94:1 / / rw,relatime shared:1 - ext4 /dev/dasda1 rw,data=ordered

In this case the kdumpctl script works fine.

So fix also the non-initrd case and get the real block device from the mount
command in case we get /dev/root and the symlink does not exist.

Signed-off-by: Michael Holzheu <holzheu.ibm.com>

Comment 2 IBM Bug Proxy 2016-09-07 14:23:16 UTC
Created attachment 1198751 [details]
kdumpctl-f24-fix-dev-root.patch

Comment 3 Dave Young 2016-09-08 03:11:22 UTC
Hi, Michael

df get /dev/root from /proc/self/mountinfo, kernel set /dev/root from user provided root= cmdline. In case with initrd, kernel mount "rootfs" to / instead but later dracut mount real root and switch to it thus /proc/mounts show right device name.

It is reasonable to fix it, mount|grep in your patch should be right, but we have a function in kdump-lib.sh get_root_fs_device() which can be used in this case.

It will be better to convert /dev/root to real device by get_root_fs_device, also there is another place call df, it is in kdump-lib.sh get_target_from_path() function, it should also be updated with a check of this.

I'm not sure if the "df" check_dump_fs_modified can be replaced by the lib function get_target_from_path, if it is doable we can change it and only check /dev/root one time.

Pratyush should know this better, needinfo him.

Thanks
Dave

Comment 4 IBM Bug Proxy 2016-09-08 09:20:28 UTC
------- Comment From michael.holzheu.com 2016-09-08 05:14 EDT-------
(In reply to comment #6)
> Hi, Michael
>

[snip]

> It will be better to convert /dev/root to real device by get_root_fs_device,
> also there is another place call df, it is in kdump-lib.sh
> get_target_from_path() function, it should also be updated with a check of
> this.
>
> I'm not sure if the "df" check_dump_fs_modified can be replaced by the lib
> function get_target_from_path, if it is doable we can change it and only
> check /dev/root one time.
>
> Pratyush should know this better, needinfo him.

Could you post a patch that meets your expectations?  I will gladly test it in my environment.

Comment 5 Pratyush Anand 2016-09-08 17:44:28 UTC
(In reply to Dave Young from comment #3)
> I'm not sure if the "df" check_dump_fs_modified can be replaced by the lib
> function get_target_from_path, if it is doable we can change it and only
> check /dev/root one time.

I think, we can replace that. I have not tested, but following should be able to achieve it. 

diff --git a/kdump-lib.sh b/kdump-lib.sh
index e59449673b94..849712e3c009 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 8d0ab81b983b..d0785f6100ca 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

Comment 6 IBM Bug Proxy 2016-09-08 18:50:57 UTC
------- Comment From michael.holzheu.com 2016-09-08 14:42 EDT-------
(In reply to comment #8)
> (In reply to Dave Young from comment #3)

[snip]

> 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=)

This looks wrong :=)

I assume you meant:

_target=$(df $1 2>/dev/null | tail -1 |  awk '{print $1}')
if [[ "$_target" == "/dev/root" ]] && [[ ! -e /dev/root ]]; then
_target=$(mount | grep " / " | awk '{print $1}')
fi

Comment 7 IBM Bug Proxy 2016-09-08 18:51:01 UTC
Created attachment 1199186 [details]
kdumpctl-kdump-lib-fix-dev-root.patch


------- Comment on attachment From michael.holzheu.com 2016-09-08 14:47 EDT-------


This patch worked for me as well.

Comment 8 IBM Bug Proxy 2016-09-09 15:30:49 UTC
------- Comment From michael.holzheu.com 2016-09-09 11:28 EDT-------
(In reply to comment #10)
> Created attachment 112065 [details]
> kdumpctl-kdump-lib-fix-dev-root.patch
>
> This patch worked for me as well.

Is the attached patch also good for you?

Comment 9 Pratyush Anand 2016-09-09 16:46:38 UTC
Created attachment 1199531 [details]
Patch to fix target identification for systems without initrd

(In reply to IBM Bug Proxy from comment #6)
> ------- Comment From michael.holzheu.com 2016-09-08 14:42 EDT-------

> > +    [[ "$_target" == "/dev/root" ]] && [[ ! -e /dev/root ]] && _target=)
> 
> This looks wrong :=)

oops..just remove the extra () from get_root_fs_device() and it should work.

[[ "$_target" == "/dev/root" ]] && [[ ! -e /dev/root ]] && _target=$(get_root_fs_device)

Please try attached patch and let me know if that works with your system.

Comment 10 IBM Bug Proxy 2016-09-09 18:20:43 UTC
------- Comment From michael.holzheu.com 2016-09-09 14:10 EDT-------
(In reply to comment #12)

[snip]

> > This looks wrong :=)
>
> oops..just remove the extra () from get_root_fs_device() and it should work.
>
> [[ "$_target" == "/dev/root" ]] && [[ ! -e /dev/root ]] &&
> _target=

Ok got it.

>
> Please try attached patch and let me know if that works with your system.

The (for my Fedora24 version of kdumpctl refreshed) patch worked fine.

Reported-and-tested-by: Michael Holzheu <holzheu.ibm.com>

Two more questions:

- In which version will we see the fixes?
- Do you have an upstream repository for the files?

Comment 11 Dave Young 2016-09-12 09:01:48 UTC
Hi, Michael

It is in F25 devel phase so I would like to merge it in rawhide and f25. If you explictly need it in F24 please let me know.

It need about one week to wait for comments from other people, so hopefully we can merge it at the end of this week or in next week.

Thanks
Dave

Comment 12 IBM Bug Proxy 2016-09-13 15:12:03 UTC
------- Comment From michael.holzheu.com 2016-09-13 11:07 EDT-------
(In reply to comment #14)
> Hi, Michael
>
> It is in F25 devel phase so I would like to merge it in rawhide and f25. If
> you explictly need it in F24 please let me know.

IMHO it's fine for F25.

Thanks!
Michael

Comment 13 Fedora Update System 2016-09-16 08:17:47 UTC
kexec-tools-2.0.13-5.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-16e88f591d

Comment 14 IBM Bug Proxy 2016-09-16 09:20:38 UTC
------- Comment From michael.holzheu.com 2016-09-16 05:12 EDT-------
(In reply to comment #16)
> kexec-tools-2.0.13-5.fc25 has been submitted as an update to Fedora 25.
> https://bodhi.fedoraproject.org/updates/FEDORA-2016-16e88f591d

Thanks!

Comment 15 Fedora Update System 2016-09-17 20:56:20 UTC
kexec-tools-2.0.13-5.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-16e88f591d

Comment 16 Fedora Update System 2016-09-27 00:39:24 UTC
kexec-tools-2.0.13-5.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 17 IBM Bug Proxy 2016-11-30 15:31:01 UTC
> _target=$(get_root_fs_device)


Note You need to log in before you can comment on or make changes to this bug.