18.6 Basic kdump Configuration

You can use kdump to save kernel dumps. If the kernel crashes, it is useful to copy the memory image of the crashed environment to the file system. You can then debug the dump file to find the cause of the kernel crash. This is called core dump.

kdump works similar to kexec (see Section 18.0, kexec and kdump). The capture kernel is executed after the running production kernel crashes. The difference is that kexec replaces the production kernel with the capture kernel. With kdump, you still have access to the memory space of the crashed production kernel. You can save the memory snapshot of the crashed kernel in the environment of the kdump kernel.

HINT: Dumps over Network

In environments with limited local storage, you need to set up kernel dumps over the network. kdump supports configuring the specified network interface and bringing it up via initrd. Both LAN and VLAN interfaces are supported. You have to specify the network interface and the mode (dhcp or static) either with YaST, or using the KDUMP_NETCONFIG option in the /etc/sysconfig/kdump file. The third way is to build initrd manually, for example with

/sbin/mkinitrd -D vlan0

for a dhcp VLAN interface, or

/sbin/mkinitrd -I eth0

for a static LAN interface.

You can either configure kdump manually or with YaST.

IMPORTANT: Target Filesystem for kdump Must Be Mounted During Configuration

When configuring kdump, you can specify a location to which the dumped images will be saved (default: /var/crash). This location must be mounted when configuring kdump, otherwise the configuration will fail.

18.6.1 Manual kdump Configuration

kdump reads its configuration from the /etc/sysconfig/kdump file. To make sure that kdump works on your system, its default configuration is sufficient. To use kdump with the default settings,follow these steps:

  1. Append the following kernel command line option to your boot loader configuration, and reboot the system:

    crashkernel=size@offset

    You can find the corresponding values for size and offset in the following table:

    Table 18-1 Recommended Values for Additional Kernel Command Line Parameters

    Architecture

    Recommended value

    i386 and x86-64

    • crashkernel=256M for 0 - 12 GB memory
    • crashkernel=512M for 13 - 48 GB memory
    • crashkernel=768M for more than 48 GB memory

    IA64

    crashkernel=256M (small systems) or crashkernel=512M (larger systems)

    ppc64

    crashkernel=128M@4M or crashkernel=256M@4M (larger systems)

    s390x

    crashkernel=128M (small systems) or crashkernel=256M (larger systems)

  2. Enable kdump init script:

    chkconfig boot.kdump on

  3. You can edit the options in /etc/sysconfig/kdump. Reading the comments will help you understand the meaning of individual options.

  4. Execute the init script once with rckdump start, or reboot the system.

After configuring kdump with the default values, check if it works as expected. Make sure that no users are currently logged in and no important services are running on your system. Then follow these steps:

  1. Switch to runlevel 1 with telinit 1

  2. Unmount all the disk file systems except the root file system with umount -a

  3. Remount the root file system in read-only mode: mount -o remount,ro /

  4. Invoke kernel panic with the procfs interface to Magic SysRq keys:

    echo c >/proc/sysrq-trigger

IMPORTANT: The Size of Kernel Dumps

The KDUMP_KEEP_OLD_DUMPS option controls the number of preserved kernel dumps (default is 5). Without compression, the size of the dump can take up to the size of the physical RAM memory. Make sure you have sufficient space on the /var partition.

The capture kernel boots and the crashed kernel memory snapshot is saved to the file system. The save path is given by the KDUMP_SAVEDIR option and it defaults to /var/crash. If KDUMP_IMMEDIATE_REBOOT is set to yes , the system automatically reboots the production kernel. Log in and check that the dump has been created under /var/crash.

WARNING: Screen Freezes in X11 Session

When kdump takes control and you are logged in an X11 session, the screen will freeze without any notice. Some kdump activity can be still visible (for example, deformed messages of a booting kernel on the screen).

Do not reset the computer because kdump always needs some time to complete its task.

18.6.2 YaST Configuration

In order to configure kdump with YaST, you need to install the yast2-kdump package. Then either start the Kernel Kdump module in the System category of YaST Control Center, or enter yast2 kdump in the command line as root.

Figure 18-1 YaST2 Kdump Module - Start-Up Page

In the Start-Up window, select Enable Kdump. The default value for kdump memory is sufficient on most systems.

Click Dump Filtering in the left pane, and check what pages to include in the dump. You do not need to include the following memory content to be able to debug kernel problems:

  • Pages filled with zero

  • Cache pages

  • User data pages

  • Free pages

In the Dump Target window, select the type of the dump target and the URL where you want to save the dump. If you selected a network protocol, such as FTP or SSH, you need to enter relevant access information as well.

Fill the Email Notification window information if you want kdump to inform you about its events via E-mail and confirm your changes with OK after fine tuning kdump in the Expert Settings window. kdump is now configured.