Configuring Kernel Parameters
If some deadlocks occur in the kernel, the system does not restart but stops responding. In this case, a kernel panic does not occur. You need to create conditions to make the kernel panic so that a vmcore file can be generated.
You can force a kernel panic as follows:
- Trigger a kernel panic when a process is suspended.
1echo 1 > /proc/sys/kernel/hung_task_panic
- Trigger a kernel panic n seconds after a hung task occurs (60s is used as an example in this command).
1echo 60 > /proc/sys/kernel/hung_task_timeout_secs
- Trigger a kernel panic when a soft lockup is generated.
1echo 1 > /proc/sys/kernel/softlockup_panic
- Trigger a kernel panic when an out of memory (OOM) error occurs.
1echo 1 > /proc/sys/vm/panic_on_oom
- Trigger a kernel panic when an alarm is generated in the kernel.
1echo 1 > /proc/sys/kernel/panic_on_warn
The configurations modified by running the preceding commands take effect temporarily and become invalid after a system restart. To enable automatic configuration upon restart, do as follows:
- Edit the etc/sysctl.conf file.
1vim etc/sysctl.confEnter the following information:
If kernel.panic_on_warn is set to 1, the system is forced to crash and the kdump mechanism is triggered when an alarm is generated in the kernel. If an alarm is generated when the system is being started, the system fails to be started up. Therefore, enable this option only when necessary.
1 2 3 4 5
kernel.hung_task_panic=1 kernel.hung_task_timeout_secs=60 kernel.softlockup_panic=1 vm.panic_on_oom=1 kernel.panic_on_warn=1
- Make the configuration take effect.
1sysctl -p