t3code icon indicating copy to clipboard operation
t3code copied to clipboard

`t3 service protect` says memory protection applies when the kernel's memory cgroup controller is disabled; `status` then says to run protect again

Open BrendanH18 opened this issue 2 weeks ago • 0 comments

What happened

On a Raspberry Pi running the background service, t3 service protect finished with "Protected T3 Code. Memory protection applies now…". t3 service status then shows Memory protection: off, user.slice grants none. Run `t3 service protect`., while OOM score: -900 is correct. Running protect again changes nothing, so the user gets stuck in a loop.

Diagnosis

The kernel boots with cgroup_disable=memory (the Raspberry Pi OS default), so cgroup2 has no memory controller (/sys/fs/cgroup/cgroup.controllers = cpuset cpu io pids). systemd accepts the MemoryLow= drop-ins that protect writes, but no memory.low file exists in any cgroup, so the protection can't apply. oom_score_adj doesn't depend on cgroups, which is why the OOM score part works.

  • protect (apps/server/src/cli/service.ts) prints "Memory protection applies now" without checking that memory is in cgroup.controllers.
  • readProtection (apps/server/src/cloud/serviceProtection.ts) turns a missing memory.low/memory.min into "", so "controller unavailable" looks the same as "grants none", and status recommends t3 service protect, which can't help.

Suggested behaviour: detect a missing memory controller in both commands. protect should warn that only the OOM score will apply, and status should say something like "unavailable: kernel memory cgroup controller disabled (e.g. add cgroup_enable=memory to the kernel command line)" instead of pointing back at protect.

Steps to reproduce

  1. Linux host whose kernel has cgroup_disable=memory (e.g. Raspberry Pi OS on a Pi with the default kernel).
  2. t3 service install, then t3 service protect. It reports success.
  3. t3 service restart, then t3 service status. It shows Memory protection: off, user.slice grants none. Run `t3 service protect`. with OOM score: -900.
  4. t3 service protect again → same status.

Version

Background service [email protected] (the triage CLI was also 0.1.9). The same code is still on main as of 2026-11-15.

Environment

Raspberry Pi OS (Debian 13), linux arm64, kernel 6.18.60+rpt-rpi-v8, systemd 257, Node v26.12.1. Server runs as the systemd user service t3code.service.

Evidence

$ cat /proc/cmdline | tr ' ' '\n' | grep cgroup
cgroup_disable=memory
$ cat /sys/fs/cgroup/cgroup.controllers
cpuset cpu io pids
$ systemctl show user.slice -p MemoryLow
MemoryLow=2147483648
$ ls /sys/fs/cgroup/user.slice/memory.low
No such file or directory
$ t3 service status
  Memory protection: off, user.slice grants none. Run `t3 service protect`.
  OOM score: -900

Related issues

#26004 (introduced MemoryLow protection), #20931 (other protect/unit behaviour). Neither covers this.

Fix applied or workaround

Add cgroup_enable=memory to /boot/firmware/cmdline.txt and reboot.

Filed by

Claude Code (Claude Opus 5.5, claude-opus-5-5) via t3 triage.

BrendanH18 avatar Nov 15 '26 23:11 BrendanH18