fix: quadlet generator emits diagnostics to stderr under systemd-analyze verify#29079
Open
mvanhorn wants to merge 1 commit into
Open
fix: quadlet generator emits diagnostics to stderr under systemd-analyze verify#29079mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
Logf wrote to /dev/kmsg and only fell back to stderr when the kmsg write failed or -dryrun was set. As root the kmsg write succeeds, so nothing reached stderr and `sudo systemd-analyze --generators verify` (which captures stderr, not kmsg) showed no diagnostics, while the same command without sudo did. Write to /dev/kmsg best-effort for early-boot/journal capture AND always copy the same line to stderr so verify and interactive sudo runs surface the messages. Rootless behavior is unchanged. Fixes: podman-container-tools#28888 Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Honny1
reviewed
Jun 30, 2026
Honny1
left a comment
Contributor
There was a problem hiding this comment.
LGTM, Just one style question.
| fmt.Fprintf(os.Stderr, "%s\n", line) | ||
| os.Stderr.Sync() | ||
| } | ||
| logToKmsg(line) |
Contributor
There was a problem hiding this comment.
This function returns a bool value; should it be like this?:
Suggested change
| logToKmsg(line) | |
| _ :=logToKmsg(line) |
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.
Running
sudo systemd-analyze --generators verify <unit>against a broken quadlet printed no generator diagnostics, even though the same command withoutsudo(andpodman-system-generator -dryrun) did. The cause is incmd/quadlet/main.go:Logfwrote each line to/dev/kmsgand only fell back to stderr when that write failed or-dryrunwas set. As root the kmsg write succeeds, so nothing was written to stderr, andsystemd-analyze verifycaptures stderr rather than kmsg.Logfnow writes to/dev/kmsgbest-effort (preserving the early-boot and journal logging that root services rely on atdaemon-reload) and additionally always copies the samequadlet-generator[pid]: ...line to stderr, sosystemd-analyze verifyand interactivesudoruns surface the diagnostics. Rootless behavior, where kmsg is unavailable, is unchanged.Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
git commit -s).Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?
Fixes #28888