Home > IT Architecture, Kernel, Linux, Systems > application core dump and kernel core dump(kdump) in linux

application core dump and kernel core dump(kdump) in linux

May 30th, 2013

---App core dump
vi /etc/profile

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

vi /etc/sysctl.conf

kernel.core_uses_pid = 1
kernel.core_pattern = /var/tmp/app-core-%e-%s-%u-%g-%p-%t
fs.suid_dumpable = 2

echo "DAEMON_COREFILE_LIMIT='unlimited'" >> /etc/sysconfig/init #enable debugging for all apps. For specific app, e.g /etc/init.d/httpd(DAEMON_COREFILE_LIMIT='unlimited')
sysctl -p

After this, you can kill -s SIGSEGV <pid> to generate a linux application core dump(send a Segmentation fault signal)

---Kernel core dump

You can also check here for kdump on Oracle Linux. And here is about the way kdump works.

yum install system-config-kdump kexec-tools crash kernel-debuginfo kernel-debuginfo-common
vi /boot/grub/grub.conf

crashkernel=0M-2G:128M,2G-6G:256M,6G-8G:512M,8G-:768M nmi_watchdog=1 #Or crashkernel=256M@16M, tells the system kernel to reserve 256 MB of memory starting at physical address 0x01000000 (16MB) for the dump-capture kernel, crashkernel=256M

vi /etc/kdump.conf #more on http://linux.die.net/man/5/kdump.conf

ext3 /dev/mapper/VolGroup00-LogVol00
core_collector makedumpfile -c -d 31
path /var/log/dumps

vi /etc/sysctl.conf

kernel.unknown_nmi_panic=1 #should be there by default
fs.suid_dumpable = 2
kernel.core_uses_pid = 1 #should be there by default
kernel.panic_on_unrecovered_nmi=1
vm.panic_on_oom=1

vi /etc/security/limits.conf #can not exceed values defined in /etc/security/limits.conf though

* soft core unlimited
* hard core unlimited

vi /etc/profile

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

sysctl -p
chkconfig kdump on
reboot

dmesg|egrep -i 'crash|dump' #sometimes memory reservation may failed with message "crashkernel reservation failed - memory is in use"
cat /proc/iomem | grep -i crash

cat /proc/meminfo|grep Slab #The total amount of memory, in kilobytes, used by the kernel to cache data structures for its own use
cat /proc/cmdline #check this after configuring crash kernel ram

/etc/init.d/kdump status
/etc/init.d/kdump restart
sync;sync;sync
echo 1 > /proc/sys/kernel/sysrq
echo "c" > /proc/sysrq-trigger #will reboot, to test the kdump

echo "b" > /proc/sysrq-trigger #will reboot system, useful when no memory can be allocated and you can reboot by this

ls -lrth /var/log/dumps/
---Analyse coredump file
crash /usr/lib/debug/lib/modules/2.6.18-194.17.4.el5/vmlinux /var/crash/127.0.0.1-2011-03-16-12\:23\:06/vmcore
objdump -a ./ls #binutils, file format elf64-x86-64
gdb /path/to/application /path/to/corefile
strace

PS:

For kdump kernel, if "KDUMP_KERNELVER" in /etc/sysconfig/kdump is not specified, then the init script will try to find a kdump kernel with the same version number as the running kernel. You can specify this parameter as "2.6.18-407.0.0.0.1.el5PAE" for example.

Good Luck!


Comments are closed.