patrickandClaude Opus 5.5 f88261d2f5 Report when kernelwatch's own helper units keep failing
kernelwatch-apt-update.service failed hourly on most hosts for weeks
without anything showing it. The agent only Wants= its helper units, so
the report goes out regardless, with stale lists or (for needrestart)
results that quietly turn "unknown".

Each helper (apt-update, needrestart) now runs kernelwatch-unit-result
as its ExecStopPost=, which systemd runs after failed runs too. It
writes "RESULT EXIT_CODE EXIT_STATUS FAILURES" to
/run/kernelwatch/<name>.result, FAILURES counting failed runs in a row.
The agent (0.10.0) reports results from the last two hours as
helper_units. On the server, one or two failures are a note (an admin's
apt can hold the lock now and then); three in a row put the host in
update, naming the unit and its exit status and pointing at journalctl.
The host page gets a "kernelwatch helpers" row.

The Livepatch unit isn't tracked: it fails by design where the snap is
installed but Livepatch isn't enabled, and Livepatch has its own check.

The apt-update unit now has RuntimeDirectory=kernelwatch (preserved,
like the others) for its result file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 15:23:05 -05:00

kernelwatch

A small, self-hosted dashboard that shows whether each machine in a Debian/Ubuntu fleet is running its newest kernel, has updates waiting, or needs a reboot.

  • Agent: a bash script run hourly by a systemd timer on each host. It collects facts and POSTs them as JSON. It runs no daemon and listens on no port.
  • Server: a standard-library Python app with SQLite. It has a token-authenticated ingest API and a login-protected dashboard. You don't need pip, a venv or a build step.

Supported: agents on Debian 12/13 and Ubuntu 22.04/24.04/26.04 LTS; server on Debian 12+ or Ubuntu 22.04+ (the system python3, 3.10 or newer).

 host ──(systemd timer)── kernelwatch-agent ──HTTPS POST /api/v1/report──┐
 host ──(systemd timer)── kernelwatch-agent ─────────────────────────────┤
                                                                         ▼
                              browser ──HTTPS──▶ Caddy/nginx ──▶ kernelwatch (127.0.0.1:8080) ──▶ SQLite

It's read-only by design: the server can't make hosts do anything.

What you see

Each host gets one status. When several apply, the worst one wins:

Status Meaning
stale No report in stale_after_hours (default 3h), or never. Other data can't be trusted.
reboot A newer kernel is installed but not running, or /run/reboot-required exists.
update A kernel or security update is available but not installed, services are running outdated libraries and need a restart, or apt's package lists are too old, or apt itself fails, so "no updates" can't be trusted. Also when /boot is too full for the next kernel, dpkg left packages half-installed, the OS release no longer gets security updates, or unattended-upgrades is enabled but has stopped succeeding.
ok Running the newest installed kernel, with no security or kernel updates pending.

Each row lists the reasons behind its status, and clicking a host shows its full report and recent history. How it works explains how the agent works each of these out (kernel comparison, needrestart, Ubuntu Livepatch, phased updates, package list freshness).

Quick start

1. Install the server on the dashboard host:

git clone <this repo> && cd kernel-automation
sudo ./server/install.sh
sudo kernelwatch set-password admin     # dashboard login

It listens on plain HTTP on 127.0.0.1:8080. Put a TLS reverse proxy in front; Reverse proxy and access control has Caddy, nginx, CloudPanel and Authelia setups.

2. Add a host. On the server, sudo kernelwatch add-host web01 prints a token (shown once). Then on the host:

sudo ./agent/install.sh --server https://kernelwatch.example.internal
# paste the token when prompted

or, for many hosts at once, from your workstation over SSH (after a one-time agent/deploy.conf, see Agents):

agent/deploy.sh --register web01 db01

Agents also covers the options (private CA, needrestart, apt update, reporting under a different name) and for upgrading the fleet.

3. Set up alerts and backups (recommended): Alerts and monitoring covers ntfy notifications and the heartbeat that tells you if kernelwatch itself stops. Operations covers nightly backups.

Documentation

Page What's in it
How it works Status rules and how the agent collects each fact
Server Installing and upgrading, the admin commands
Reverse proxy and access control TLS with Caddy or nginx, CloudPanel, Authelia
Agents Adding hosts, agent/deploy.sh, agent options
Alerts and monitoring ntfy alerts for stale, reboot and update, heartbeat monitoring
Operations kernelwatch status --json for scripts, backups and restore
Security notes How tokens, sandboxing and the dashboard are locked down
Development Running the tests, a local server, ideas for later
S
Description
No description provided
Readme
1.1 MiB
0 Stars 0 Watchers 0 Forks
Languages
Python 88%
Shell 11.9%