feat(sdk): capture firecracker stdio via console_path#6
Draft
PeronGH wants to merge 1 commit into
Draft
Conversation
Firecracker pipes the guest serial console (ttyS0) to its own stdout, and FirecrackerProcessBuilder::spawn was leaving stdio on inherit — so kernel boot output landed wherever the parent's stdout happened to go, and a closed parent pipe produced `Failed the write to serial: BrokenPipe` spam in firecracker's own log file. Add four additive knobs to FirecrackerProcessBuilder: - console_path(path): open the file in create+append mode at spawn time; use it for stdout and stderr (cloned fd) unless a per-channel override is set. Typical use: capturing the guest serial console into an instance-local log file. - stdin(Stdio) / stdout(Stdio) / stderr(Stdio): raw Stdio overrides for callers that need finer control. Resolution is "explicit per-channel override wins, then console_path, then command default (inherit)". Factored into `apply_stdio` so the matrix is testable without a live firecracker binary. fc-cli gains a --console-path flag on the firecracker backend; the jailer backend rejects it for now (TODO near the jailer builder spawn documents a follow-up). Additive only — bump 0.3.0 -> 0.3.1.
5d750db to
a0a63ac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #5 — this branch is based on
fix/validate-vm-id, so hold off on merging until that lands. Will retarget tomasteronce #5 is in.Summary
Firecracker pipes the guest serial console (ttyS0) to its own stdout.
FirecrackerProcessBuilder::spawnwas leaving stdio on inherit, so the kernel boot log landed wherever the parent's stdout happened to go — and if that parent's stdout closed (e.g. piped throughhead), firecracker spammedFailed the write to serial: BrokenPipeinto its own log-path file. Long-running callers likearcbox-agentcouldn't actually see whether the kernel made it to userspace.This PR adds four additive knobs to
FirecrackerProcessBuilder:console_path(path)— the common case. Opens the file in create+append mode atspawn()time and routes both stdout and stderr to it (the stderr fd is atry_cloneof the stdout fd, so they land in the same file). Matches the existinglog_path/metrics_pathstyle.stdin(Stdio)/stdout(Stdio) / stderr(Stdio)— rawstd::process::Stdiooverrides for callers that needStdio::null(),Stdio::piped(), or a specificFile.Resolution order at
spawn(): explicit per-channel override wins, elseconsole_pathfills any unset stdout/stderr, else the channel inherits from the parent (today's default). Refactored intoapply_stdioso the decision matrix is testable without a live firecracker binary.fc-cligains a--console-pathflag on the firecracker backend; the jailer backend rejects it with a clear error for now.JailerProcessBuildercarries a TODO near itsspawndocumenting the follow-up — jailer's--daemonizedetaches stdio, so the semantics need their own design.Additive only — bump
0.3.0→0.3.1.Test plan