Linux Kernel Watchdog Explained

Chưa phân loại

Linux Kernel Watchdog

The Linux kernel watchdog is used to monitor if a system is running. It is supposed to automatically reboot hanged systems due to unrecoverable software errors. The watchdog module is specific to the hardware or chip being used. Personal computer users don’t need watchdog as they can reset the system manually. However, it is useful for systems that are mission critical and need the ability to reboot themselves without human intervention. For example, servers on a remote location or embedded equipment on a spacecraft that need automatic hardware reset capabilities.

Warning: Proceed with Caution

Wrong configurations of a watchdog on your system can cause problems like:

  • Endless reboot loop
  • File corruption due to hard reset
  • Unpredictable random reboots

So avoid using live servers to test Linux kernel watchdog.

Watchdog Module

Watchdog functionality on the hardware side sets up a timer that times out after a predetermined period. The watchdog software then periodically refreshes the hardware timer. If the software stops refreshing, then after the predetermined period, the timer performs a hardware reset of the device. In order for a watchdog timer to be functional, the motherboard manufacturer has to use the chip’s watchdog functionality. Often the documentation from the manufacturer is not clear about whether the functionality was implemented. In that case, you have to test it out.

Also, you need the right watchdog kernel module to be loaded in your Linux system. Different chips use different modules. For example:

  • Intel chipsets might use the “iTCO_wdt” module
  • HP hardware might use “hpwdt”
  • IBM mainframes might use “vmwatchdog”
  • Xen VM might use “xen_wdt”

After the module is loaded, you can check /dev/watchdog on the Linux system. If this file is present, that means the watchdog kernel device driver or module was loaded. The system periodically keeps writing to /dev/watchdog. It is also called “kicking or feeding the watchdog”. If the system fails to kick or feed the watchdog, then after a while the system is hard reset.

Watchdog Daemon

The watchdog daemon opens the device and provides the necessary refresh to keep the system from resetting. It can test process table space, memory usage, file accessibility, work overload, file table overflow, IP address ping, network interface traffic, temperature, running processes and more. If the tests fail, then watchdog causes a shutdown.

Starting and Stopping Watchdog

Watchdog daemon should start at boot time and put itself in the background. You can check if it is running:

ps -af | grep watch*

If the kernel is NOT compiled with CONFIG_WATCHDOG_NOWAYOUT, then if you close the /dev/watchdog properly, it will not cause a reboot. You can write the character V into /dev/watchdog and then close the file. This should stop the watchdog.

Testing the Watchdog

If you want to test if the hardware watchdog is working, you can do the following from your administrator command prompt:

cat >> /dev/watchdog

And press “enter” twice and wait. The prompt will not come back. After awhile depending on your kernel’s setting, the system should perform the hard reboot.


ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Install Jenkins on CentOS7

Jenkins is a java based open source Continuous Integration (CI) tool used for software development. It is also called automation...

PHP Server Side Charts Tutorial

A very common requirement of business websites is creating charts based on the collected data of the website to find out...

Linux Kernel in Windows 10

How does the new Windows Subsystem for Linux (v2) works? Microsoft recently announced that they will soon be shipping a...
Bài Viết

Bài Viết Mới Cập Nhật


Mua Proxy v6 US Private chạy PRE, Face, Insta, Gmail

Mua shadowsocks và hướng dẫn sữ dụng trên window

Tại sao Proxy Socks lại được ưa chuộng hơn Proxy HTTP?

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo