Commit cb6b52b
fix(agent): nsenter mode finds host binary via /proc/1/root (#144)
Distroless agent containers ship no util-linux, so the previous
SpawnNsenter argv of {"nsenter", "--target", "1", ...} bailed at exec
with "executable file not found in \$PATH" — observed live on mjolnir
running ghcr.io/sarg3nt/gearbox/gearbox-agent:latest:
level=ERROR msg="console: spawner failed"
error="pty: start failed: exec: \"nsenter\": executable file not found in \$PATH"
With `pid: host` the kernel exposes the host's root filesystem at
/proc/1/root (PID 1's magic root symlink resolved by the host's mount
namespace). The agent can call the host's nsenter binary via that path
without bundling util-linux into the distroless image.
resolveHostNsenter stat()s a small candidate list:
/proc/1/root/usr/bin/nsenter (Debian/Ubuntu/modern RHEL)
/proc/1/root/bin/nsenter (older trees)
/proc/1/root/usr/sbin/nsenter
/proc/1/root/sbin/nsenter
/usr/bin/nsenter (in-container fallback for non-distroless
agent flavors)
nsenterUsable now requires the resolution to succeed so the capabilities
envelope honestly reports `host_console: false` when no nsenter is
reachable — the dashboard would rather hide the action than offer a
shell that immediately fails.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 10f939e commit cb6b52b
1 file changed
Lines changed: 45 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
107 | 111 | | |
108 | 112 | | |
109 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
110 | 148 | | |
111 | 149 | | |
112 | 150 | | |
| |||
127 | 165 | | |
128 | 166 | | |
129 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
130 | 172 | | |
131 | | - | |
| 173 | + | |
132 | 174 | | |
133 | 175 | | |
134 | 176 | | |
| |||
0 commit comments