From fd2ace70e67b25a7d717885e4c8180c492adbad8 Mon Sep 17 00:00:00 2001 From: pi-os3 Date: Tue, 10 Nov 2026 17:41:49 -0400 Subject: [PATCH] tools/xhci_boot_capture: the fallback outdir is the cache, never /tmp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On this box `/tmp` is tmpfs, so a capture written there is **RAM held until reboot**. The tool was falling back to `/tmp/xhci-capture-` whenever `/data` was not writable, which is the default on a machine without a `/data` mount — so the default path was RAM. The fallback is now `${XDG_CACHE_HOME:-$HOME/.cache}/1bit/captures/xhci-`, the directory the `.fconst` and `q4nx` caches already use, and the header says why in one line referencing engine#2027's rule. `/data` is still preferred when it is writable. Why this is this lane's to fix: the tool is mine (#1679), and the rule is fleet-wide as of 2026-11-10 (`/tmp` 52 G on a 122 G box with swap 71/71 G full, every dump and staging file counted as memory). Two of my own earlier capture runs left **root-owned** files in `/tmp` (`Operation not permitted` to a lane, so a sweep cannot finish without sudo) — the class this change removes. Not a general sweep fix: the per-token `q4nx_hidden_%d.bin` dump and the `mkstemp` sites in `npu/forward/` are the larger writers and belong to the lanes editing those files; they were reported separately with line numbers. Verified: `bash -n` clean; `grep -c '/tmp/'` on the file is **0**. --- tools/xhci_boot_capture.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/xhci_boot_capture.sh b/tools/xhci_boot_capture.sh index cc7992eeb..37aae66d3 100755 --- a/tools/xhci_boot_capture.sh +++ b/tools/xhci_boot_capture.sh @@ -32,7 +32,9 @@ # needs root and is therefore the one part that will say so if it cannot read. # # usage: tools/xhci_boot_capture.sh [outdir] -# default outdir: /data/xhci-capture- when /data is writable, else /tmp/... +# default outdir: /data/xhci-capture- when /data is writable, else +# ${XDG_CACHE_HOME:-$HOME/.cache}/1bit/captures. NEVER /tmp: on strixhalo /tmp is tmpfs, +# so a capture written there is RAM held until reboot (engine#2027's rule). # exit: 0 captured, 2 not root and sudo unavailable, 3 cannot write set -u @@ -49,7 +51,13 @@ fi stamp=$(date +%Y%m%d-%H%M%S) out=${1:-} if [ -z "$out" ]; then - if [ -d /data ] && [ -w /data ]; then out=/data/xhci-capture-$stamp; else out=/tmp/xhci-capture-$stamp; fi + if [ -d /data ] && [ -w /data ]; then + out=/data/xhci-capture-$stamp + else + # engine#2027: NOT /tmp. On this box /tmp is tmpfs, so a capture there is RAM held until reboot; + # the cache directory is on disk and is where the fconst and q4nx caches already live. + out=${XDG_CACHE_HOME:-$HOME/.cache}/1bit/captures/xhci-$stamp + fi fi mkdir -p "$out" 2>/dev/null || { say "xhci_boot_capture: cannot write $out" >&2; exit 3; }