This topic describes the causes and solutions for the abnormal restarts after you set the kernel parameter kernel.unknown_nmi_panic.
Problem description
After you set the kernel parameter kernel.unknown_nmi_panic on a Linux Elastic Compute Service (ECS) instance, the instance restarts abnormally. Once the system recovers, the kernel log shows the following call stack information:
[5912557.130943] Uhhuh. NMI received for unknown reason 20 on CPU 0.
[5912557.131115] Do you have a strange power saving mode enabled?
[5912557.131287] Kernel panic - not syncing: NMI: Not continuingCause
The issue arises after the kernel parameter kernel.unknown_nmi_panic is set to 1. It leads to a kernel panic when the kernel receives an unknown Non-Maskable Interrupt (NMI), which causes the instance to restart.
The kernel parameter kernel.unknown_nmi_panic controls the behavior of the kernel when it encounters an unknown NMI. The value of kernel.unknown_nmi_panic is set to 0 on most Linux distributions, which means any unknown NMI is ignored.
kernel.unknown_nmi_panic = 1: The kernel will consider a system error and trigger a kernel panic when it encounters an unknown NMI, causing unexpected instance restarts or service interruptions.kernel.unknown_nmi_panic = 0: The issue is ignored without further action, and the instance continues running in its current state.
Solution
For solution, you can set the kernel parameter kernel.unknown_nmi_panic to 0 to ignore unknown NMIs.
Log on to the ECS instance.
For more information, see Connect to a Linux instance by using a password or key.
Run the following command to check whether any configurations are related to the kernel parameter
kernel.unknown_nmi_panic.grep 'kernel.unknown_nmi_panic' /etc/sysctl.conf /etc/sysctl.d/*.confIf related configurations exist, delete the redundant configurations and keep only one entry in the
/etc/sysctl.conffile. Set it tokernel.unknown_nmi_panic = 0.If no related configuration exists, run the following commands to add
kernel.unknown_nmi_panic = 0to the end of the/etc/sysctl.conffile:sudo sh -c "echo >> /etc/sysctl.conf" sudo sh -c "echo 'kernel.unknown_nmi_panic = 0' >> /etc/sysctl.conf"
Run the following command to apply the configuration in the current environment:
sudo sysctl -pNoteIf you want to modify the kernel parameter without reloading the kernel parameter configuration file, run the command
sysctl -w kernel.unknown_nmi_panic=0to change the value of the kernel parameterkernel.unknown_nmi_panicto0.