惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
G
Google Developers Blog
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
小众软件
小众软件
月光博客
月光博客
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理
P
Proofpoint News Feed
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
The Cloudflare Blog
博客园_首页
美团技术团队
大猫的无限游戏
大猫的无限游戏
B
Blog
IT之家
IT之家
Jina AI
Jina AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

Latest news

LG G6 vs. LG G5: I compared the latest OLED TV models, and it's a surprisingly tough choice I saw the 'MacBook Pro for Linux users' for the first time, and it's a legit Windows threat I tested Surfshark's new Dausos VPN protocol - here's how it compares to WireGuard How to easily encrypt your files on an Android phone - for free I'm not giving up on DJI cameras yet - not when they can upset my GoPro like this The best website builders for small businesses in 2026: Expert tested and reviewed Why I'm recommending last year's phones over 2026 models - with one exception This powerful Gemini setting made my AI results way more personal and accurate After testing this HP laptop, I get why its 'boring' design is adored by business users The best TV antenna of 2026: Expert tested Your old iPad or Android tablet can be your new smart home panel - here's how Apple's original AirTag still tracks effectively, and you can get a 4-pack for its best price ever T-Mobile will give you an iPad for $99 when you sign up for a new line - here's how How to qualify for Apple's education discount - and get a $499 MacBook Neo for school T-Mobile will give you a Samsung Galaxy Watch 8 for free - how to get yours Prolonged AI use can be hazardous to your health and work: 4 ways to stay safe Verizon will give you a free iPad or Apple Watch with your next iPhone - how the deal works The best laptops of 2026: Expert tested and reviewed I hid 4 Bluetooth trackers (including AirTags) to test their reliability - here's how Android rivals compared I stopped using my iPhone's hotspot after testing this 5G router - and that won't change The best Kindles in 2026: Expert recommended Does Best Buy price match? Everything to know about matching prices online and in-store The best WordPress hosting services of 2026: Expert tested and reviewed The best Apple Watch of 2026: Expert tested and reviewed The best TV screen cleaners of 2026: Expert recommended The best 50-inch TVs of 2026: Expert tested I traded my Sonos Era 300 for Denon's new home speaker - and see no reason to go back AI-powered website builders have come a long way - here's your best option in 2026 Amazon just slashed $250 off the Google Pixel 10 - and a Prime subscription isn't required I found the apps slowing down my PC - how to kill the biggest memory hogs
I set up this Linux 'Watchdog' and now my system auto-reb...
2026-04-22 · via Latest news
3d rendering of a futuristic mechanical dog stuffed toy in a dark black background with a effect of boom for the purpose of advertisement and commercial use
AssasinatorCzar via iStock / Getty Images Plus

Follow ZDNET: Add us as a preferred source on Google.


ZDNET key takeaways

  • If your Linux system locks up, it might need rebooting.
  • With the help of a small application, this can be automated.
  • Watchdog is easy to install and free to use.

I have several Linux systems connected to my home lab; some of them are desktops, and some of them are servers. Ninety-nine percent of the time, those machines work flawlessly. When that one percent happens, any machine that goes south needs help.

One way of helping is via a small software package called Watchdog. This piece of software runs various checks to see if the hardware has "locked up." If it detects that it has happened, it will reboot the machine.

Also: 6 reasons a minimal Linux install might be the smartest move you make

There are two types of Watchdogs: software and hardware. The hardware Watchdog is much more reliable, but it requires specialty hardware for it to work. The software Watchdog isn't quite as reliable, but it works on most Linux systems.

How Watchdog works

A kernel module (softdog), in conjunction with the Watchdog service, watches the system with a countdown timer.

  • A virtual device is created (/dev/watchdog).
  • If the virtual device is "kicked" by a process, the timer resets.
  • If the virtual device isn't "kicked" by a process, Watchdog reboots the system.

It's simple in theory, but the underpinnings are much more complicated. Fortunately, as a user, you don't have to dig too deeply to get the gist of Watchdog.

Also: The first 8 Linux commands every new user should learn

Although Watchdog can be essential for servers (especially those that don't have a monitor, keyboard, or mouse connected), it can also be useful for desktops. For example, say you need to log into a Linux machine on your home network from work. If that machine locks up, you won't be able to access it. If that machine has Watchdog keeping tabs on it, it'll reboot, and you'll be able to access it.

This can be very handy.

You might think Watchdog is hard to set up, but you'll be surprised that it's not that much of a challenge, even if you're just starting out with Linux.

Also: My 5 go-to Linux commands for troubleshooting - and how I use them

Let me show you how it's done.

How to install Watchdog

What you'll need: I'm going to demonstrate this on a machine running Ubuntu 24.04. Watchdog is found in the standard Ubuntu repositories (as well as the Fedora standard repositories). For Arch users, you have to use yay to install this software. You'll also need a user with sudo privileges.

The first thing to do is install Watchdog, which can be done with the command:

Show more

sudo apt-get install watchdog -y

If you're using a Fedora-based machine, the command is:

sudo dnf install watchdog -y

For Arch, it's:

yay -S watchdog

With Watchdog installed, you then have to load the softdog kernel module, which is done with:

Show more

sudo modprobe softdog

Verify the module has loaded with:

lsmod | grep softdog

If you see softdog listed, then it's successfully loaded.

Also: The best Linux laptops in 2026: Expert tested for students, hobbyists, and pros

Check to make sure the device node exists with:

ls -la /dev/watchdog

You'll also need to have the Watchdog kernel module loaded at boot. If you don't do this, the service won't be running after a reboot (so it won't be watching the system). This is done with:

Show more

Watchdog

Make sure to type this command correctly.

Jack Wallen\ZDNET

You're now ready to configure Watchdog.

How to configure Watchdog

With Watchdog running, you'll want to make sure the configuration file is set up such that it'll actually do what it's supposed to do when it should. This is done by way of a configuration file. Open that file with the command:

sudo nano /etc/watchdog.conf

In that file, look for the following lines (they are not found consecutively in the file):

# watchdog-device = /dev/watchdog

# interval = 1

# watchdog-timeout = 20 # Time in seconds before reboot

# realtime = yes

# priority = 1

# max-load-1 = 24

# max-load-5 = 18

# max-load-15 = 12

# min-memory = 1

What you need to do is remove the # and the space before each line. Note: If you don't see the watchdog-timeout = 20 line, manually add it.

Save and close the file.

You'll then need to start and enable the service with the command:

sudo systemctl enable --now watchdog

Watchdog is now running in the background and will do its thing, should something go awry.

Also: You can use Linux 7.0 on these 7 distros today - here's what to expect

If you want to test whether or not Watchdog is working, you can manually cause a kernel panic with the following three commands:

sudo sysctl -w kernel.sysrq=1

sudo su -

echo c > /proc/sysrq-trigger

The system will become unresponsive, and Watchdog should reboot it.

The hardware method

If you happen to have a hardware watchdog, systemd can be configured to kick it and enact a reboot. Here's how you configure this.

Open the systemd config file with:

sudo nano /etc/systemd/system.conf

Locate the following lines:

#RuntimeWatchdogSec=0

#RebootWatchdogSec=10min

#WatchdogDevice=

Change those lines to:

RuntimeWatchdogSec=30

RebootWatchdogSec=10min

WatchdogDevice=/dev/watchdog

Save and close the file.

Also: My proven way to speed up Linux when RAM upgrades aren't worth it (and it's free to do)

Restart the systemd daemon with:

sudo systemctl daemon-reload

And there you have it. You now have a service watching your system and will reboot it, should things go south.