Thursday, December 24, 2015

How to enable kdump on on RHEL 7.1

Find below steps to enable "kdump" on RHEL 7.1 (3.10.0-229.el7.x86_64)

1. Check & install kexec-tools-2.0.7-19.el7.x86_64:
# rpm -q kexec-tools
kexec-tools-2.0.7-19.el7.x86_64

2. Add memory option "crashkernel=auto" in grub:
# cat /etc/default/grub
GRUB_CMDLINE_LINUX="rd.lvm.lv=rootVG/swap crashkernel=auto rd.lvm.lv=rootVG/root rhgb quiet"

3. Regenerate grub configuration:
# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-67139936cbf84fe784a0953eb1e18aec
Found initrd image: /boot/initramfs-0-rescue-67139936cbf84fe784a0953eb1e18aec.img
done

4. Verify below parameters in /etc/kdump.conf file:
# cat /etc/kdump.conf
path /var/crash
core_collector makedumpfile -l --message-level 1 -d 31

5. Check & enable the kdump service
# systemctl status kdump.service
kdump.service - Crash recovery kernel arming
    Loaded: loaded (/usr/lib/systemd/system/kdump.service; disabled)
    Active: inactive (dead)

# systemctl enable kdump.service
ln -s '/usr/lib/systemd/system/kdump.service' '/etc/systemd/system/multi-user.target.wants/kdump.service'

6. Reboot the server
# reboot

7. Check status of kdump service:
# systemctl status kdump.service
kdump.service - Crash recovery kernel arming
    Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled)
    Active: active (exited) since Wed 2015-12-23 14:48:14 IST; 54s ago
  Process: 1895 ExecStart=/usr/bin/kdumpctl start (code=exited, status=0/SUCCESS)
  Main PID: 1895 (code=exited, status=0/SUCCESS)
    CGroup: /system.slice/kdump.service

Dec 23 14:48:04 test1.example.com systemd[1]: Starting Crash recovery kernel arming...
Dec 23 14:48:14 test1.example.com kdumpctl[1895]: kexec: loaded kdump kernel
Dec 23 14:48:14 test1.example.com kdumpctl[1895]: Starting kdump: [OK]
Dec 23 14:48:14 test1.example.com systemd[1]: Started Crash recovery kernel arming.


How to test kdump Configuration

1. Test the kdump configuration after reboot check service running status:
# systemctl is-active kdump
active

2. Run following commands at a shell prompt:
# echo 1 > /proc/sys/kernel/sysrq
# echo c > /proc/sysrq-trigger

Above commands will force the Linux kernel to crash, and the address-YYYY-MM-DD-HH:MM:SS/vmcore file will be copied to the location you have selected in the configuration (that is, to /var/crash/ by default).

No comments:

Post a Comment