In this little article I'll show you how to disable NMI watchdog in Linux in 4 different ways.
Few application like CoreFreq needs to disable NMI watchdog for better accuracy and performance.
The word NMI stands for Non-maskable interrupt, it's a kind of non-recoverable hardware error, that the operating system can't ignore.
In Linux, these hardware related errors could freeze up the system and you've to reboot the system manually.
That's when NMI watchdog is useful. The watchdog timer is waiting for interrupts, if there's no interrupt received for a certain amount of time, it assumes that the system is locked up and initiates a reboot or kernel panic and generates a debug log. Lets explore the methods one by one.
ContentsShow / Hide
1. Temporarily disable NMI watchdog with sysctl command
It's very easy to disable NMI watchdog with the
sysctl command line tool.
sudo sysctl kernel.nmi_watchdog=0
If the command is successfully executed, it should return like below.
kernel.nmi_watchdog = 0
You can double check by running the
cat /proc/sys/kernel/nmi_watchdog command, it should return 0.
2. Disable NMI watchdog in Linux through procfs interface
The procfs is a special filesystem in Linux, used to get and manipulate various process and kernel related parameters.
It's accessible under the
/proc directory on most Linux distribution.
You can use the
echo command to set the
nmi_watchdog value to 0 , this command needs root privilege.
sudo -i # Login to a root shell echo '0' > /proc/sys/kernel/nmi_watchdog
There's other way to do the same thing,
sudo sh -c "echo '0' > /proc/sys/kernel/nmi_watchdog"
3. Permanently disable through the sysctl.conf file
If you want to permanently disable NMI watchdog, just add
kernel.nmi_watchdog=0 parameter to the end of the
A single line of command to do the job.
sudo sh -c "echo 'kernel.nmi_watchdog=0' >> /etc/sysctl.conf"
NMI watchdog will be disabled every time after next system reboot.
You can also run
sudo sysctl -p to disable it without rebooting.
4. Permanently disable NMI watchdog through boot parameter
There's another way to permanently disable it, we've to pass the
nmi_watchdog=0 boot time kernel parameter to kernel.
Almost every Linux system uses GRUB as bootloader, so this time it's only for GRUB.
It's easier to manage the boot flags through the
/etc/default/grub file in Debian or any Debian based distro like Ubuntu, Linux mint.
First edit the
/etc/default/grub file as root and then add
nmi_watchdog=0 to the line starting with GRUB_CMDLINE_LINUX_DEFAULT , after the
It should look like below,
GRUB_CMDLINE_LINUX_DEFAULT="quiet nmi_watchdog=0 other_parameters"
I used other_parameters just as example, don't use it in your configuration, a screenshot below.
After adding the kernel parameter, don't forget to update the GRUB.
Disabling the watchdog may lock up your system in a very very rare occasion. If you're lucky enough to experience such a moment, then just do a hard reboot, though that's not always possible.
So that's all about how to disable NMI watchdog Linux with command line tools, let us know your reasons for disabling it and which method you're using through the comments.