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
- Strictly read-only — never changes system configuration, never
installs services, never runs sudo (locked by a regression test). Reads
journalctl(via theadmgroup),last/wtmp,/proc,/sys, and the
systemd-pstore archive directory. - 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.
- 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. - 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,
/systhermal + 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/statfor 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.shis 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)
| Tool | Purpose |
|---|---|
jetson_reboot_history | Reboot 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_diagnose | Reboot-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_snapshot | Live 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; usehermes 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_commandis in
Hermes'sHOST_SKIPPED_CTX_METHODS). The threejetson_reboot_*tools
and the watchdog are expected to keep working there (only
register_cli_commandis 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 anyjetson_reboot_*tool to verify, or run
python3 scripts/reboot_watch.py --self-checkdirectly. - The CLI reads the plugin copy and state of the profile pointed to by
$HERMES_HOME. IfHERMES_HOMEandHERMES_PROFILEdisagree,
selfcheckshows another profile's paths — check the
# environment: HERMES_HOME=… profile=…first line before debugging. statusdistinguishes the watch entry version recorded in the state
file (last run) from the one on disk now, flagging← DIFFERSon a
real mismatch.- Severity policy: missing-evidence findings (
log_unavailable,
boot_identity_mismatch,pstore_record_archived) areinfo— "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=truetool 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 withuptime -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_STATEenv overrides. Two profiles
must NEVER share one state file (they would swallow each other's
notifications). Atomic tmp+rename writes. - Logic resolution:
JETSON_PLUGIN_DIRenv > the profile-local
plugins/jetson-reboot-monitorcopy > the repository itself (script's
parent dir). After changing logic, re-copy the entry script and verify
sha256 —--self-checkprints the actually-loaded entry/analysis/
collectors paths + sha256 + mtime and the state path, and every state
write recordsloaded_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:
- 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. - Reboot reports & recovery notices: "emit once + keep a local record".
The full text andsent_atare stored in the state file; a later tick
resends EXACTLY ONCE, and only when the single matching job record shows
last_status == delivery_failedwithlast_run_atnewer 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_statusis 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. - pstore ACL alerting: every tick (including silent ones) evaluates
systemd-pstore.servicestate + 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 --failedalone
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-pstoreStorage=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=journalstops writing the file archive while still unlinking
/sys/fs/pstore, i.e. it DESTROYS crash evidence. Keep
Storage=external. -
Recommended approach: keep
Storage=externaland 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 withsystemctl 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=30sNo
-prefix (failures must stay visible: nothing depends on this
oneshot unit, so a failure only marks the unit failed without blocking
boot;TimeoutStartSeccaps 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--
(neversetfacl -R …:r— a named-userr--entry on a directory
REPLACES theother::r-xfallback and BREAKS traversal; verified on a
root-owned simulation tree. Acceptance = the user can actually READ, not
justgetfacloutput), - 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 1only, and any
mid-run anomaly surfaces asMISSING 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 ownacl-*.txt; dir overridable via
JETSON_PSTORE_ACL_BACKUP_DIRfor isolated testing), - exact, controlled rollback:
--restore FILE [SCOPE]replays the
saved state viasetfacl --restore(byte-identical round-trip verified,
unrelated ACL entries preserved). It accepts ONLY a root-owned backup
whose realpath matches the controlledacl-*.txtpattern (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|| trueanywhere. - 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 intests/e2e/root_gate_test.sh
(runsudo 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/journalmissing), logs of any
previous boot are LOST; the plugin reports this as a critical
recommendation (enable persistent journald) but never changes it. dmesgmay 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_usageinanalysis.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 bytests/test_analysis.py::test_plugin_never_executes_sudo).sudo_usageinscripts/pstore_acl_grant.sh: this helper is DESIGNED to
be run by an administrator via sudo (or as a rootExecStartPost); it is
never invoked by the plugin and refuses to run as non-root only to
protect against misuse.system_passwd_accessintests/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.

PeterChang02