apt touches /var/lib/apt/lists/partial on every update attempt,
including ones that fail, and the agent took the newest of it and the
two success stamps. So a host whose apt update failed hourly reported
lists an hour old. Use the success stamps (update-success-stamp,
update-stamp) and fall back to lists/partial only when neither exists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The agent now sends whether unattended-upgrades is enabled (package
installed, not just its leftover config, and APT::Periodic::Unattended-
Upgrade set and non-zero), the age of apt.systemd.daily's upgrade-stamp
(touched only when unattended-upgrade exits 0), the age of
unattended-upgrade's own stamp (written whenever a run gets far enough,
even if it then fails) and the packages it keeps back. Nothing reads them
yet. Agent 0.8.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Past its end of support a release gets no more security updates, so apt
offers nothing and the host showed ok indefinitely. The server now has a
table of when free security support ends for each release the agent
installs on (support.py): Debian's LTS end, and Ubuntu's end of standard
support plus end of ESM. Dates from Debian LTS and Ubuntu's release cycle
via endoflife.date; a test checks the table covers every release
agent/install.sh accepts.
The agent reports whether Ubuntu Pro is attached and esm-infra's status,
read from the pro client's world-readable status.json. A host past its
date goes to update; within os_eol_warn_days (default 90) of it, the row
gets a note. An Ubuntu host with ESM enabled isn't warned when standard
support ends, only before ESM does. The host page shows the dates.
Agent 0.7.0; older agents don't report ESM and count as having none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A full /boot makes the next kernel's postinst fail: apt is left half-done
and the host quietly stays on its old kernel, which kernelwatch only
noticed indirectly, if at all. The agent now reports the size and free
space of the filesystem holding /boot (df) and the packages dpkg didn't
finish installing (half-installed, unpacked, half-configured, trigger
states or reinst-required, as dpkg --audit counts them).
The server puts a host in update when /boot has less than
boot_min_free_mb (default 200, 0 disables) free, or any package is
unfinished, with the fix in the reason ("run dpkg --configure -a"). The
host page shows both. Agents before 0.6.0 send neither field and are
judged as before. Agent 0.6.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The agent ran `apt-get -s dist-upgrade 2>/dev/null || true`, so when apt
failed (unmet dependencies, a broken sources entry, a damaged package cache)
the empty output counted as zero updates and the host could show ok while
nothing could be installed. The agent now keeps apt's exit status and stderr,
reports apt_simulation_ok and the first "E:" line as apt_simulation_error,
and sends the update counts as null. The server puts such a host in update
with "apt can't work out pending updates: ...", and the host page shows the
result. Agents before 0.5.0 don't send the field and are judged as before.
Also show "–" rather than "None" for an unknown count in a host's history,
and stop hard-coding the agent version in the status CLI tests. Agent 0.5.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
REPORT_HOSTNAME in agent.conf replaces hostname -f in the report, for hosts
registered under a label that differs from their real hostname (otherwise the
dashboard notes a mismatch forever). install.sh --report-hostname NAME sets it,
--default-report-hostname clears it, and re-running with --server (register,
rotate) keeps it. Agent 0.4.1.
Co-Authored-By: Claude Sonnet 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>
apt skips phasing in chroots, which it detects by running
`ischroot -t`. ischroot compares / with /proc/1/root; the agent's
DynamicUser can't read /proc/1/root, so ischroot answers "chroot"
(-t = assume yes when unsure) and apt offered every phased update.
On a real 26.04 host, 4 updates apt deferred as root were reported as
installable, with 0 phased.
Pass -o Dir::Bin::ischroot=/bin/false so apt applies phasing from
/etc/machine-id exactly as it does for root. Agent 0.3.1, server 0.3.2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
apt lists updates deferred by phasing in an indented block rather than
as Inst lines, so they were already excluded from the counts but
invisible. The agent now parses that block into phased_packages; the
dashboard shows "+N phased" in the Updates column (with a tooltip) and
the list on the host page. Phasing never affects status: Ubuntu doesn't
phase security updates, and there's nothing to act on until apt offers
the update.
Run the apt simulation with LC_ALL=C since we parse its messages (the
systemd unit already runs in the C locale; manual --print may not).
Agent and server 0.3.0.
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>
The agent ran as (capability-less) root only so needrestart could read
Ubuntu's root-only /boot images. Switch the unit to DynamicUser=yes and
make needrestart optional.
To cover the case needrestart was catching (running kernel's package
upgraded in place, same uname -r), the agent now reports the installed
package version of the running kernel and the server compares it with
the build in uname -v: "Debian 6.12.57-1" vs 6.12.57-1 on Debian,
"#85-Ubuntu" / "#33~24.04.1-Ubuntu" vs the upload part of 6.8.0-85.85 /
6.14.0-33.33~24.04.1 on Ubuntu. Unrecognised builds fall back to
needrestart and the newest-installed comparison.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent: bash script run hourly by a hardened systemd timer on Debian 12/13
and Ubuntu 24.04. Collects running vs installed kernel (needrestart when
available), pending/security updates via a read-only apt simulation,
reboot-required state and apt list freshness, and POSTs them as JSON.
Server: stdlib-only Python + SQLite (system python3 >= 3.11). Token-bound
ingest API, login-protected dashboard with per-host status
(stale/reboot/update/ok) and history, admin CLI, systemd unit and installer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>