Bug 511003 - mkdumprd copy vmcore without --sparse=always
Summary: mkdumprd copy vmcore without --sparse=always
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kexec-tools
Version: 5.2
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Neil Horman
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-07-13 08:25 UTC by masanari iida
Modified: 2010-03-30 07:47 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Kdump can be started with an initscript or with the mkdumprd command. Previously, the vmcore file created by the former method had the "--sparse=always" option applied to it when copied, resulting in a smaller file than when a dump was initiated by the mkdumprd command. The same option has now been added as a default value in the kdump.conf configuration file, therefore ensuring that the default behavior is consistent, regardless of how the dump was initiated.
Clone Of:
: 600578 (view as bug list)
Environment:
Last Closed: 2010-03-30 07:47:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0179 0 normal SHIPPED_LIVE kexec-tools bug fix update 2010-03-29 12:18:38 UTC

Description masanari iida 2009-07-13 08:25:48 UTC
Description of problem:
/etc/init.d/kdump, in save_core(),
the vmcore file copy is done with following command.
> cp --sparse=always /proc/vmcore $coredir/vmcore-incomplete

/sbin/mkdumprd command create initrd-kdump.img, if I specify /etc/kdump.conf.
In init script within the initrd-kdump.img,  the file copy 
is done without --sparse=always

> if [ -z "$CORE_COLLECTOR" ]; then
>   CORE_COLLECTOR="cp"                <==
> fi
>
>(snip)
>
>$CORE_COLLECTOR /proc/vmcore \$VMCORE-incomplete > /dev/null


Formar case, vmcore file is smaller than RAM size.
Latter case, vmcore file is same as the RAM size.

Both cases, I can open the vmcore using crash without problem.
So technically speaking, this is not an issue.
But I would like to know why only save_core() has that option.

Version-Release number of selected component (if applicable):
kexec-tools-1.102pre-56.el5_3.2

How reproducible:
Always

Steps to Reproduce:
Compare  /etc/init.d/kdump  and  init script within initrd-kdump.img.

Actual result:
vmcore file is smaller if I don't set /etc/kdump.conf.

Expected result:
Both "use /etc/kdump.conf" and "not use /etc/kdump.conf",
the vmcore file size should be the same,
or need some explanation why.

Additional Info,
I remember thatn IA64 vmcore file is a sparse file on RHEL4.
So I wonder if initrd-kdump.img can handle the core file
correctly without the option.

Comment 1 Qian Cai 2009-07-13 09:41:38 UTC
I think you are running into the same issue here,

[5.3][RFE] Copying of Vmcore Not Sparse Awareness
https://bugzilla.redhat.com/show_bug.cgi?id=465261

The developer recommended to use makedumpfile -d 1 instead there.

Comment 2 Neil Horman 2009-07-14 13:41:51 UTC
yeah, theres no reason we can't modify the initramfs to pass that as a option by default, I honestly just havent.  Not sure its really needed though.  As Cai mentioned, makedmpfile is recommended as the utility to use when trying to shrink core file size.  Alternatively putting this in your kdump config:
core_collector cp --sparse=always
should accomplish the same thing.

I'm a bit hesitant to change it, simply because it has a way to be implemented without any internal changes, but if theres really an argument for it, I'll do it.  Just let me know.

Comment 3 masanari iida 2009-07-15 05:52:53 UTC
Back to kexec-tools-1.101-194.4.el5 that I found one of my local system,
the /etc/init.d/kdump save_core part doesn't have --sparse=always.

/etc/init.d/kdump in kexec-tools-1.102pre-21.el5_3.2, save_core part does
have --sparse=always.

So, between these 2 versions, I suspect someone modified the script with 
some technical reason. 
Then I wonder if there was a reason to modify /etc/init.d/kdump,
why not modify the mkdumprd??
This is a starting point of this BZ case.

I understand adding an option "core_collector" may change the 
attitude to the same. But if I would like to modify it, I would ask 
you to modify /etc/init.d/kdump script side.
Because current imprementation, _always_ the option "--sparse=always"
is used even if I don't want to use it.

An ehnancement idea is,

Add KDUMP_CP_OPTIONS="--sparse=always"  into /etc/sysconfig/kdump

And modify /etc/init.d/kdump

- cp --sparse=always /proc/vmcore $coredir/vmcore-incomplete
+ cp $KDUMP_CP_OPTIONS /proc/vmcore $coredir/vmcore-incomplete

Comment 4 Neil Horman 2009-07-15 14:40:56 UTC
I normally don't add config options to the initscript version of kdump (simply because I really don't want to encourage people to use the initscript for dump collection.  In fact in the mkdumprd re-write, I'm not default configuring a rootfs mount).  I honestly think some documentation here is whats most in order.  Perhaps the easiest thing to do is change the default kdump.conf so that core_collector defaults to cp --sparse=always.  I think that might be best.  It puts the initscript and initramfs in line.

Comment 5 masanari iida 2009-07-24 05:28:54 UTC
> Perhaps the easiest thing to do is change the default kdump.conf so
> that core_collector defaults to cp --sparse=always.  I think that might be
> best.  It puts the initscript and initramfs in line.  

Agree.

BTW, I have one example case that I don't like rootfs mount type 
kexec-kdump. 

How to reproduce
(1)  set crashkernel=128M@16M
(2)  set min_free_kbytes to 256MB in /etc/sysctl.conf
(3)  set kdump to use /etc/init.d/kdump instead of initrd-kdump.img.
(4)  Crash the system.

Expected result
kexec-kdump save memory image to a file.

Actual result
System freeze when startup script in HD execute sysctl 
and reserve 256MB of low memory within 128MB of 2nd kernel memory!

Comment: 
If this admin uses initrd-kdump.img as a kexec-kdump, 
this system should have succesfully saved the vmcore.
In ohter word, anyone can modify the OS startup script,
but only mkdumprd can control the contents of initrd-kdump.img.
So that's why I personally like to use initrd-kdump.img.

Comment 6 Neil Horman 2009-10-13 17:05:05 UTC
I agree, nominally we should not use the rootfs to collect core dumps, its just not safe.  I've updated the config file to show a cp option in -82.el5.

Comment 10 Ruediger Landmann 2010-03-19 05:16:57 UTC
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.

New Contents:
Kdump can be started with an initscript or with the mkdumprd command. 
Previously, the vmcore file created by the former method had the
"--sparse=always" option applied to it when copied, resulting in a smaller
file than when a dump was initiated by the mkdumprd command. The same option
has now been added as a default value in the kdump.conf configuration file, 
therefore ensuring that the default behavior is consistent, regardless of how
the dump was initiated.

Comment 11 errata-xmlrpc 2010-03-30 07:47:47 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0179.html


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