Skip to content

fix(glyph): fix atticd database connection with PrivateUsers=true - #533

Merged
stackptr merged 1 commit into
glyph/samba-documentsfrom
glyph/fix-atticd
Aug 25, 2026
Merged

stackptr merged 1 commit into
glyph/samba-documentsfrom
glyph/fix-atticd

Conversation

@stackptr

Copy link
Copy Markdown
Owner

Summary

Fixes atticd crashing on startup after a flake update introduced PrivateUsers=true to the atticd systemd unit.

Root cause

The attic NixOS module added PrivateUsers=true in a recent update, which runs the service inside a user namespace. When atticd connects to PostgreSQL via Unix socket without an explicit user= in the connection string, libpq calls getpwuid() to determine the connecting username. Inside a PrivateUsers namespace, the dynamic user's UID isn't resolvable through the systemd NSS module (the userdb socket isn't bridged into the namespace), so getpwuid() returns null. libpq then falls through to check USER/LOGNAME env vars — neither of which is set in the service environment — and finally falls back to the hardcoded default "anonymous". PostgreSQL rejects the connection with role "anonymous" does not exist.

Fix

Add user=atticd as an explicit query parameter to the database URL. This bypasses getpwuid() entirely.

# before
postgresql:///atticd?host=/run/postgresql

# after
postgresql:///atticd?host=/run/postgresql&user=atticd

Note: the user@host URL form (postgresql://atticd@/atticd?...) was attempted first but rejected by the Rust PostgreSQL driver — the query parameter form is the correct approach for Unix socket connections.

Stacked on

🤖 Generated with Claude Code

@stackptr
stackptr force-pushed the glyph/fix-atticd branch 6 times, most recently from e220524 to 543969f Compare August 25, 2026 22:47
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 56deb6fb6377
@stackptr
stackptr merged commit d8d3c74 into main Aug 25, 2026
5 checks passed
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