Commit c805e00
Roy Lin
fix(box): container logs show only container output (not runtime internals)
`a3s-box logs` was polluted with runtime boot/exec chatter — guest-init's own
INFO tracing (Spawning process, exec/pty server listening, Waiting for
container process, ...) plus libkrun's C-init preamble — because the container
inherits PID1's serial console and guest-init logged to that same console.
Docker `logs` must show ONLY the container process's stdout/stderr.
- guest-init: route its OWN tracing to the kernel log (/dev/kmsg) instead of the
console, with a <7> debug-priority prefix that stays below the guest kernel's
console loglevel (4) so it never echoes back. The fd is opened once before any
chroot/pivot and reused (an open fd survives pivot_root), avoiding a mid-boot
gap where the new root has no /dev/kmsg. Falls back to stdout if unavailable.
with_ansi(false) keeps the kernel log clean.
- runtime/log.rs: drop libkrun's `init.krun: ...` preamble (printed before
/sbin/init starts) from the json-file and syslog log streams.
Verified on KVM: `run -d alpine -- sh -c 'echo HELLO1; echo HELLO2'` then
`logs` yields exactly HELLO1/HELLO2 (guestinit=0, krun=0; was ~10 polluting
lines). Foreground run + exec + container output unaffected. Bug remaining
(separate): --timestamps still shows processing time, needs guest stamp-at-source.1 parent a00d856 commit c805e00
2 files changed
Lines changed: 104 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
167 | 223 | | |
168 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
169 | 237 | | |
170 | 238 | | |
171 | 239 | | |
172 | 240 | | |
173 | 241 | | |
| 242 | + | |
| 243 | + | |
174 | 244 | | |
175 | 245 | | |
176 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
| |||
71 | 80 | | |
72 | 81 | | |
73 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
74 | 91 | | |
75 | 92 | | |
76 | 93 | | |
| |||
128 | 145 | | |
129 | 146 | | |
130 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
131 | 151 | | |
132 | 152 | | |
133 | 153 | | |
| |||
148 | 168 | | |
149 | 169 | | |
150 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
151 | 174 | | |
152 | 175 | | |
153 | 176 | | |
| |||
265 | 288 | | |
266 | 289 | | |
267 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
268 | 301 | | |
269 | 302 | | |
270 | 303 | | |
| |||
0 commit comments