Kairui Song f5ffd4
Introduction
Kairui Song f5ffd4
============
Kairui Song f5ffd4
Kairui Song f5ffd4
This document describes features the kexec-tools package provides for setting
Kairui Song f5ffd4
and estimating the crashkernel value.
Kairui Song f5ffd4
Kairui Song f5ffd4
Kdump lives in a pre-reserved chunk of memory, and the size of the reserved
Kairui Song f5ffd4
memory is specified by the `crashkernel=` kernel parameter. It's hard to
Kairui Song f5ffd4
estimate an accurate `crashkernel=` value, so it's always recommended to test
Kairui Song f5ffd4
kdump after you updated the `crashkernel=` value or changed the dump target.
Kairui Song f5ffd4
Kairui Song f5ffd4
Kairui Song f5ffd4
Default crashkernel value
Kairui Song f5ffd4
=========================
Kairui Song f5ffd4
Coiby Xu 51bbe6
Latest kexec-tools provides "kdumpctl get-default-crashkernel" to retrieve
Coiby Xu 51bbe6
the default crashkernel value,
Kairui Song f5ffd4
Coiby Xu 51bbe6
	$ echo $(kdumpctl get-default-crashkernel)
Coiby Xu 1778bc
	1G-4G:192M,4G-64G:256M,64G-:512M
Kairui Song f5ffd4
Coiby Xu 51bbe6
It will be taken as the default value of 'crashkernel=', you can use
Coiby Xu 51bbe6
this value as a reference for setting crashkernel value manually.
Kairui Song f5ffd4
Kairui Song f5ffd4
Kairui Song f5ffd4
New installed system
Kairui Song f5ffd4
====================
Kairui Song f5ffd4
612098
Anaconda is the OS installer which sets all the kernel boot cmdline on a newly
612098
installed system. If kdump is enabled during Anaconda installation, Anaconda
Coiby Xu 51bbe6
will use the default crashkernel value as the default `crashkernel=` value on
612098
the newly installed system.
Kairui Song f5ffd4
612098
Users can override the value during Anaconda installation manually.
Kairui Song f5ffd4
Kairui Song f5ffd4
Kairui Song f5ffd4
Auto update of crashkernel boot parameter
Kairui Song f5ffd4
=========================================
Kairui Song f5ffd4
Coiby Xu d3dba4
A new release of kexec-tools could update the default crashkernel value.  By
Coiby Xu d3dba4
default, kexec-tools would reset crashkernel to the new default value if it
Coiby Xu d3dba4
detects the old default crashkernel value is used by installed kernels. If you
Coiby Xu d3dba4
don't want kexec-tools to update the old default crashkernel to the new default
Coiby Xu 51bbe6
crashkernel, you can change auto_reset_crashkernel to no in kdump.conf.
Kairui Song f5ffd4
Kairui Song f5ffd4
Supported Bootloaders
Kairui Song f5ffd4
---------------------
Kairui Song f5ffd4
Kairui Song f5ffd4
This auto update only works with GRUB2 and ZIPL, as kexec-tools heavily depends
Kairui Song f5ffd4
on `grubby`. If other boot loaders are used, the user will have to update the
Kairui Song f5ffd4
`crashkernel=` value manually.
Kairui Song f5ffd4
Kairui Song f5ffd4
Kairui Song f5ffd4
Reset crashkernel to default value
Kairui Song f5ffd4
==================================
Kairui Song f5ffd4
Kairui Song f5ffd4
kexec-tools only perform the auto update of crashkernel value when it can
Kairui Song f5ffd4
confirm the boot kernel's crashkernel value is using its corresponding default
Coiby Xu 51bbe6
value and auto_reset_crashkernel=yes in kdump.conf. In other cases, the user
Coiby Xu 51bbe6
can reset the crashkernel value by themselves.
Kairui Song f5ffd4
Kairui Song f5ffd4
Reset using kdumpctl
Kairui Song f5ffd4
--------------------
Kairui Song f5ffd4
Kairui Song f5ffd4
To make it easier to reset the `crashkernel=` kernel cmdline to this default
Kairui Song f5ffd4
value properly, `kdumpctl` also provides a sub-command:
Kairui Song f5ffd4
Coiby Xu 51bbe6
	`kdumpctl reset-crashkernel [--kernel=path_to_kernel] [--reboot]`
Kairui Song f5ffd4
Coiby Xu d3dba4
This command will reset the bootloader's kernel cmdline to the default value.
Coiby Xu d3dba4
It will also update bootloader config if the bootloader has a standalone config
Coiby Xu d3dba4
file. User will have to reboot the machine after this command to make it take
Coiby Xu d3dba4
effect if --reboot is not specified. For more details, please refer to the
Coiby Xu d3dba4
reset-crashkernel command in `man kdumpctl`.
Kairui Song f5ffd4
Kairui Song f5ffd4
Reset manually
Kairui Song f5ffd4
--------------
Kairui Song f5ffd4
Kairui Song f5ffd4
To reset the crashkernel value manually, it's recommended to use utils like
Kairui Song f5ffd4
`grubby`. A one liner script for resetting `crashkernel=` value of all installed
Coiby Xu d3dba4
kernels to the default value is:
Kairui Song f5ffd4
Coiby Xu 51bbe6
	grubby --update-kernel ALL --args "crashkernel=$(kdumpctl get-default-crashkernel)"
Kairui Song f5ffd4
Coiby Xu 3c7270
NOTE: On s390x you also need to run zipl for the change to take effect.
Coiby Xu 3c7270
Kairui Song f5ffd4
Estimate crashkernel
Kairui Song f5ffd4
====================
Kairui Song f5ffd4
Kairui Song f5ffd4
The best way to estimate a usable crashkernel value is by testing kdump
Kairui Song f5ffd4
manually.  And you can set crashkernel to a large value, then adjust the
Kairui Song f5ffd4
crashkernel value to an acceptable value gradually.
Kairui Song f5ffd4
Kairui Song f5ffd4
`kdumpctl` also provides a sub-command for doing rough estimating without
Kairui Song f5ffd4
triggering kdump:
Kairui Song f5ffd4
Kairui Song f5ffd4
	`kdumpctl estimate`
Kairui Song f5ffd4
Kairui Song f5ffd4
The output will be like this:
Kairui Song f5ffd4
Kairui Song f5ffd4
```
Coiby Xu d3dba4
      Encrypted kdump target requires extra memory, assuming using the keyslot with minimum memory requirement
Kairui Song f5ffd4
Kairui Song f5ffd4
      Reserved crashkernel:    256M
Kairui Song f5ffd4
      Recommended crashkernel: 655M
Kairui Song f5ffd4
Kairui Song f5ffd4
      Kernel image size:   47M
Kairui Song f5ffd4
      Kernel modules size: 12M
Kairui Song f5ffd4
      Initramfs size:      19M
Kairui Song f5ffd4
      Runtime reservation: 64M
Kairui Song f5ffd4
      LUKS required size:  512M
Kairui Song f5ffd4
      Large modules:
Kairui Song f5ffd4
          xfs: 1892352
Kairui Song f5ffd4
          nouveau: 2318336
Kairui Song f5ffd4
      WARNING: Current crashkernel size is lower than recommended size 655M.
Kairui Song f5ffd4
```
Kairui Song f5ffd4
Kairui Song f5ffd4
It will generate a summary report about the estimated memory consumption
Kairui Song f5ffd4
of each component of kdump. The value may not be accurate enough, but
Kairui Song f5ffd4
would be a good start for finding a suitable crashkernel value.