diagnix: add diag-pstore

/sys/fs/pstore is root-only and holds the kernel's crash records from
the previous boot, the only trace a hard freeze leaves when the journal
is cut off. diag-pstore prints them via the existing NOPASSWD sudo list.
ABOUTME updated for both diagnix changes.
This commit is contained in:
Hermenix committed 2026-11-20 01:34:41 +00:00
1 parent 5c48ef9c1e
commit 7a973aaee6
2 files changed
+15 -2

No files matched your search

+7 -2
View File
@@ -43,8 +43,13 @@ common/
`lab-ssh` in the agent system (`server/services/nbot-agent.nix`). It reads logs
(`systemd-journal` group), units, `/proc` and the store, and can't change anything. It
can't read root-only files. Through sudo it can run only the fixed `diag-*` scripts
(docker ps/logs, smart, ports, firewall, btrfs, io). The key is `restrict,pty` and only
works from the nbot hosts (`hosts.nix`). Hosts running nbot also let their own containers
(docker ps/logs, smart, ports, firewall, btrfs, io, pstore). The key is `restrict,pty` and only
works from the nbot hosts (`hosts.nix`). `diag-pstore` prints the kernel's saved crash
records from `/sys/fs/pstore` (root-only), the one trace a hard freeze can leave behind.
The hermenix VM has its own key (`hosts.nix` → `hermenix`), with the same limits, accepted
only from hl-fwdesk's addresses (the VM is NAT'ed out of fwdesk). Turn it off per host
with `skyg.nixos.common.diagnix.hermenix.enable = false`. fwdesk's `hermenix.nix` lets
the VM reach port 22 on `10.0.10.0/24`. Hosts running nbot also let their own containers
reach port 22 and accept them from private IPs outside the LAN. Their IPs are random, so
they can't be listed. Resources are capped (1G memory, 1 CPU, 256 tasks). The Nix daemon
is left open on purpose: an allow-list would break nix-serve/buildbot.
+8
View File
@@ -43,6 +43,14 @@ let
done
'')
(script "diag-io" [ pkgs.iotop ] "iotop -b -o -n 3 -d 1")
(script "diag-pstore" [ ] ''
shopt -s nullglob
files=(/sys/fs/pstore/*)
if [ ''${#files[@]} -eq 0 ]; then echo "pstore is empty"; exit 0; fi
for f in "''${files[@]}"; do
echo "=== $f"; cat "$f" || true
done
'')
] ++ lib.optionals (runtime != null) [
(script "diag-docker-ps" [ ] ''
${rt} ps -a; ${rt} stats --no-stream; ${rt} system df