Observe ZDNET: Add us as a most popular supply on Google.
ZDNET key takeaways
- In case your Linux system locks up, it’d want rebooting.
- With the assistance of a small software, this may be automated.
- Watchdog is straightforward to put in and free to make use of.
I’ve a number of Linux methods linked to my house lab; a few of them are desktops, and a few of them are servers. Ninety-nine p.c of the time, these machines work flawlessly. When that one p.c occurs, any machine that goes south wants assist.
A method of serving to is by way of a small software program package deal referred to as Watchdog. This piece of software program runs varied checks to see if the {hardware} has “locked up.” If it detects that it has occurred, it’ll reboot the machine.
Additionally: 6 causes a minimal Linux set up could be the neatest transfer you make
There are two sorts of Watchdogs: software program and {hardware}. The {hardware} Watchdog is way more dependable, nevertheless it requires specialty {hardware} for it to work. The software program Watchdog is not fairly as dependable, nevertheless it works on most Linux methods.
How Watchdog works
A kernel module (softdog), along with the Watchdog service, watches the system with a countdown timer.
- A digital machine is created (/dev/watchdog).
- If the digital machine is “kicked” by a course of, the timer resets.
- If the digital machine is not “kicked” by a course of, Watchdog reboots the system.
It is easy in idea, however the underpinnings are way more sophisticated. Thankfully, as a person, you do not have to dig too deeply to get the gist of Watchdog.
Additionally: The primary 8 Linux instructions each new person ought to study
Though Watchdog will be important for servers (particularly these that do not have a monitor, keyboard, or mouse linked), it can be helpful for desktops. For instance, say that you must log right into a Linux machine on your own home community from work. If that machine locks up, you will not be capable to entry it. If that machine has Watchdog conserving tabs on it, it’s going to reboot, and you’ll entry it.
This may be very useful.
You would possibly assume Watchdog is tough to arrange, however you will be stunned that it isn’t that a lot of a problem, even when you’re simply beginning out with Linux.
Additionally: My 5 go-to Linux instructions for troubleshooting – and the way I exploit them
Let me present you the way it’s carried out.
Find out how to set up Watchdog
What you will want: I will exhibit this on a machine working Ubuntu 24.04. Watchdog is present in the usual Ubuntu repositories (in addition to the Fedora normal repositories). For Arch customers, it’s a must to use yay to put in this software program. You may additionally want a person with sudo privileges.
The very first thing to do is set up Watchdog, which will be carried out with the command:
Present extra
sudo apt-get set up watchdog -y
When you’re utilizing a Fedora-based machine, the command is:
sudo dnf set up watchdog -y
For Arch, it is:
yay -S watchdog
With Watchdog put in, you then need to load the softdog kernel module, which is completed with:
Present extra
sudo modprobe softdog
Confirm the module has loaded with:
lsmod | grep softdog
When you see softdog listed, then it is efficiently loaded.
Additionally: One of the best Linux laptops in 2026: Knowledgeable examined for college kids, hobbyists, and execs
Verify to ensure the machine node exists with:
ls -la /dev/watchdog
You may additionally have to have the Watchdog kernel module loaded at boot. When you do not do that, the service will not be working after a reboot (so it will not be watching the system). That is carried out with:
Present extra
Be sure to kind this command accurately.
Jack WallenZDNET
You are now able to configure Watchdog.
Find out how to configure Watchdog
With Watchdog working, you will wish to make certain the configuration file is ready up such that it will truly do what it is purported to do when it ought to. That is carried out by the use of a configuration file. Open that file with the command:
sudo nano /and many others/watchdog.conf
In that file, search for the next strains (they don’t seem to be discovered consecutively within the file):
# watchdog-device = /dev/watchdog
# interval = 1
# watchdog-timeout = 20 # Time in seconds earlier than reboot
# realtime = sure
# precedence = 1
# max-load-1 = 24
# max-load-5 = 18
# max-load-15 = 12
# min-memory = 1
What that you must do is take away the # and the house earlier than every line. Observe: When you do not see the watchdog-timeout = 20 line, manually add it.
Save and shut the file.
You may then want to start out and allow the service with the command:
sudo systemctl allow –now watchdog
Watchdog is now working within the background and can do its factor, ought to one thing go awry.
Additionally: You need to use Linux 7.0 on these 7 distros at the moment – this is what to anticipate
If you wish to check whether or not or not Watchdog is working, you’ll be able to manually trigger a kernel panic with the next three instructions:
sudo sysctl -w kernel.sysrq=1
sudo su –
echo c > /proc/sysrq-trigger
The system will change into unresponsive, and Watchdog ought to reboot it.
The {hardware} technique
When you occur to have a {hardware} watchdog, systemd will be configured to kick it and enact a reboot. This is the way you configure this.
Open the systemd config file with:
sudo nano /and many others/systemd/system.conf
Find the next strains:
#RuntimeWatchdogSec=0
#RebootWatchdogSec=10min
#WatchdogDevice=
Change these strains to:
RuntimeWatchdogSec=30
RebootWatchdogSec=10min
WatchdogDevice=/dev/watchdog
Save and shut the file.
Additionally: My confirmed method to velocity up Linux when RAM upgrades aren’t value it (and it is free to do)
Restart the systemd daemon with:
sudo systemctl daemon-reload
And there you’ve got it. You now have a service watching your system and can reboot it, ought to issues go south.



