Skip to content

proton-bridge: clear stale gpg locks before key check#2

Merged
mgarratt merged 1 commit into
mainfrom
fix/proton-bridge-stale-gpg-locks
Jun 20, 2026
Merged

proton-bridge: clear stale gpg locks before key check#2
mgarratt merged 1 commit into
mainfrom
fix/proton-bridge-stale-gpg-locks

Conversation

@mgarratt

Copy link
Copy Markdown
Owner

Problem

When the proton-bridge container is killed (OOM, node drain, crash), it leaves stale gpg lock files (public-keys.d/pubring.db.lock) and agent sockets (S.gpg-agent*, S.keyboxd) in the persisted GNUPGHOME on the data volume.

On restart, the entrypoint's gpg --batch --list-keys ProtonMailBridge check blocks on the stale lock until it times out, so key_exists=false. With the password store present, that hits the true:false branch and the container exits with:

ERROR: password store exists but ProtonMailBridge GPG key is missing

The key material is actually intact — gpg just can't read past the stale lock (held by a dead PID). This is self-perpetuating: every killed container leaves a fresh lock, so it crash-loops.

Fix

Clear stale gpg lock files and sockets at entrypoint startup, before the key check. Nothing gpg-related is running yet at that point, so removal is safe.

Notes

Observed in production: a bridge pod that had been down for ~2 months refused to start with the above error. Clearing the stale lock manually let it start immediately, confirming the key was fine.

🤖 Generated with Claude Code

A killed container leaves stale gpg lock files and agent sockets in the
persisted GNUPGHOME on the data volume. On restart, `gpg --list-keys`
blocks on the stale lock until it times out, so the entrypoint wrongly
concludes the ProtonMailBridge key is missing and refuses to start.
Clear stale locks/sockets at startup, before the key check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mgarratt mgarratt merged commit dadfc2e into main Jun 20, 2026
3 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