3.3. Using kdump and kexec with the MRG Realtime kernel

3.3. Using kdump and kexec with the MRG Realtime kernel

If kdump is enabled on your system, the standard boot kernel will reserve a small section of system RAM and load the kdump kernel into the reserved space. When a kernel panic or other fatal error occurs, kexec is used to boot into the kdump kernel. Kexec is a fastboot mechanism that allows the kdump kernel to boot without going through BIOS. The kdump kernel boots up using only the reserved RAM and sends an error message to the console. It will then write a dump of the boot kernel's address space to a file for later debugging. Because kexec does not go through the BIOS, the memory of the original boot is retained, and the crash dump is much more detailed. Once this is done, the kdump kernel performs a reboot, which will reset the machine and bring the boot kernel back up.

Tip

In Red Hat Enterprise Linux 5.1 there is no dedicated kdump kernel. It uses the main kernel instead. The MRG Realtime kernel cannot be used as a kdump kernel, but it supports the use of a seperate kdump kernel. It is recommended that you use the MRG Realtime kernel as the boot kernel, and the Red Hat Enterprise Linux 5.1 kernel as the kdump kernel.

There are two methods for enabling kdump under Red Hat Enterprise Linux 5.1. The first method adds a command line to the boot kernel, and the second uses a system configuration tool.

Enabling kdump with grub.conf
  1. Firstly, you will need to check that you have the kexec-tools package installed.

    # rpm -q kexec-tools
    kexec-tools-1.101-194.4.el5
    
  2. By default, the crash dump is saved in the /var/crash file. If you wish to change this, simply uncomment and adjust the path value in the /etc/kdump.conf file. This can be a local file, or on another server.

    ...[output truncated]...
    #raw /dev/sda5
    #ext3 /dev/sda3
    #ext3 LABEL=/boot
    #ext3 UUID=03138356-5e61-4ab3-b58e-27507ac41937
    #net my.server.com:/export/tmp
    #net user@my.server.com
    
    path /path/to/file
    
    #core_collector makedumpfile -c
    #link_delay 60
    #kdump_post /var/crash/scripts/kdump-post.sh
    #extra_bins /usr/bin/lftp
    #extra_modules gfs2
    #default shell
    
  3. Open the /etc/grub.conf file in your preferred text editor and add a crashkernel line to the boot kernel. This line takes the form:

    crashkernel=[MB of RAM to reserve]M@[memory location]M
    

    A typical crashkernel line would reserve 128 megabytes (128M) at 16 megabytes (16M), which is equivalant to the address 0x1000000:

    crashkernel=128M@16M
    

    A typical MRG Realtime /etc/grub.conf file would have the MRG Realtime kernel as the boot kernel, and the crashkernel line added to the Red Hat Enterprise Linux kernel:

    default=0
    timeout=5
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    title Red Hat Enterprise Linux (realtime) (2.6.21-57.el5rt)
    	root (hd0,0)
    	kernel /vmlinuz-2.6.21-57.el5rt ro root=/dev/HelpdeskRHEL5/Root rhgb quiet
    	initrd /initrd-2.6.21-57.el5rt.img
    title Red Hat Enterprise Linux Client (2.6.18-53.1.13.el5)
    	root (hd0,0)
    	kernel /vmlinuz-2.6.18-53.1.13.el5 ro root=/dev/HelpdeskRHEL5/Root rhgb quiet crashkernel=128M@16M
    	initrd /initrd-2.6.18-53.1.13.el5.img
    
  4. Once you have saved your changes, restart the system to set up the reserved memory space. You can then turn on the kdump init script and start the kdump service:

    # chkconfig kdump on
    
    # service kdump status
    Kdump is not operational
    
    # service kdump start
    Starting kdump:                   [  OK  ]
    
  5. If you want to check that the kdump is working correctly, you can simulate a panic using sysrq:

    # echo "c" > /proc/sysrq-trigger
    

    This will cause the kernel to panic and the system will boot into the kdump kernel. Once your system has been brought back up with the boot kernel, you should be able to check the log file at the location you specified.

Enabling kdump with system-config-kdump
  1. Select the Kdump system tool from the System|Administration menu, or use the following command from the command line:

    # system-config-kdump
    
    Kdump System Tool
  2. Select the check box labeled Enable kdump and adjust the necessary settings for memory reservation and dump file location. Click OK to save your changes.

    Important

    Always check the /etc/grub.conf file to ensure that the tool has adjusted the correct kernel. The MRG Realtime kernel should be the default boot kernel and the Red Hat Enterprise Linux kernel should be used as the crash kernel.

  3. If you want to check that the kdump is working correctly, you can simulate a panic using sysrq:

    # echo "c" > /proc/sysrq-trigger
    

    This will cause the kernel to panic and the system will boot into the kdump kernel. Once your system has been brought back up with the boot kernel, you should be able to check the log file at the location you specified.

Tip

Some hardware needs to be reset during the configuration of the kdump kernel. If you have any problems getting the kdump kernel to work, edit the /etc/sysconfig/kdump file and add reset_devices=1 to the KDUMP_COMMANDLINE_APPEND variable.

Related Manual Pages

For more information, or for further reading, the following man pages are related to the information given in this section.