Persist the guest console instead of discarding it - #166
Merged
themartiano merged 4 commits intoSep 9, 2026
Conversation
jtavin-smp
force-pushed
the
fix/persist-guest-console-log
branch
from
September 8, 2026 12:26
ab67cb0 to
93bf6fe
Compare
The guest console is bound to a stdio chardev and QEMU inherits the helper app's stdout, which is /dev/null for a Finder launch, so every console byte is discarded on every normal launch. A guest that fails to boot, wedges its network, or hangs leaves no host-side record, and a restart destroys whatever was there. Give the chardev an explicit logfile under the VM state directory and rotate one generation aside at launch, since a fault serious enough to force a reboot is only readable after that reboot has replaced the live log. Ephemeral launches log into the temporary workspace. The option value is comma-escaped because QEMU splits chardev options on commas. Verified with the bundled runtime booting the bundled kernel with no root disk: 92,610 bytes of console output captured where nothing is captured today. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
jtavin-smp
force-pushed
the
fix/persist-guest-console-log
branch
from
September 8, 2026 13:14
93bf6fe to
d5c430d
Compare
Collaborator
|
Merged main, fixed some CI issues and merging. |
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.
Fixes #165.
Problem
The guest console is bound to a
stdiochardev (macos/run-qemu-gpu.sh:1424), and the helper hands QEMU its own stdout (QEMUGPULauncher.swift:759). For an app launched from Finder that is/dev/null, so every console byte is discarded on every normal launch.stderris piped and read by the helper, but the console is not on stderr.Confirmed on a running VM:
The practical cost is that a guest which fails to boot, wedges its network, or hangs leaves no host-side record, and a restart destroys what was there.
Change
Give the existing chardev an explicit
logfile=, pointed at the VM's own state directory. Nothing about how the console is attached changes.<VM root>/console.log, next to the VM they describe, so the log survives app updates exactly as the rest of that directory does.console.log.1at launch. This is the part that makes the feature useful: a fault bad enough to force a reboot is only readable after that reboot has already truncated the live log.logappend=offplus the rotation keeps this bounded at two files rather than growing without limit.Verification
End to end with the bundled runtime, booting the bundled kernel with no root disk:
92,610 bytes captured where nothing is captured today.
macos/Tests/run-qemu-ssh-contract.test.shpasses, with two added assertions: the chardev carries the logfile option, and a pre-existingconsole.logis rotated toconsole.log.1with its contents intact.The test's fake storage shim previously set
QEMU_PERSISTENT_STORAGE_DIRECTORYbut notQEMU_PERSISTENT_STORAGE_ROOT, even though its own-kernel "$persistent_root/boot/kernel"assertion treatsFAKE_PERSISTENT_ROOTas the root. This adds the missing assignment so the shim reflects what the real module exports.Note on
make testmake testdoes not currently complete in my environment:swift testfails withno such module 'Testing'(48 occurrences). This is not caused by this change — it reproduces identically on a cleanmainworktree at 768d03d with no modifications, and this PR touches no Swift sources. Every shell and Python test in the suite that runs before it passes. Flagging it rather than claiming a green run.Docs
README gains a short "Guest console log" section under Data and updates, covering both paths, the rotation, and a note that the log contains guest output and is worth reviewing before attaching it to a bug report.