shutdown-debugging.rst 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. .. SPDX-License-Identifier: GPL-2.0
  2. Debugging Kernel Shutdown Hangs with pstore
  3. +++++++++++++++++++++++++++++++++++++++++++
  4. Overview
  5. ========
  6. If the system hangs while shutting down, the kernel logs may need to be
  7. retrieved to debug the issue.
  8. On systems that have a UART available, it is best to configure the kernel to use
  9. this UART for kernel console output.
  10. If a UART isn't available, the ``pstore`` subsystem provides a mechanism to
  11. persist this data across a system reset, allowing it to be retrieved on the next
  12. boot.
  13. Kernel Configuration
  14. ====================
  15. To enable ``pstore`` and enable saving kernel ring buffer logs, set the
  16. following kernel configuration options:
  17. * ``CONFIG_PSTORE=y``
  18. * ``CONFIG_PSTORE_CONSOLE=y``
  19. Additionally, enable a backend to store the data. Depending upon your platform
  20. some potential options include:
  21. * ``CONFIG_EFI_VARS_PSTORE=y``
  22. * ``CONFIG_PSTORE_RAM=y``
  23. * ``CONFIG_CHROMEOS_PSTORE=y``
  24. * ``CONFIG_PSTORE_BLK=y``
  25. Kernel Command-line Parameters
  26. ==============================
  27. Add these parameters to your kernel command line:
  28. * ``printk.always_kmsg_dump=Y``
  29. * Forces the kernel to dump the entire message buffer to pstore during
  30. shutdown
  31. * ``efi_pstore.pstore_disable=N``
  32. * For EFI-based systems, ensures the EFI backend is active
  33. Userspace Interaction and Log Retrieval
  34. =======================================
  35. On the next boot after a hang, pstore logs will be available in the pstore
  36. filesystem (``/sys/fs/pstore``) and can be retrieved by userspace.
  37. On systemd systems, the ``systemd-pstore`` service will help do the following:
  38. #. Locate pstore data in ``/sys/fs/pstore``
  39. #. Read and save it to ``/var/lib/systemd/pstore``
  40. #. Clear pstore data for the next event