Linux Kernel Watchdog Explained

28/12/2020
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.

References:

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

PHP Explode Tutorial

PHP is one of the powerful website development tools that contains various built-in functions for various purposes. explode()...
28/12/2020

Jitsi [Part 4] – Hướng dẫn các thao tác sử dụng trong phòng họp trực tuyến

Trong bài viết trước, Onet đã hướng dẫn cách tạo và thiết lập cơ bản cho phòng họp trên Jitsi. Hôm...
30/12/2020

BurpSuite Tutorial for Beginners

BurpSuite is a collection of tools to carry out pen testing or security auditing.  This tutorial focuses on the Community...
29/12/2020
Bài Viết

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

Reliable IPv4 and IPv6 Subnet Rental Services: The Perfect Solution for Global Businesses
23/12/2024

Tìm Hiểu Về Thuê Proxy US – Lợi Ích và Cách Sử Dụng Hiệu Quả
11/12/2024

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024