|
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 |
|
|
Kairui Song |
f5ffd4 |
Latest kernel packages includes a `crashkernel.default` file installed in kernel
|
|
Kairui Song |
f5ffd4 |
modules folder, available as:
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
/usr/lib/modules/<kernel>/crashkernel.default
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
The content of the file will be taken as the default value of 'crashkernel=', or
|
|
Kairui Song |
f5ffd4 |
take this file 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 |
|
|
Kairui Song |
f5ffd4 |
Anaconda is the OS installer which sets all the kernel boot cmdline on a new
|
|
Kairui Song |
f5ffd4 |
installed system. If kdump is set enabled during Anaconda installation, Anaconda
|
|
Kairui Song |
f5ffd4 |
will use the `crashkernel.default` file as the default `crashkernel=` value on
|
|
Kairui Song |
f5ffd4 |
the new installed system.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
Users can also 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 |
|
|
Kairui Song |
f5ffd4 |
Following context in this section assumes all kernel packages have a
|
|
Kairui Song |
f5ffd4 |
`crashkernel.default` file bundled, which is true for the latest official kernel
|
|
Kairui Song |
f5ffd4 |
packages. For kexec-tools behavior with a kernel that doesn't have a
|
|
Kairui Song |
f5ffd4 |
`crashkernel.default` file, please refer to the “Custom Kernel” section of this
|
|
Kairui Song |
f5ffd4 |
doc.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
When `crashkernel=` is using the default value, kexec-tools will need to update
|
|
Kairui Song |
f5ffd4 |
the `crashkernel=` value of new installed kernels, since the default value may
|
|
Kairui Song |
f5ffd4 |
change in new kernel packages.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
kexec-tools does so by adding a kernel installation hook, which gets triggered
|
|
Kairui Song |
f5ffd4 |
every time a new kernel is installed, so kexec-tools can do necessary checks and
|
|
Kairui Song |
f5ffd4 |
updates.
|
|
Kairui Song |
f5ffd4 |
|
|
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 |
Updating kernel package
|
|
Kairui Song |
f5ffd4 |
-----------------------
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
When a new version of package kernel is released in the official repository, the
|
|
Kairui Song |
f5ffd4 |
package will always come with a `crashkernel.default` file bundled. Kexec-tools
|
|
Kairui Song |
f5ffd4 |
will act with following rules:
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
If current boot kernel is using the default `crashkernel=` boot param value from
|
|
Kairui Song |
f5ffd4 |
its `crashkernel.default` file, then kexec-tools will update new installed
|
|
Kairui Song |
f5ffd4 |
kernel’s `crashkernel=` boot param using the value from the new installed
|
|
Kairui Song |
f5ffd4 |
kernel’s `crashkernel.default` file. This ensures `crashkernel=` is always using
|
|
Kairui Song |
f5ffd4 |
the latest default value.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
If current boot kernel's `crashkernel=` value is set to a non-default value, the
|
|
Kairui Song |
f5ffd4 |
new installed kernel simply inherits this value.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
On systems using GRUB2 as the bootloader, each kernel has its own boot entry,
|
|
Kairui Song |
f5ffd4 |
making it possible to set different `crashkernel=` boot param values for
|
|
Kairui Song |
f5ffd4 |
different kernels. So kexec-tools won’t touch any already installed kernel's
|
|
Kairui Song |
f5ffd4 |
boot param, only new installed kernel's `crashkernel=` boot param value will be
|
|
Kairui Song |
f5ffd4 |
updated.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
But some utilities like `grub2-mkconfig` and `grubby` can override all boot
|
|
Kairui Song |
f5ffd4 |
entry's boot params with the boot params value from the GRUB config file
|
|
Kairui Song |
f5ffd4 |
`/etc/defaults/grub`, so kexec-tools will also update the GRUB config file in
|
|
Kairui Song |
f5ffd4 |
case old `crashkernel=` value overrides new installed kernel’s boot param.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
Downgrading kernel package
|
|
Kairui Song |
f5ffd4 |
--------------------------
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
When upgrading a kernel package, kexec-tools may update the `crashkernel=` value
|
|
Kairui Song |
f5ffd4 |
in GRUB2 config file to the new value. So when downgrading the kernel package,
|
|
Kairui Song |
f5ffd4 |
kexec-tools will also try to revert that update by setting GRUB2 config file’s
|
|
Kairui Song |
f5ffd4 |
`crashkernel=` value back to the default value in the older kernel package. This
|
|
Kairui Song |
f5ffd4 |
will only occur when the GRUB2 config file is using the default `crashkernel=`
|
|
Kairui Song |
f5ffd4 |
value.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
Custom kernel
|
|
Kairui Song |
f5ffd4 |
=============
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
To make auto crashkernel update more robust, kexec-tools will try to keep
|
|
Kairui Song |
f5ffd4 |
tracking the default 'crashkernel=` value with kernels that don’t have a
|
|
Kairui Song |
f5ffd4 |
`crashkernel.default` file, such kernels are referred to as “custom kernel” in
|
|
Kairui Song |
f5ffd4 |
this doc. This is only a best-effort support to make it easier debugging and
|
|
Kairui Song |
f5ffd4 |
testing the system.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
When installing a custom kernel that doesn’t have a `crashkernel.default` file,
|
|
Kairui Song |
f5ffd4 |
the `crashkernel=` value will be simply inherited from the current boot kernel.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
When installing a new official kernel package and current boot kernel is a
|
|
Kairui Song |
f5ffd4 |
custom kernel, since the boot kernel doesn’t have a `crashkernel.default` file,
|
|
Kairui Song |
f5ffd4 |
kexec-tools will iterate installed kernels and check if the boot kernel
|
|
Kairui Song |
f5ffd4 |
inherited the default value from any other existing kernels’
|
|
Kairui Song |
f5ffd4 |
`crashkernel.default` file. If a matching `crashkernel.default` file is found,
|
|
Kairui Song |
f5ffd4 |
kexec-tools will update the new installed kernel `crashkernel=` boot param using
|
|
Kairui Song |
f5ffd4 |
the value from the new installed kernel’s `crashkernel.default` file, ensures
|
|
Kairui Song |
f5ffd4 |
the auto crashkernel value update won’t break over one or two custom kernel
|
|
Kairui Song |
f5ffd4 |
installations.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
It is possible that the auto crashkernel value update will fail when custom
|
|
Kairui Song |
f5ffd4 |
kernels are used. One example is a custom kernel inheriting the default
|
|
Kairui Song |
f5ffd4 |
`crashkernel=` value from an older official kernel package, but later that
|
|
Kairui Song |
f5ffd4 |
kernel package is uninstalled. So when booted with the custom kernel,
|
|
Kairui Song |
f5ffd4 |
kexec-tools can't determine if the boot kernel is inheriting a default
|
|
Kairui Song |
f5ffd4 |
`crashkernel=` value from any official build. In such a case, please refer to
|
|
Kairui Song |
f5ffd4 |
the "Reset crashkernel to default value" section of this doc.
|
|
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
|
|
Kairui Song |
f5ffd4 |
value or inherited from any installed kernel.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
kexec-tools may fail to determine if the boot kernel is using default
|
|
Kairui Song |
f5ffd4 |
crashkernel value in some use cases:
|
|
Kairui Song |
f5ffd4 |
- kexec-tools package is absent during a kernel package upgrade, and the new
|
|
Kairui Song |
f5ffd4 |
kernel package’s `crashkernel.default` value has changed.
|
|
Kairui Song |
f5ffd4 |
- Custom kernel is used and the kernel it inherits `crashkernel=` value from is
|
|
Kairui Song |
f5ffd4 |
uninstalled.
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
So it's recommended to reset the crashkernel value if users have uninstalled
|
|
Kairui Song |
f5ffd4 |
kexec-tools or using a custom kernel.
|
|
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 |
|
|
Kairui Song |
f5ffd4 |
`kdumpctl reset-crashkernel [<kernel version>]`
|
|
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
|
|
Kairui Song |
f5ffd4 |
the machine after this command to make it take effect.
|
|
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
|
|
Kairui Song |
f5ffd4 |
kernels to current boot kernel's crashkernel.default` is:
|
|
Kairui Song |
f5ffd4 |
|
|
Kairui Song |
f5ffd4 |
grubby --update-kernel ALL --args "$(cat /usr/lib/modules/$(uname -r)/crashkernel.default)"
|
|
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.
|