3.15. Configuring kdump for Microsoft Azure instances
If a kernel crash occurs in a RHEL instance, you can use the kdump service to determine its cause. If kdump is configured correctly while your kernel instance terminates unexpectedly, kdump generates a dump file, known as crash dump or a vmcore file. For debugging, you can then analyze the file to discover why the crash occurred.
For kdump to work on Microsoft Azure instances, you might need to adjust the kdump reserved memory and the vmcore target to fit VM sizes and RHEL versions.
Prerequisites
You are using a VM from Microsoft Azure environment that supports
kdump:- Standard_DS2_v2
- Standard NV16as v4
- Standard M416-208s v2
- Standard M416ms v2
-
You have the
rootpermission. -
Your system meets the requirements for
kdumpconfigurations and targets. For details, see Supported kdump configurations and targets.
Procedure
Install
kdumpand other necessary packages:# dnf install kexec-tools kdump-utils makedumpfileVerify that the default location for crash dump files is set in the
kdumpconfiguration file and that the/var/crashfile is available:# grep -v "#" /etc/kdump.conf path /var/crash core_collector makedumpfile -l --message-level 7 -d 31Based on the RHEL VM size and version, check if you need a
vmcoretarget with more free space, such as/mnt/crash:Expand 表 3.3. Virtual machine sizes that have been tested with GEN2 VM on Azure RHEL Version Standard DS1 v2 (1 vCPU, 3.5GiB) Standard NV16as v4 (16 vCPUs, 56 GiB) Standard M416-208s v2 (208 vCPUs, 5700 GiB) Standard M416ms v2 (416 vCPUs, 11400 GiB) RHEL 9.4 - RHEL 10
Default
Default
Target
Target
-
Default indicates that
kdumpworks as expected with the default memory and the defaultkdumptarget. The defaultkdumptarget is the/var/crashfile. -
Target indicates that
kdumpworks as expected with the default memory. However, you might need to assign a target with more free space.
-
Default indicates that
To assign a target with free space, such as
/mnt/crash, edit the/etc/kdump.conffile and replace the default path:$ sed s/"path /var/crash"/"path /mnt/crash"The option path
/mnt/crashrepresents the path to the file system wherekdumpsaves the crash dump file.For details, such as writing the crash dump file to a different partition, directly to a device or storing it to a remote machine, see Configuring the kdump target.
Increase the crash kernel size to the sufficient size for
kdumpto capture thevmcoreby adding the relative boot parameter if the instance required:For example, for a Standard M416-208s v2 VM, the sufficient size is 512 MB, so the boot parameter would be
crashkernel=512M.Open the GRUB configuration file and add
crashkernel=512Mto the boot parameter line:# vi /etc/default/grub GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0 earlyprintk=ttyS0 rootdelay=300 crashkernel=512M"Update the GRUB configuration file:
# grub2-mkconfig -o /boot/grub2/grub.cfg --update-bls-cmdline
- Reboot the VM to allocate separate kernel crash memory to the VM.
Verification
Ensure that
kdumpis active and running.# systemctl status kdump ● kdump.service - Crash recovery kernel arming Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; vendor prese> Active: active (exited) since Fri 2024-02-09 10:50:18 CET; 1h 20min ago Process: 1252 ExecStart=/usr/bin/kdumpctl start (code=exited, status=0/SUCCES> Main PID: 1252 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 16975) Memory: 512B CGroup: /system.slice/kdump.service