Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Applications > Developer Suite > Issue <<  1 of 22 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 2890
Last update: 01-25-07
Issue:
How do I enable core file dumps when my application crashes or segmentation faults?
Resolution:

In Red Hat Enterprise Linux core file creation is disabled by default. This is done by the following ulimit command in /etc/profile:

ulimit -S -c 0 > /dev/null 2>1

There are a couple of ways to enable core file creation. The first is to replace the above ulimit command in /etc/profile with the following:

ulimit -S -c unlimited > /dev/null 2>1

This will allow all users to produce core files of unlimited size.

To disallow users of the system to be able to dump core files, configure the /etc/security/limits.conf file to allow only certain users or groups to create core files. For example, if all the members of the "devel" group are to be allowed to dump core files:

 
#<domain> <type>  <item>  <value>
@devel	 soft	core	<value>

The <value> is the maximum block size of a core file. The /etc/security/limits.conf file is well documented with usage and options at the top of the file. Please note that for these settings to be honored, it is necessary to comment out the above mentioned ulimit command in the /etc/profile file as follows:

 
# No core files by default
# ulimit -S -c 0 > /dev/null 2>1

If this application is being started within its init script with the daemon command, edit the /etc/init.d/functions file to comment out or change this line:

ulimit -S -c 0 >/dev/null 2>1

With this setup, a core file from the application should result. If this does not then make sure that the application has the correct uid and that it does not use setuid to change uid when running. On Red Hat Enterprise Linux 3, use the following command to enable the dumping of setuid applications:

echo 1 > /proc/sys/kernel/core_setuid_ok

Alternatively, add the following call to the application source (in the C language):

prctl(PR_SET_DUMPABLE, 1);

By default, core files are created in the working directory of the faulting application. To override this and specify a location for the files, enter the following command (as root) replacing "/tmp" with the desired target directory:

echo "/tmp" > /proc/sys/kernel/core_pattern


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Applications > Developer Suite > Issue <<   1  of  22  >>