How To Install conmon on Ubuntu 20.04

In this tutorial we learn how to install conmon on Ubuntu 20.04. conmon is OCI container runtime monitor

Introduction

In this tutorial we learn how to install conmon on Ubuntu 20.04.

What is conmon

conmon is:

Conmon is a monitoring program and communication tool between a container manager (like podman or CRI-O) and an OCI runtime (like runc or crun) for a single container.

Upon being launched, it double-forks to daemonize and detach from the parent that launched it. It then launches the runtime as its child. This allows managing processes to die in the foreground, but still be able to watch over and connect to the child process (the container).

While the container runs, conmon does two things:

  • Provides a socket for attaching to the container, holding open the container’s standard streams and forwarding them over the socket.
  • Writes the contents of the container’s streams to a log file (or to the systemd journal) so they can be read after the container’s death.

Finally, upon the containers death, conmon will record its exit time and code to be read by the managing programs.

Written in C and designed to have a low memory footprint, conmon is intended to be run by a container managing library. Essentially, conmon is the smallest daemon a container can have.

There are three methods to install conmon on Ubuntu 20.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 conmon Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install conmon

Install conmon Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install conmon

Install conmon 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 conmon using aptitude by running the following command:

sudo aptitude -y install conmon

How To Uninstall conmon on Ubuntu 20.04

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

sudo apt-get remove conmon

Uninstall conmon And Its Dependencies

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

sudo apt-get -y autoremove conmon

Remove conmon Configurations and Data

To remove conmon configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge conmon

Remove conmon configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge conmon

References

Summary

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