Troubleshooting operating system issues

OKD runs on FCOS. You can follow these procedures to troubleshoot problems related to the operating system.

Investigating kernel crashes

Enabling kdump

The kdump service, included in kexec-tools, provides a crash-dumping mechanism. You can use this service to save the contents of the system’s memory for later analysis.

The kdump service is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see https://access.redhat.com/support/offerings/techpreview/.

FCOS ships with kexec-tools, but manual configuration is required to enable kdump.

Procedure

Perform the following steps to enable kdump on FCOS.

  1. To reserve memory for the crash kernel during the first kernel booting, provide kernel arguments by entering the following command:

    1. # rpm-ostree kargs --append='crashkernel=256M'
  2. Optional: To write the crash dump over the network or to some other location, rather than to the default local /var/crash location, edit the /etc/kdump.conf configuration file.

    Network dumps are required when using LUKS. kdump does not support local crash dumps on LUKS-encrypted devices.

    For details on configuring the kdump service, see the comments in /etc/sysconfig/kdump, /etc/kdump.conf, and the kdump.conf manual page.

  3. Enable the kdump systemd service.

    1. # systemctl enable kdump.service
  4. Reboot your system.

    1. # systemctl reboot
  5. Ensure that kdump has loaded a crash kernel by checking that the kdump.service has started and exited successfully and that cat /sys/kernel/kexec_crash_loaded prints 1.

Enabling kdump on day-1

The kdump service is intended to be enabled per node to debug kernel problems. Because there are costs to having kdump enabled, and these costs accumulate with each additional kdump-enabled node, it is recommended that kdump only be enabled on each node as needed. Potential costs of enabling kdump on each node include:

  • Less available RAM due to memory being reserved for the crash kernel.

  • Node unavailability while the kernel is dumping the core.

  • Additional storage space being used to store the crash dumps.

  • Not being production-ready because the kdump service is in Technology Preview.

If you are aware of the downsides and trade-offs of having the kdump service enabled, it is possible to enable kdump in a cluster-wide fashion. Although machine-specific machine configs are not yet supported, you can perform the previous steps through a systemd unit in a MachineConfig object on day-1 and have kdump enabled on all nodes in the cluster. You can create a MachineConfig object and inject that object into the set of manifest files used by Ignition during cluster setup. See “Customizing nodes” in the Installing → Installation configuration section for more information and examples on how to use Ignition configs.

Procedure

Create a MachineConfig object for cluster-wide configuration:

  1. Optional: If you change the /etc/kdump.conf configuration from the default, you can encode it into base64 format to include its content in your MachineConfig object:

    1. $ cat << EOF | base64
    2. path /var/crash
    3. core_collector makedumpfile -l --message-level 7 -d 31
    4. EOF
  2. Optional: Create a content of the /etc/sysconfig/kdump file and encode it as base64 if you change the configuration from the default:

    1. $ cat << EOF | base64
    2. KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
    3. KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr novmcoredd hest_disable"
    4. KEXEC_ARGS="-s"
    5. KDUMP_IMG="vmlinuz"
    6. EOF
  3. Create the MachineConfig object file:

    1. $ cat << EOF > ./99-master-kdump-configuration.yaml
    2. apiVersion: machineconfiguration.openshift.io/v1
    3. kind: MachineConfig
    4. metadata:
    5. labels:
    6. machineconfiguration.openshift.io/role: master (1)
    7. name: 99-master-kdump-configuration
    8. spec:
    9. kernelArguments:
    10. - 'crashkernel=256M' (2)
    11. config:
    12. ignition:
    13. version: 3.2.0
    14. storage:
    15. files:
    16. - contents:
    17. source: data:text/plain;charset=utf-8;base64,ICAgIHBhdGggL3Zhci9jcmFzaAogICAgY2... (3)
    18. mode: 420
    19. overwrite: true
    20. path: /etc/kdump.conf
    21. - contents:
    22. source: data:text/plain;charset=utf-8;base64,S0RVTVBfQ09NTUFORExJTkVfUkVNT1ZFPS... (4)
    23. mode: 420
    24. overwrite: true
    25. path: /etc/sysconfig/kdump
    26. systemd:
    27. units:
    28. - enabled: true
    29. name: kdump.service
    30. EOF
    1Replace master with worker for creating a MachineConfig object for the worker role.
    2Provide kernel arguments to reserve memory for the crash kernel. You can add other kernel arguments if necessary.
    3Replace the base64 content with the one you created for /etc/kdump.conf.
    4Replace the base64 content with the one you created for /etc/sysconfig/kdump.
  4. Put the YAML file into manifests during cluster setup. You can also create this MachineConfig object after cluster setup with the YAML file:

    1. $ oc create -f ./99-master-kdump-configuration.yaml

Testing the kdump configuration

See the Capturing the Dump section in the Fedora documentation for kdump.

Analyzing a core dump

See the Dump Analysis section in the Fedora documentation for kdump.

Additional resources