All plugins

jetson-reboot-monitor

Read-only reboot forensics and health monitoring for NVIDIA Jetson (Orin Nano tested). Disclosure — runs read-only system commands (journalctl, last, systemctl show, df, ps) and reads the kernel journal and pstore crash archives; saves crash-log evidence to local 0600 files under the Hermes home; the optional watcher script, when the user copies it in and schedules it as a cron job, sends restart reports to that job's delivery target. No network calls of its own and never runs sudo.

PeterChang02Toolsv0.2.0Updated 10 days ago

About

Read-only reboot forensics and health monitoring for NVIDIA Jetson (Orin Nano tested). Disclosure — runs read-only system commands (journalctl, last, systemctl show, df, ps) and reads the kernel journal and pstore crash archives; saves crash-log evidence to local 0600 files under the Hermes home; the optional watcher script, when the user copies it in and schedules it as a cron job, sends restart reports to that job's delivery target. No network calls of its own and never runs sudo.

Jetson-Orin-Nano-Reboot-Monitor

(plugin id: jetson-reboot-monitor)

Read-only Hermes Agent plugin for diagnosing why an NVIDIA Jetson keeps
rebooting: a reboot watchdog for Hermes cron, three diagnostic tools, a CLI,
and an optional least-privilege path for reading kernel crash archives
(pstore/ramoops) without sudo.

Tested on Hermes Agent v0.23.2 on a Jetson Orin Nano Super (L4T
R39.2.1, kernel 6.8.12-tegra). The requires_hermes: ">=0.23.2" floor is
the version it was tested against — later releases are NOT individually
verified. Other Jetson/L4T combinations are untested: nothing in the plugin
is model-specific, but no compatibility is claimed beyond the tested
environment.

Design principles

  1. Strictly read-only — never changes system configuration, never
    installs services, never runs sudo (locked by a regression test). Reads
    journalctl (via the adm group), last/wtmp, /proc, /sys, and the
    systemd-pstore archive directory.
  2. Three-layer separation — every report keeps apart:
    • evidence: observed facts (log lines with their source),
    • inferences: hypotheses with an explicit confidence level, never
      stated as facts,
    • recommendations: advice only, never applied automatically.
  3. Missing logs are reported as missing — when the previous boot's log
    is unavailable the report says exactly which evidence is absent and why
    the cause cannot be determined. Absence of a signature never rules a
    cause out.
  4. No delivery confirmation is claimed — "delivered" is Hermes's own
    delivery verdict, not proof a human saw the message. The wording
    "delivery confirmed / ack" is deliberately absent from code and docs.

What this plugin does with your system (disclosure)

  • Reads system logs: journal (journalctl), wtmp (last), /proc,
    /sys thermal + memory counters, and — only if readable by the plugin
    user — the pstore crash-archive bodies under /var/lib/systemd/pstore.
  • Runs external commands (read-only): journalctl, last, uptime,
    systemctl show (pstore service status), vmstat, df, ps,
    getfacl/stat for readability checks.
  • Scheduled execution: the watchdog entry script is meant to run from
    Hermes cron (--no-agent, e.g. every 10 minutes). It stays silent unless
    something is worth reporting.
  • Local evidence retention: full crash-archive text (when readable) is
    saved to local 0600 files under <HERMES_HOME>/cache/evidence/;
    notifications and tool output carry only categories and counts (see
    Privacy below).
  • Outbound notifications: reboot reports, a first-run baseline line,
    pstore ACL alerts, and TEST-labelled selftests are delivered to whatever
    target the cron job is configured with. Nothing else leaves the machine.
  • Optional root helper (NOT installed or run by the plugin):
    scripts/pstore_acl_grant.sh is provided for a human administrator to
    grant read-only ACL access to the pstore archive. The plugin itself never
    executes it and never executes sudo.

Tools (toolset jetson_reboot)

ToolPurpose
jetson_reboot_historyReboot history: journal boot list + wtmp reboot/shutdown records + uptime + RTC/system-clock cross-check. wtmp entries are reported as raw counts only — their difference does NOT establish how many boots ended uncleanly (wtmp gaps/rotation make that uncountable); also flags a volatile journal and reports cross-source clock inconsistencies as observed facts
jetson_reboot_diagnoseReboot-cause diagnosis: scans a chosen boot's kernel log (default -1) for kernel panic (incl. Unable to handle kernel paging request / Internal error: Oops), list poisoning (LIST_POISON / dead0000000001xx), tegrawdt watchdog, soft/hard lockups, OOM, soctherm overheating, NVMe timeouts, EXT4 corruption fingerprints, VFS reclaim paths (Comm: kswapd, list_lru_add, balance_pgdat), NVRM GPU RPC failures, undervolt, BPMP and GPU faults. ramoops part headers (Oops#N PartN) are merged into ONE inference — file counts are never counted as crash counts. Also lists /var/lib/systemd/pstore and /sys/fs/pstore records with mtimes. Archived records are leads, not proof: existence + mtime does not prove a kernel crash happened (whether clean restarts also write dumps depends on the root-only ramoops config), mtimes follow whatever clock was in effect at write time, and same-mtime files are only "possibly related"
jetson_health_snapshotLive health: all thermal-zone temperatures, RAM/swap + PSI pressure, disk usage, top memory processes; threshold warnings (>=75/85 °C, swap >50 %, RAM >=90 %, disk >=92 %)

Optional environment: JETSON_DIAG_MAX_LOG_LINES — max journal lines
scanned per boot (default 20000).

CLI

hermes jetson-reboot status                        # health + monitor state (default action)
hermes jetson-reboot history                       # reboot history / record integrity
hermes jetson-reboot diagnose [--boot N] [--excerpts]
hermes jetson-reboot selfcheck                     # which code the watch entry actually loads (paths + sha256)
  • Plugin CLI discovery is lazy: the command does not appear in
    hermes --help; use hermes jetson-reboot --help.
  • Host isolation mode caveat: hermes jetson-reboot … subcommands
    require the plugin to load in-process — under host isolation mode the CLI
    subcommands may not be registered (register_cli_command is in
    Hermes's HOST_SKIPPED_CTX_METHODS). The three jetson_reboot_* tools
    and the watchdog are expected to keep working there (only
    register_cli_command is skipped; the cron script runner does not go
    through the in-process import refusal), but this is source-verified
    against Hermes v0.23.2, NOT runtime-tested
    — the reference machine runs
    plugins.isolation: in_process. If the CLI subcommand is missing in your
    setup, call any jetson_reboot_* tool to verify, or run
    python3 scripts/reboot_watch.py --self-check directly.
  • The CLI reads the plugin copy and state of the profile pointed to by
    $HERMES_HOME. If HERMES_HOME and HERMES_PROFILE disagree,
    selfcheck shows another profile's paths — check the
    # environment: HERMES_HOME=… profile=… first line before debugging.
  • status distinguishes the watch entry version recorded in the state
    file (last run)
    from the one on disk now, flagging ← DIFFERS on a
    real mismatch.
  • Severity policy: missing-evidence findings (log_unavailable,
    boot_identity_mismatch, pstore_record_archived) are info — "no
    evidence obtained" is not "critical problem found". Real signatures
    (panic/oops/fs corruption…) keep critical/high.
  • CLI and tools share the same handlers (tools.handle_*); the CLI only
    re-renders them as text. Exit codes: 0 ok / 1 environment-or-data error /
    2 unknown subcommand.

Privacy: zero raw text by default

Monitor notifications and default tool output contain ONLY fixed signature
categories, counts and severities (e.g. kernel_panic ×1 (critical)) plus
the local evidence file path — never raw log lines, not even redacted
fragments (agent output can be forwarded to chat, and redaction is
best-effort, not a security boundary).

  • Full reports land in local 0600 files:
    <HERMES_HOME>/cache/evidence/reports/report-<ts>.json; raw pstore full
    text separately under …/evidence/pstore/fulltext-<ts>.log.
  • Explicit opt-in (include_excerpt=true tool arg / CLI --excerpts)
    returns signature-hit excerpts that are STILL redacted line-by-line
    (passwords/tokens/keys/credentials, Authorization/Cookie/X-Api-Key
    header values, URL-embedded credentials, long base64 blobs), windowed to
    ±200 chars around the match and capped at 40 lines per block. The CLI
    prints a "local terminal only — do not paste into chat" banner.
  • Regression tests: tests/test_privacy.py (leak/redaction),
    tests/test_watch.py::test_notification_no_raw_dump_text (notifications
    carry categories+counts only).

Watchdog script (scripts/reboot_watch.py)

No-LLM watcher for Hermes cron (--no-agent). Delivery contract: non-empty
stdout → delivered; empty stdout → silent success (boot unchanged); non-zero
exit → cron watchdog alert, reserved for "the script itself is broken"
("logs missing / cause undeterminable" is exit 0 + explanation, never an
error).

  • Dedup key: /proc/sys/kernel/random/boot_id (world-readable), read
    back-to-back with uptime -s.
  • Multiple reboots between ticks: the state also records the TOTAL wtmp
    boot count; a delta > 1 is reported as "about N boot(s) in between"
    (boot_id alone only shows the last one).
  • First run only establishes a baseline (one delivered baseline line
    proving the delivery path works); corrupt state re-baselines.
  • Evidence tiers: "a reboot happened" (boot_id/wtmp — needs no
    persistent journal) vs "why" (needs the previous boot's journal or pstore
    bodies) are stated separately; whichever is missing is named, with manual
    verification commands.
  • Per-profile state file: default
    <profile>/cron/state/reboot_watch.json (dev-tree runs fall back to
    <plugin>/.state/); REBOOT_WATCH_STATE env overrides. Two profiles
    must NEVER share one state file (they would swallow each other's
    notifications). Atomic tmp+rename writes.
  • Logic resolution: JETSON_PLUGIN_DIR env > the profile-local
    plugins/jetson-reboot-monitor copy > the repository itself (script's
    parent dir). After changing logic, re-copy the entry script and verify
    sha256 — --self-check prints the actually-loaded entry/analysis/
    collectors paths + sha256 + mtime and the state path, and every state
    write records loaded_from.
  • --selftest: prints one line labelled 🧪 TEST delivery check (NOT a reboot event…) and exits 0, to verify the delivery path. Never fake a
    reboot by forging the state file.

⚠️ Do NOT run the production entry script manually without arguments:
both the silent path and the reboot path write state before printing.
A manual run between a real reboot and the next scheduled tick consumes
the event — the report prints to your terminal and the room never sees
it. For manual inspection use --self-check (read-only), --selftest,
or the diagnostic tools.

Install (the cron scheduler rejects symlinks and out-of-tree scripts —
make a REAL copy):

cp <repo>/scripts/reboot_watch.py ~/.hermes/profiles/<profile>/scripts/
# then create a cron job, e.g. every 10 minutes, no_agent,
# deliver to your room/discord target of choice

Delivery-target note (field-tested): a job created from a hosted bot room
with deliver=origin resolves to the LOCAL session, not the room. Use an
explicit room:<room-id> (hosted rooms) or discord:<chat-id> target.

Delivery semantics & bounded retry (no confirmation)

Field-tested facts about Hermes cron on the reference host: an attempted
delivery is never retried by Hermes; with multiple targets,
delivery_outcome=delivered means ALL targets succeeded while
delivery_failed means at least one failed — the others may already have
received the message; and the per-run execution_id is never persisted
anywhere the script can read, so a message cannot be bound to its run.

Therefore this plugin provides no delivery confirmation. What it does:

  1. Alert FIRING (pstore ACL alerts): time-window resend — while the
    condition persists the alert re-fires every 6 h (at most 4 duplicate
    reminders/day during a persistent failure). The window only guarantees a
    resend while the machine is online and the target works.
  2. Reboot reports & recovery notices: "emit once + keep a local record".
    The full text and sent_at are stored in the state file; a later tick
    resends EXACTLY ONCE, and only when the single matching job record shows
    last_status == delivery_failed with last_run_at newer than the emit
    (the resend is labelled: some targets may already have received it; may
    duplicate). Every other outcome (ok / record still stale after 2 waiting
    ticks / ambiguous job match) archives the content in the state file
    (reboot_msg_archive / recovery_archive) and stays silent — never
    resends.
    Known limitation: last_status is RUN-level and can be overwritten by
    another run of the same job — it can both miss a resend and misattribute
    another run's failure. All failure modes fall on the "do not resend"
    side (no spam), at the cost of possibly losing one notification.
  3. pstore ACL alerting: every tick (including silent ones) evaluates
    systemd-pstore.service state + drop-in presence + functional archive
    readability. States: grant_failed (unit failed, or drop-in installed
    but 0 of N archives readable), query_unknown (systemctl query failed —
    "cannot query" is NOT "healthy"), normal. An empty archive is NOT a
    failure; without the drop-in, unreadable archives are the expected
    manual-sudo state and do not alert. Recovery is announced once (and
    itself protected by the bounded retry above). systemctl --failed alone
    is not a user-visible channel — this alert is.

Tests: test_watch.py::test_pstore_alert_lifecycle_through_main and
test_reboot_report_delivery_retry. A full end-to-end runbook with real
cron delivery (isolated test job, TEST-labelled messages, isolated state)
is in tests/e2e/RUNBOOK.md.

Least-privilege pstore archive reading (optional)

Goal: let the plugin analyze crash-archive bodies without sudo and without
gaining general root.

  • Rejected alternative (do not retry): systemd-pstore Storage=journal.
    Controlled experiments showed journald drops field values between 1 KB
    and 4 KB — real 14 KB/109 KB dumps never reach the journal — and
    Storage=journal stops writing the file archive while still unlinking
    /sys/fs/pstore, i.e. it DESTROYS crash evidence. Keep
    Storage=external.

  • Recommended approach: keep Storage=external and add a drop-in that
    grants read-only ACLs after archiving. The drop-in MUST live at
    /etc/systemd/system/systemd-pstore.service.d/ (wrong locations are
    silently ignored — verify with systemctl show -p DropInPaths):

    # /etc/systemd/system/systemd-pstore.service.d/readable.conf
    [Service]
    ExecStartPost=/usr/local/sbin/jetson-pstore-acl <archive-dir> <grant-user>
    TimeoutStartSec=30s
    

    No - prefix (failures must stay visible: nothing depends on this
    oneshot unit, so a failure only marks the unit failed without blocking
    boot; TimeoutStartSec caps the only real risk — hanging before
    sysinit.target). The installed helper MUST be a root-owned copy
    (/usr/local/sbin/…, 0755 root:root) — a root-executed unit must never
    point into a user-writable tree; the script self-checks its own and its
    parent directory's ownership and refuses otherwise.

scripts/pstore_acl_grant.sh

Strict, auditable grant helper (run manually with sudo, or as the
ExecStartPost above; the plugin never runs it):

  • directories → u:<user>:r-x, regular files → u:<user>:r--
    (never setfacl -R …:r — a named-user r-- entry on a directory
    REPLACES the other::r-x fallback and BREAKS traversal; verified on a
    root-owned simulation tree. Acceptance = the user can actually READ, not
    just getfacl output),
  • symlinks: never followed (-P) and never matched (-type d/-type f);
    a symlinked target DIR is refused,
  • the WHOLE parent chain of DIR must be root-owned and not
    group/other-writable (a user-writable ancestor means the tree could be
    swapped underneath the grant),
  • hard-link gate: ACLs apply per inode — if any file under DIR has
    nlink > 1 the grant REFUSES to run (it would extend to an inode reachable
    outside DIR); the grant find also matches -links 1 only, and any
    mid-run anomaly surfaces as MISSING ACL + non-zero exit,
  • backup before any change: full recursive ACL state
    (getfacl -R -p) to root-only 0600 files in
    /var/backups/jetson-pstore-acl/acl-<ts>.txt (newest 20 kept; rotation
    only ever deletes its own acl-*.txt; dir overridable via
    JETSON_PSTORE_ACL_BACKUP_DIR for isolated testing),
  • exact, controlled rollback: --restore FILE [SCOPE] replays the
    saved state via setfacl --restore (byte-identical round-trip verified,
    unrelated ACL entries preserved). It accepts ONLY a root-owned backup
    whose realpath matches the controlled acl-*.txt pattern (symlink-safe),
    whose recorded paths all lie inside SCOPE (default: the archive dir; /
    and non-root-owned scopes are refused), with leading-slash normalization
    and rejection of any .. traversal entry. (-x u:<user> is NOT an
    acceptable rollback — it would delete a pre-existing grant; -b
    destroys unrelated entries.)
  • verification pass: every regular file is re-checked with getfacl;
    every miss is reported (MISSING ACL), exit is non-zero, and the die
    message repeats the exact rollback command. No || true anywhere.
  • Known boundaries (documented, structurally blocked where possible):
    TOCTOU between find and setfacl is not exploitable while the archive dir
    is root-owned 0755 — if it ever becomes group/other-writable, this
    becomes a real privilege-escalation path
    ; hard links are refused by the
    gate above.
  • A one-shot root-side gate test covering all of these (hardlink refusal,
    functional read, controlled/out-of-scope/foreign backup refusal, restore
    round-trip, production invariance) is in tests/e2e/root_gate_test.sh
    (run sudo bash tests/e2e/root_gate_test.sh <user>; it creates and
    removes only mktemp paths).

Note: ExecStartPost runs AFTER archiving, so new dumps are readable from
the next boot; PRE-EXISTING archives need one manual
sudo pstore_acl_grant.sh <dir> <user>. Once granted, ANY process running
as that user can read the archives — this is inherent to the approach;
approve knowingly.

Zero-system-change fallback: keep manual reading (sudo cat /var/lib/systemd/pstore/dmesg-ramoops-*); the plugin only suggests those
commands, and unreadable archives never trigger alerts without the
drop-in.

Clock pitfalls (field-tested)

On cold boot the RTC may hold a stale time until NTP corrects it, so this
boot's first journal timestamp can predate the real boot (or postdate it if
journald starts late). Consequences: journal date span ≠ uptime; last
crash/"still running" lines alone prove nothing; pstore archive mtimes
follow the write-time clock and are approximate; uptime -s is
now − /proc/uptime and moves with clock corrections. jetson_reboot_history
cross-checks sources and reports boot_time_discrepancy as the OBSERVED
difference plus possible explanations only — no correction bound is
inferred and no single source is declared an anchor.

Repository layout

jetson-reboot-monitor/
├── plugin.yaml            # plugin metadata (kind: standalone)
├── __init__.py            # register(ctx) entry
├── collectors.py          # read-only data collection (fully mockable)
├── analysis.py            # pure analysis: signatures → evidence/inference/recommendation
├── tools.py               # tool schemas + handlers (shared with the CLI)
├── cli.py                 # hermes jetson-reboot …
├── scripts/
│   ├── reboot_watch.py        # cron --no-agent watchdog (no LLM, no sudo)
│   └── pstore_acl_grant.sh    # optional root ACL helper (human-run only)
├── tests/
│   ├── test_analysis.py   # pure unit tests (no Jetson needed)
│   ├── test_watch.py      # watchdog integration tests (real subprocess, temp state)
│   ├── test_privacy.py    # redaction / zero-raw-text regressions
│   ├── test_cli.py        # CLI rendering + version-mismatch flagging
│   ├── test_live.py       # read-only smoke test (needs Linux/Jetson)
│   └── e2e/               # delivery-retry runbook + root-side gate test
└── README.md

Tests

python3 tests/test_analysis.py   # pure unit tests
python3 tests/test_watch.py      # watchdog integration (subprocess, temp state)
python3 tests/test_privacy.py
python3 tests/test_cli.py
python3 tests/test_live.py       # read-only smoke test on the host

All suites are dependency-free (stdlib only). test_live.py requires
Linux with journalctl; the rest run anywhere.

Installation

cp -r <repo> ~/.hermes/plugins/jetson-reboot-monitor   # or a profile's plugins/ dir
hermes plugins enable jetson-reboot-monitor            # if required by your setup
# watchdog: copy scripts/reboot_watch.py into the profile's scripts/ dir
# and create the cron job (see above). Nothing is scheduled by default.

The plugin registers tools/CLI only — it installs no cron job, no systemd
unit, and no ACL by itself.

Known limitations

  • Without a persistent journal (/var/log/journal missing), logs of any
    previous boot are LOST; the plugin reports this as a critical
    recommendation (enable persistent journald) but never changes it.
  • dmesg may be restricted (dmesg_restrict); the plugin uses
    journalctl -k (adm-group readable) instead and never escalates.
  • Reboot CAUSE attribution beyond signature matching is intentionally not
    attempted: reports state evidence, hypotheses and confidence, nothing
    more.

Security-scan notes (hermes plugins validate)

Validation passes with caution-level findings only; each is explained here
(none is executable behavior of the plugin):

  • sudo_usage in analysis.py / collectors.py / reboot_watch.py:
    literal "sudo cat /var/lib/systemd/pstore/…" strings inside
    RECOMMENDATION text — copy-paste commands for a human to run through
    their own approval flow. The plugin code contains no sudo execution
    path at all
    (locked by tests/test_analysis.py::test_plugin_never_executes_sudo).
  • sudo_usage in scripts/pstore_acl_grant.sh: this helper is DESIGNED to
    be run by an administrator via sudo (or as a root ExecStartPost); it is
    never invoked by the plugin and refuses to run as non-root only to
    protect against misuse.
  • system_passwd_access in tests/e2e/root_gate_test.sh: id -u <user>
    lookups verifying the test grant-user exists.

No dangerous-level findings.

License

MIT — see LICENSE.

README from the reviewed commit b02abef; it updates when the author re-pins.

Developer Mode

Explore built-in Hermes toolsets and actions.

HermesAgent

Developer?

Create a Hermes extension for Desktop or agent workflows.

Developer Section