Skip to content

Pre-create sovereign-conversation.service's ReadWritePaths targets - #24

Merged
kasunben merged 1 commit into
mainfrom
fix/conversation-service-readwritepaths-provisioning
Aug 23, 2026
Merged

kasunben merged 1 commit into
mainfrom
fix/conversation-service-readwritepaths-provisioning

Conversation

@kasunben

Copy link
Copy Markdown
Member

Summary

  • ReadWritePaths= (unlike StateDirectory=/CacheDirectory=/etc.) does not auto-create a missing target — the path must already exist before systemd can construct the unit's private mount namespace under DynamicUser=yes + ProtectSystem=strict, or the service fails outright (226/NAMESPACE) before the Python code's own lazy path.parent.mkdir() calls ever run
  • Found live on real hardware, in the same signed-release qualification pass as Fix build-image.yml: pass SearXNG's required flags to create-update-release.py #22/Enable llama.cpp, SearXNG, and Conversation Service units in the AB image #23: after a freshly-committed base-OS update — the first time sovereign-conversation.service has ever started under its real DynamicUser sandbox rather than manually as root — both /data/sovereign/capabilities and /data/sovereign/secrets/home-assistant were missing, and the service crash-looped until created by hand
  • This was a previously-disclosed, never-verified risk (see searxng-signed-release-qualification-assessment.md's own Conversation Service smoke-test Limitations)
  • Fixed with an ExecStartPre=+ line (root-privileged, ahead of DynamicUser's own sandbox setup) creating both directories with the same root:sovereign-pihole-secrets/0770 pattern start-pihole already uses for its own DynamicUser-writable directory

Test plan

  • New test_readwritepaths_targets_are_provisioned_before_start — confirmed it fails without the fix, passes with it
  • python3 -m unittest discover -s tests -v — 635/635 pass
  • Verified live on sovereign.local: created both directories by hand with this exact ownership/mode, restarted the service, confirmed active (running) and a real GET /api/v1/conversation/health response

🤖 Generated with Claude Code

Unlike StateDirectory=/CacheDirectory=/etc., ReadWritePaths= does not
auto-create a missing target -- the path must already exist before
systemd can even construct the unit's private mount namespace under
DynamicUser=yes + ProtectSystem=strict, or the service fails outright
(226/NAMESPACE) before sovereign_capabilities.py's/
sovereign_homeassistant.py's own path.parent.mkdir() calls ever get a
chance to run.

Found live on real hardware: after a freshly-committed base-OS update
(the first time this service has ever started under its real
DynamicUser sandbox rather than manually as root), both
/data/sovereign/capabilities and /data/sovereign/secrets/home-assistant
were missing and the service crash-looped until created by hand. This
was a previously-disclosed, never-verified risk
(searxng-signed-release-qualification-assessment.md's own Conversation
Service smoke-test limitations).

Fixed with an ExecStartPre=+ line (root-privileged, ahead of
DynamicUser's own sandbox setup) creating both directories with the
same root:sovereign-pihole-secrets/0770 pattern start-pihole already
uses for its own DynamicUser-writable directory.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kasunben
kasunben marked this pull request as ready for review August 23, 2026 08:04
@kasunben
kasunben merged commit 0a3ae2d into main Aug 23, 2026
1 check passed
kasunben added a commit that referenced this pull request Aug 23, 2026
…fication

Closes PR #17's last open test-plan item ("Real signed-release
qualification: artifact/import systemd paths, real hardened sandbox").
A real, signed 0.1.0-preview.25 release -- built by CI, signed offline
by the maintainer -- was staged, tried, and committed on both the
base-OS and appliance layers of the real qualification device, with
llama-server, SearXNG, and the Conversation Service all confirmed
running under their real production systemd units and hardened
DynamicUser sandboxes.

Records the full method, the three real defects found and fixed along
the way (Findings 5-7, all already merged in #22/#23/#24), and two
incidental findings (systemd Requires= pulls backward not forward; a
stale journal file silently stopped logging after the base-OS commit,
self-resolved, not a code defect).

Updates ROADMAP.md's Milestone 4 to Complete and removes now-stale
"not yet achievable" language throughout that section.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant