How to enable core dump on Linux/Unix


Abnormal termination of a process will trigger a core dump file if coredump was enabled from the Operating system side. A core dump file is helpful to support engineers for determining the root cause of abnormal termination. A core dump of the process will show all process activity for dump time. But without information about the process call you couldn't analyze dump file. It can help you if you are a  programmer and you faced with an unexpected process crash.This KB describes how to enable core dump on Linux/Unix.

SOLARIS

• How to Create a Process Core Dump Manually?
 

#gcore -g <PID>


• How to Manage a Process Core Dump?
 

#vi /etc/coreadm.conf
COREADM_GLOB_PATTERN=/coredump/core.%f.%p
COREADM_GLOB_CONTENT=default
COREADM_INIT_PATTERN=core.in_timeout.P028.14382
COREADM_INIT_CONTENT=default
COREADM_GLOB_ENABLED=yes
COREADM_PROC_ENABLED=no
COREADM_GLOB_SETID_ENABLED=yes
COREADM_PROC_SETID_ENABLED=yes
COREADM_GLOB_LOG_ENABLED=yes
#svcadm disable svc:/system/coreadm:default
#svcadm enable svc:/system/coreadm:default


LINUX (RHEL6-Centos)

• Edit limits file
 

#vi /etc/security/limits.conf
#* soft core 0
* soft core unlimite


• Edit Kernel Parameter
 

# vi /etc/sysctl.conf
kernel.core_pattern = /tmp/core-%e-%s-%u-%g-%p-%t
fs.suid_dumpable = 2


• Edit INIT file
 

# vi /etc/sysconfig/init
DAEMON_COREFILE_LIMIT=’unlimited’


%e is the filename
%g is the gid the process was running under
%p is the pid of the process
%s is the signal that caused the dump
%t is the time the dump occurred
%u is the uid the process was running under

• Activate kernel parameter
 

#sysctl -p


LINUX (RHEL5)

• Change profile file under /etc for all user or change for individual user, edit your $HOME/.bash_profile.
 

#vi /etc/profile
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
to
ulimit -c unlimited >/dev/null 2>&1


• Please add the following into /etc/sysconfig/init
 

#added by BAuser for enabling core dump for application users
DAEMON_COREFILE_LIMIT=’unlimited’


• To enable core dump for individual daemon /etc/init.d/xx

Add following line into that file /etc/init.d/xx after “. /etc/rc.d/init.d/functions” line – RHEL
 

DAEMON_COREFILE_LIMIT=’unlimited’


• Last thing that specify a core dump area
 

#echo “/coredump” > /proc/sys/kernel/core_pattern


• Also you can set kernel pattern like RHEL6
 

#vi /etc/sysctl.conf
kernel.core_pattern = /tmp/core-%e-%s-%u-%g-%p-%t
#sysctl -p


• Generate a core file (test)

#sleep 100
#kill -s SIGSEGV <PIDofSleepProcess>


HP-UX

• Check ulimit parameter
 

#ulimit -a


• Set core dump file size to unlimited
 

#ulimit -c unlimited


• Generate a core file(test)

#gcore <PID>

 

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Turk Telekom. I provide hardware and software support for the IT Infrastructure and Operations tasks.

205 Total Posts
Follow Me