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>
Under sudo, ssh reads root's config and keys, so a custom Port silently
disappears and the deploy fails with "connect to host ... port 22:
Connection refused". deploy.sh needs no root locally (install.sh runs
under sudo on each host), so it now refuses when run as root via sudo,
naming the user to run it as. A real root login is still allowed.
Deploying from a checkout behind its upstream ships an older agent than
the server expects, and the dashboard keeps saying "agent is older" after
a deploy that looked fine. deploy.sh now fetches the upstream (20s limit)
and, if the checkout is behind, asks on a terminal or refuses otherwise;
--allow-outdated deploys anyway and --dry-run only warns. A failed fetch
warns and carries on; no checkout or no upstream skips the check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kernelwatch-livepatch.service runs canonical-livepatch as root with no
network and a read-only filesystem, and a small python3 helper keeps the
running kernel's state, check state, support, end-of-support date and fix
count in /run/kernelwatch/livepatch. The agent (0.4.0) reads that file the
way it reads needrestart's and never runs the snap itself.
NoNewPrivileges=yes can't be used: snap-confine fails under it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The agent's dist-upgrade simulation already finds new-ABI kernels and
security updates, but only once apt's lists know about them. Debian
doesn't refresh lists by default, so a kernel security release could
stay invisible until someone ran apt update.
install.sh --with-apt-update adds a marker that enables
kernelwatch-apt-update.service, a sandboxed root oneshot the agent pulls
in before each report. Failures (no network, apt lock held) are ignored
so the report still goes out. deploy.sh now ships the unit; a test keeps
deploy.sh's file list in sync with what install.sh uses.
Agent 0.3.2, server 0.3.3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The matrix covers the Python versions on Ubuntu 22.04/24.04 and Debian
12/13. make lint now includes deploy.sh, and its token check is
rewritten as an if statement to satisfy shellcheck SC2015.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
needrestart has to inspect every process, which an unprivileged agent
can't (and unprivileged it gave false kernel results). Add
kernelwatch-needrestart.service: root with only CAP_SYS_PTRACE and
CAP_DAC_READ_SEARCH, PrivateNetwork=yes, list-only (-r l). It writes
`needrestart -b` output to /run/kernelwatch/needrestart; the agent unit
pulls it in before each report and reads the file (ignored if older than
2h). The agent no longer runs needrestart itself. Skipped cleanly when
needrestart isn't installed: the dashboard shows "?" and status is
unaffected.
Server: services_need_restart / sessions_need_restart fields, an
"update"-level reason, a Services column, and a note (not an escalation)
for hosts running an agent older than the one shipped with the server.
install.sh --with-needrestart installs needrestart and sets it to list
services after apt upgrades instead of prompting; deploy.sh passes
anything after `--` to install.sh. Agent 0.2.0, server 0.2.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run from a workstation checkout; hosts need no git or Gitea access.
A plain run upgrades every host in agent/hosts (config and token kept);
--register runs `kernelwatch add-host --token-only` on the dashboard
over SSH and hands the token to the host on stdin, never argv or the
terminal; --rotate does the same with rotate-token. Newly registered
hosts are appended to agent/hosts. Failures are summarised and don't
stop the rest of the fleet.
Supporting changes: install.sh --token-file, and --token-only on
`kernelwatch add-host` / `rotate-token`. Tested end to end with ssh and
sudo stubbed to run locally against the real CLI.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>