Posted on 2010/02/18 15:25
Filed Under OS/redhat

How can core dumps be enabled for daemons (services) in Red Hat Enterprise Linux?

Article ID: 5353 - Created on: May 7, 2008 6:00 PM - Last Modified:  Jul 16, 2009 1:13 PM

Release Found: Red Hat Enterprise Linux, versions 3, 4 and 5

Problem

For troubleshooting purposes, you want core dumps to be generated when a daemon (service) terminates abnormally.

Solution

A daemon is a computer program that runs in the background, rather than under the direct control of a user; they are usually initiated as processes. Daemons are usually started with the service command or as an init script.

You need to make the following modifications in order to enable core dumps for daemons:

    * Edit /etc/profile:

vi /etc/profile

    * Replace this line:

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

with this line:

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

    * Enable this globally by editing the /etc/sysconfig/init file and add this line:

DAEMON_COREFILE_LIMIT='unlimited'

    * Note that changes to "ulimit" settings do not affect daemon processes which are already running, so you need to restart any daemons for which you want to enable core dumps. Alternatively, you can reboot the system to have the new settings take effect for all daemons.

    * By default, core dumps are not generated by programs that are running setuid to prevent sensitive information being leaked. To enable core dumps for setuid programs (for the running kernel, not persistent over reboots):

*   For Red Hat Enterprise Linux 5: "suidsafe" (recommended) - protect privileged information by having the core dump be owned by and only readable for root:

echo 2 > /proc/sys/fs/suid_dumpable

*   For Red Hat Enterprise Linux 5: "debug" (may cause privileged information to be leaked):

echo 1 > /proc/sys/fs/suid_dumpable

*   For Red Hat Enterprise Linux 4:

echo 2 > /proc/sys/kernel/suid_dumpable

*   For Red Hat Enterprise Linux 3:

echo 1 > /proc/sys/kernel/core_setuid_ok

    * Changes to these /proc values take effect immediately (however these are not preserved upon reboot), so they will also apply to daemons that are already running.

    * To enable core dumps for setuid programs (persistent over reboots):

*   Edit /etc/sysctl.conf and add the following:

fs.suid_dumpable = 2      # RHEL 5 only

kernel.suid_dumpable = 2  # RHEL 4 only

kernel.core_setuid_ok = 1 # RHEL 3 only

kernel.core_pattern = /tmp/core

*   Reload the settings in /etc/sysctl.conf:

sysctl -p

When the daemon terminates abnormally, a core file should appear in the configured location /tmp. The exact location and name of the core file can be controlled through the kernel.core_pattern sysctl which is documented in the core(5) manual page.



-- Red Hat 참조 사이트입니다.
http://kbase.redhat.com/faq/FAQ_45_2198.shtm
http://kbase.redhat.com/faq/FAQ_45_3904.shtm
http://kbase.redhat.com/faq/FAQ_80_2498.shtm
http://kbase.redhat.com/faq/FAQ_43_2467.shtm            // netdump setting
http://kbase.redhat.com/faq/FAQ_43_2198.shtm            // testing
http://kbase.redhat.com/faq/FAQ_45_9052.shtm            // RHEL 4 support NIC
http://kbase.redhat.com/faq/FAQ_46_10751.shtm           // RHEL 4 ppc
http://kbase.redhat.com/faq/FAQ_85_9914.shtm            // vmcore size RHEL4

http://kbase.redhat.com/faq/FAQ_41_442.shtm             / oops
http://kbase.redhat.com/faq/FAQ_80_4154.shtm            // hang

http://kbase.redhat.com/faq/FAQ_80_3721.shtm            // Netpoll
http://kbase.redhat.com/faq/FAQ_85_9129.shtm
http://kbase.redhat.com/faq/FAQ_80_3721.shtm
http://kbase.redhat.com/faq/FAQ_80_5559.shtm

http://kbase.redhat.com/faq/FAQ_79_4220.shtm
http://kbase.redhat.com/faq/FAQ_79_5668.shtm
http://kbase.redhat.com/faq/FAQ_85_5704.shtm

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)
2010/02/18 15:25 2010/02/18 15:25

트랙백 주소 : http://blog.seabow.pe.kr/trackback/716



About

by 삐꾸강아쥐

Counter

· Total
: 137367
· Today
: 68
· Yesterday
: 0
블로그코리아에 블UP하기