HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Using ulimit to get corefiles (points!)

 
SOLVED
Go to solution
Christian Deutsch_1
Esteemed Contributor

Using ulimit to get corefiles (points!)

Hi folks,

In the past I have used ulimit to get crashing processes to write corefiles:

ulimit -H unlimited
ulimit -Hc unlimited
ulimit -S unlimited
ulimit -Sc unlimited

But this is only (?) for processes started from the same shell after the ulimit commands have been started.

Is there a good way to be sure that I always get corefiles, from any process, also after reboot? Solaris and HP-UX 11.31 have coreadm but it seems this is not available for Linux? I am using RHEL5u1 on x86.

The first seven truly helpful answers will be generously rewarded with points!

Thanks, Christian
Yeshua loves you!
11 REPLIES
Matti_Kurkela
Honored Contributor
Solution

Re: Using ulimit to get corefiles (points!)

These RedHat Knowledge Base articles should be appropriate to you:

How to enable core dumps on *everything* on RHEL 5.*:
http://kbase.redhat.com/faq/docs/DOC-5353

How to enable core dumps on Apache webserver (taking care that the dumps are stored in a safe location):
http://kbase.redhat.com/faq/docs/DOC-1468

For more info on kernel.core_pattern sysctl setting, please see:
http://www.kernel.org/doc/Documentation/sysctl/kernel.txt

MK
MK
Steven E. Protter
Exalted Contributor

Re: Using ulimit to get corefiles (points!)

Shalom,

By default you get core files.

ulimit -Sc 0 to prevent core files.

Then override it in the applications start up script or user profile.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Matti_Kurkela
Honored Contributor

Re: Using ulimit to get corefiles (points!)

SEP,
in RHEL (and most modern Linux distributions) the "factory default" is no corefiles. It may be that the kernel default is as you said, but the startup scripts will override the kernel defaults pretty thoroughly.

This is another case of "beginner-friendliness".
As the default is no core files, those that don't know what core files are and what to do with them won't have to wonder why a crashing Java server application suddenly ate a gigabyte of disk space. (I've seen that on HP-UX, and educated the application guys shortly afterwards :-)

Those that know what to do with core files, certainly should also know how to enable them when necessary (as Christian obviously does). And if the basic policy needs to be changed, the Red Hat Knowledge Base link in my first reply covers that.

MK
MK
Christian Deutsch_1
Esteemed Contributor

Re: Using ulimit to get corefiles (points!)

Thanks Matti, that's extremely helpful :)

Thanks Steve for your input. I did not check if it was the default but I did not find any corefiles so far and I was wondering if that was maybe suspicious (testing some software).

After making the recommended changes I did a simple test and got my corefile, thank you so much!

Kind regards, Christian
Yeshua loves you!
dirk dierickx
Honored Contributor

Re: Using ulimit to get corefiles (points!)

it's disabled by default because most corefiles are uninteresting or nobody looks at them, or in a lot of cases just don't give you any more information.
if and when specificly needed, it can be turned on quickly.
dirk dierickx
Honored Contributor

Re: Using ulimit to get corefiles (points!)

also, i don't call it 'beginner friendlyness', it's 'makes good sense defaults'. i certainly like the userland more on linux then hpux where almost _nothing_ has a decent default value.
Christian Deutsch_1
Esteemed Contributor

Re: Using ulimit to get corefiles (points!)

Hi folks,

Sorry my testing was not yet thorough enough. When I kill a daemon process with kill -11 I get NO COREDUMP! I sent RedHat feedback to their webpage, don't know if they will send me a reply but I told them the information is wrong (at least partially wrong, at least as far as some daemon processes are concerned).

If you have any helpful hints that would be very helpful for me, otherwise I will see if I am able to get support from RedHat directly.

Thanks, Christian
Yeshua loves you!
Christian Deutsch_1
Esteemed Contributor

Re: Using ulimit to get corefiles (points!)

My colleague suggested that I hack the init script for the software that I am testing and to add the ulimit commands in there. I will use the hack until I find a better solution.
Yeshua loves you!
Heironimus
Honored Contributor

Re: Using ulimit to get corefiles (points!)

The process needs permission to write the core dump to its working directory, which not all daemons will have.
Matti_Kurkela
Honored Contributor

Re: Using ulimit to get corefiles (points!)

Heironimus is correct.

If the daemon's startup script does not contain any "cd" commands, the daemon's working directory is usually the same as the working directory of the process that started the script. If the script was executed automatically by the system startup scripts, the working directory is usually "/". Normally only root should have write access there.

Some security-sensitive daemons may be programmed to internally change their working directory to some safe location, usually /tmp.

If you are unsure, you can find out the working directory of any running process with "ls -l /proc//cwd". That is a (virtual) symlink that always points to the current working directory of that process.

MK
MK
Christian Deutsch_1
Esteemed Contributor

Re: Using ulimit to get corefiles (points!)

Thanks Hieronimus and Matti for your further explanations. I am not sure this is the correct explanation for the effects I am seeing. I will continue to investigate and let you know what I find out, Christian

If someone wants to play around and see if he gets the same effect: it is just the HP Operations Agent on RHEL5u1 x86.
Yeshua loves you!