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 51bbe6
	1G-4G:192M,4G-64G:256M,64G-102400T: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 51bbe6
A new release of kexec-tools could update the default crashkernel value.
Coiby Xu 51bbe6
By default, kexec-tools would reset crashkernel to the new default value if it
Coiby Xu 51bbe6
detects old default crashkernel value is used by installed kernels. If you don't
Coiby Xu 51bbe6
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
Kairui Song f5ffd4
This command will read from the `crashkernel.default` file and reset
Kairui Song f5ffd4
bootloader's kernel cmdline to the default value. It will also update bootloader
Kairui Song f5ffd4
config if the bootloader has a standalone config file. User will have to reboot
Coiby Xu 51bbe6
the machine after this command to make it take effect if --reboot is not specified.
Coiby Xu 51bbe6
For ppc64le, an optional "[--fadump=[on|off|nocma]]" can also be specified to toggle
Coiby Xu 51bbe6
FADump on/off.
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 51bbe6
kernels to current boot kernel's crashkernel.default` is:
Kairui Song f5ffd4
Coiby Xu 51bbe6
	grubby --update-kernel ALL --args "crashkernel=$(kdumpctl get-default-crashkernel)"
Kairui Song f5ffd4
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
```
Kairui Song f5ffd4
      Encrypted kdump target requires extra memory, assuming using the keyslot with minimun 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.