Skip to content

host-setup: prefer a persistent journal over the systemd-journal group - #9

Merged
dafioram merged 1 commit into
claude/upbeat-cannon-w8n2qa-featuresfrom
claude/upbeat-cannon-w8n2qa-host-setup
Oct 4, 2026
Merged

dafioram merged 1 commit into
claude/upbeat-cannon-w8n2qa-featuresfrom
claude/upbeat-cannon-w8n2qa-host-setup

Conversation

@dafioram

@dafioram dafioram commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Note: this PR, like #8, was merged into its stacked base branch (claude/upbeat-cannon-w8n2qa-features), not main. Its changes still need a PR into main.

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 --user shows nothing to a normal user. Until now host-setup.sh worked around this by adding you to systemd-journal, but that group can read every log on the system.

What changes

ensure_log_access now goes through these steps:

  1. If you're already in systemd-journal, or the journal is already on disk, it does nothing. On-disk means Storage=persistent, or Storage=auto (the default) with /var/log/journal present.
  2. Otherwise it offers to store the journal on disk (/etc/systemd/journald.conf.d/99-systemd-compose.conf with Storage=persistent), restarts journald, flushes, and re-checks the effective setting.
  3. Only if you decline, or the switch didn't work, it offers the group, with a note that it can read all system logs.

Testing

  • 8 new tests with fake systemd-analyze, sudo, id and usermod, covering every branch.
  • Checked against this machine's real systemd-analyze cat-config.
  • Full suite: 76/76 passing, ShellCheck clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KdsNJV9e2ktZ9gF5kmczEu

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
@dafioram
dafioram merged commit 06bc0b5 into claude/upbeat-cannon-w8n2qa-features Oct 4, 2026
1 check passed
@dafioram dafioram changed the title host-setup: prefer a persistent journal over the systemd-journal group Features (exec, config, limits, CLI) + host-setup persistent journal Oct 4, 2026
@dafioram dafioram changed the title Features (exec, config, limits, CLI) + host-setup persistent journal host-setup: prefer a persistent journal over the systemd-journal group Oct 4, 2026
@dafioram
dafioram deleted the claude/upbeat-cannon-w8n2qa-host-setup branch October 4, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants