fix: move llama-server stderr log from /tmp to working dir (ReadWritePaths compat)

The sidecar systemd service has ProtectSystem=strict and
ReadWritePaths=/home/bigt/AI/llm, making /tmp read-only. Writing
/tmp/llama-server-stderr.log failed with EROFS.

Changed LLAMA_STDERR_LOG to os.path.join(dirname(MANIFEST_PATH), ...),
resolving to /home/bigt/AI/llm/llama-server-stderr.log, which is
within the allowed ReadWritePaths.
This commit is contained in:
root 2026-06-16 20:36:10 +00:00
parent 37fee5341e
commit 1551c281c2

View File

@ -19,7 +19,9 @@ from sidecar.manifest import load_manifest
MANIFEST_PATH = os.getenv("MANIFEST_PATH", "/home/bigt/AI/llm/manifest.yaml") MANIFEST_PATH = os.getenv("MANIFEST_PATH", "/home/bigt/AI/llm/manifest.yaml")
SIDECAR_PORT = int(os.getenv("SIDECAR_PORT", "8080")) SIDECAR_PORT = int(os.getenv("SIDECAR_PORT", "8080"))
LLAMA_SERVER_PORT = 8081 LLAMA_SERVER_PORT = 8081
LLAMA_STDERR_LOG = "/tmp/llama-server-stderr.log" LLAMA_STDERR_LOG = os.path.join(
os.path.dirname(MANIFEST_PATH), "llama-server-stderr.log"
)
# Global state # Global state
_llama_server_process: Optional[asyncio.subprocess.Process] = None _llama_server_process: Optional[asyncio.subprocess.Process] = None
@ -128,6 +130,9 @@ async def _poll_llama_server_ready(max_retries: int = 60, interval: float = 0.5)
pass pass
await asyncio.sleep(interval) await asyncio.sleep(interval)
# Flush and close the stderr handle so all data is on disk before we read
_close_stderr_log()
# ── Dump stderr for diagnosis ────────────────────────────────────── # ── Dump stderr for diagnosis ──────────────────────────────────────
print("llama-server did NOT become ready — dumping stderr:", flush=True) print("llama-server did NOT become ready — dumping stderr:", flush=True)
try: try: