Redhat Enterprise Linux enable core dump

1. To check current configuration for core dump. Zero means core dump was disabled.

$ ulimit -c
0

2. To enable system wide core dump, edit /etc/profile as below:

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

3. specify core dump file location
Add it to /etc/sysctl.conf, and make sure to reload the config using "sysctl -p"

kernel.core_pattern = /tmp/core

4. To limit users from having unlimited core dump that causes file system full.
Edit /etc/security/limits.conf as below (value was in KB), disable all users, only allow for specific users with size limit:

*         hard    core            0
userA hard    core            512000

5. To confirm the configuration, log out from current session, relogin and try below.
start a new process or just edit a file using vim, grep the PID and check below (you need to have a new process to have this new setup):

(userA process)
[root@server1 ~]# cat /proc/8865/limits 
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            10485760             unlimited            bytes     
Max core file size        0                    524288000            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             unlimited            unlimited            processes 
Max open files            1024                 1024                 files     
Max locked memory         32768                32768                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       40960                40960                signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0   

(Other user process)
[root@server1 ~]# cat /proc/30376/limits 
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            10485760             unlimited            bytes     
Max core file size        0                    0                    bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             40960                40960                processes 
Max open files            1024                 1024                 files     
Max locked memory         32768                32768                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       40960                40960                signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    

Max realtime priority     0                    0  


Reference:
https://access.redhat.com/site/solutions/5352
https://access.redhat.com/site/solutions/4058
http://linuxtechres.blogspot.com/2011/09/how-to-enable-core-dump-for-application.html

1 comment:

DumpsPass4sure said...

My priority as exam material for preparation of IT exam is none other than Pass4sure Microsoft dumps. I have experienced this dumps material during my preparation for Microsoft exam. I put my best efforts for my preparation with Microsoft dumps and got my desired marks.