Posts Tagged ‘kdump’

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

May 30th, 2013 Comments off

---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

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

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

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
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/\:23\:06/vmcore
objdump -a ./ls #binutils, file format elf64-x86-64
gdb /path/to/application /path/to/corefile


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." for example.