persistent logs + quieter init coordination#10
Merged
Conversation
--log-persist-path (+ --log-persist-device) writes xmorph's own log and the entrypoint's stdout+stderr to a directory on the old rootfs (default /var/log/xmorph). Because that directory survives the kernel restart triggered by RebootOnFailure, you can `tail` it on the recovered NixOS to see why the pivoted install died. Pre-pivot check confirms the directory is writable and aborts otherwise. Requires KeepOldRoot to be non-empty. initsys.Coordinator.TransitionToRescue now isolates basic.target instead of rescue.target on systemd hosts. rescue.target activates rescue.service which runs sulogin on the console — with a locked root, that looks like an emergency prompt during every pivot. basic.target stops all user services (same coverage) but keeps journal + dbus and doesn't touch tty state.
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.
Summary
Two changes bundled — both improve the pivot's post-mortem UX.
Persistent logs
--log-persist-path(default/var/log/xmorph) writes xmorph's own log and the entrypoint's stdout+stderr to a directory on the old rootfs (default). Optional--log-persist-devicepicks a specific pre-pivot mount to host it. Because the directory survives the kernel restart triggered byRebootOnFailure, you cantailit on the recovered OS to see why the pivoted install died — no more "box came back, no idea what happened."KeepOldRoot != \"\"(no persistent logs without an old root to persist to).--log-persist-pathdisables.<dir>/xmorph.log, the entrypoint's stdout+stderr to<dir>/entrypoint.log.Quieter init coordination
initsys.Coordinator.TransitionToRescuenow isolatesbasic.targetinstead ofrescue.targeton systemd hosts.rescue.targetactivatesrescue.servicewhich runssuloginon the console — with a locked root, that looks like an emergency prompt during every pivot.basic.targetstops all user services (same coverage) but keeps journal + dbus and doesn't touch tty state.Test plan
go test ./internal/...on Linux (endeavour): all pass.TestSuperviseTeesToLogWriterconfirms both stdout and stderr land in the writer.configwrite_testextended forLogPersistDirround-trip and empty-omission./var/log/xmorph/.