fix(glyph): fix atticd database connection with PrivateUsers=true - #533
Merged
Merged
Conversation
stackptr
force-pushed
the
glyph/fix-atticd
branch
6 times, most recently
from
August 25, 2026 22:47
e220524 to
543969f
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Entire-Checkpoint: 56deb6fb6377
stackptr
force-pushed
the
glyph/fix-atticd
branch
from
August 25, 2026 22:52
543969f to
72a6c67
Compare
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.
Summary
Fixes atticd crashing on startup after a flake update introduced
PrivateUsers=trueto the atticd systemd unit.Root cause
The attic NixOS module added
PrivateUsers=truein a recent update, which runs the service inside a user namespace. When atticd connects to PostgreSQL via Unix socket without an explicituser=in the connection string, libpq callsgetpwuid()to determine the connecting username. Inside aPrivateUsersnamespace, the dynamic user's UID isn't resolvable through the systemd NSS module (the userdb socket isn't bridged into the namespace), sogetpwuid()returns null. libpq then falls through to checkUSER/LOGNAMEenv vars — neither of which is set in the service environment — and finally falls back to the hardcoded default"anonymous". PostgreSQL rejects the connection withrole "anonymous" does not exist.Fix
Add
user=atticdas an explicit query parameter to the database URL. This bypassesgetpwuid()entirely.Note: the
user@hostURL 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