How To Install watchdog on Ubuntu 18.04

In this tutorial we learn how to install watchdog on Ubuntu 18.04. watchdog is system health checker and software/hardware watchdog handler

Introduction

In this tutorial we learn how to install watchdog on Ubuntu 18.04.

What is watchdog

watchdog is:

The watchdog program writes to /dev/watchdog every ten seconds. If the device is opened but not written to within a minute, the machine will reboot. This feature is available when the kernel is built with “software watchdog” support (standard in Debian kernels) or if the machine is equipped with a hardware watchdog (in which case this package can also be used to “pet” it, resetting its timer).

The kernel software watchdog’s ability to reboot will depend on the state of the machine and interrupts.

The watchdog tool itself runs several health checks and acts appropriately if the system is not in good shape.

There are three methods to install watchdog on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install watchdog Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install watchdog using apt-get by running the following command:

sudo apt-get -y install watchdog

Install watchdog Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install watchdog using apt by running the following command:

sudo apt -y install watchdog

Install watchdog Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install watchdog using aptitude by running the following command:

sudo aptitude -y install watchdog

How To Uninstall watchdog on Ubuntu 18.04

To uninstall only the watchdog package we can use the following command:

sudo apt-get remove watchdog

Uninstall watchdog And Its Dependencies

To uninstall watchdog and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove watchdog

Remove watchdog Configurations and Data

To remove watchdog configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge watchdog

Remove watchdog configuration, data, and all of its dependencies

We can use the following command to remove watchdog configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge watchdog

References

Summary

In this tutorial we learn how to install watchdog package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.