Repository navigation
host-setup: prefer a persistent journal over the systemd-journal group - #9
Merged
dafioram merged 1 commit intoOct 4, 2026
Conversation
journald only writes a separate journal per user (readable by that user without extra groups) when logs are stored on disk. The group workaround let users read every log on the system. - ensure_log_access: nothing to do if the user is already in systemd-journal or the journal is persistent (Storage=persistent, or auto with /var/log/journal). Otherwise offer to store the journal on disk via /etc/systemd/journald.conf.d/99-systemd-compose.conf, then restart journald and flush. Check the effective setting afterwards and report when another drop-in still forces volatile storage. - Only if that's declined or fails, offer the systemd-journal group, with a note that it can read all system logs. - The helpers are defined before any action runs, and the script stops after defining them when sourced, so the tests can check them. - 8 tests with fake systemd-analyze/sudo/id/usermod. - README: installation step and troubleshooting entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KdsNJV9e2ktZ9gF5kmczEu
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.
PR 3 of 3 in this round, stacked on the features PR (#8).
Why
journald only writes a separate journal file per user when logs are stored on disk. With in-memory storage, common on DietPi and minimal images,
journalctl --usershows nothing to a normal user. Until nowhost-setup.shworked around this by adding you tosystemd-journal, but that group can read every log on the system.What changes
ensure_log_accessnow goes through these steps:systemd-journal, or the journal is already on disk, it does nothing. On-disk meansStorage=persistent, orStorage=auto(the default) with/var/log/journalpresent./etc/systemd/journald.conf.d/99-systemd-compose.confwithStorage=persistent), restarts journald, flushes, and re-checks the effective setting.Testing
systemd-analyze,sudo,idandusermod, covering every branch.systemd-analyze cat-config.🤖 Generated with Claude Code
https://claude.ai/code/session_01KdsNJV9e2ktZ9gF5kmczEu