Skip to content

Linux: gog runs dbus-launch at startup, and DBUS_SESSION_BUS_ADDRESS=disabled: skips the file fallback #1258

Open

Description

@pkyIntelligence

Summary

On headless Linux/WSL2 with no session bus, every gog invocation — even gog --version with GOG_KEYRING_BACKEND=file — can spawn dbus-launch. On our WSL2 host this leaked 575 session dbus-daemon processes, exhausted the inotify instance limit (max_user_instances=128), and left daemons holding temporary HOME directories open so our tooling could not clean them up.

Setting DBUS_SESSION_BUS_ADDRESS=disabled: stops the launches, but auto then no longer falls back to the file backend (it picks pass and fails if the store isn't initialized).

Reproduction

Tested with the official Linux amd64 release v0.46.0 (e0e3cb9c 2026-10-21T05:43:32Z) on WSL2 Linux 6.6.114.1. No Google credentials or network requests are needed. Set GOG_BIN to the absolute path of that release binary. Run in Bash:

GOG_BIN=/absolute/path/to/gog
probe=$(mktemp -d)
mkdir -p "$probe/bin" "$probe/home"
cat > "$probe/bin/dbus-launch" <<'SH'
#!/bin/sh
printf 'launch\n' >> "$PROBE_LOG"
exit 1
SH
chmod +x "$probe/bin/dbus-launch"
: > "$probe/launches.log"

run_gog() {
  env -i PATH="$probe/bin:/usr/bin:/bin" HOME="$probe/home" \
    XDG_CONFIG_HOME="$probe/config" XDG_DATA_HOME="$probe/data" \
    XDG_STATE_HOME="$probe/state" XDG_CACHE_HOME="$probe/cache" \
    XDG_RUNTIME_DIR="$probe/runtime" GOG_HOME="$probe/gog" \
    GNUPGHOME="$probe/gnupg" PASSWORD_STORE_DIR="$probe/pass" \
    GOG_KEYRING_PASSWORD=synthetic-probe-password \
    PROBE_LOG="$probe/launches.log" "$@"
}
run_gog GOG_KEYRING_BACKEND=file "$GOG_BIN" --version
wc -l < "$probe/launches.log"
# Observed: 2 launcher attempts, despite --version and file backend.

# Requires pass installed, but no initialized password store:
printf 'synthetic-not-a-real-token\n' | run_gog \
  DBUS_SESSION_BUS_ADDRESS=disabled: GOG_KEYRING_BACKEND=auto \
  "$GOG_BIN" --no-input auth import --email probe@example.invalid \
  --refresh-token-stdin
# Fails: pass init your-gpg-id; store token: set token: exit status 1

printf 'synthetic-not-a-real-token\n' | run_gog \
  DBUS_SESSION_BUS_ADDRESS=disabled: GOG_KEYRING_BACKEND=file \
  "$GOG_BIN" --no-input auth import --email probe@example.invalid \
  --refresh-token-stdin
# Succeeds; neither disabled: invocation adds launcher attempts.

The failing fake launcher causes two attempts; it demonstrates startup execution, not daemon persistence. Without pass installed, the second symptom may differ. The first step assumes /run/user/<uid>/bus and dbus-session are absent; godbus checks those before launching.

Cause

Upstream dependency report: 99designs/keyring#103.

Suggestion

Would you be open to (1) avoiding D-Bus until a command actually needs a keyring backend, and (2) treating disabled:/unreachable buses like a missing bus for the auto fallback? Happy to send a PR once we agree on the approach.

Investigated and reproduced with AI assistance (the Astrarch agent team); the reproduction was verified on a real host.

Activity

  1. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    P1Urgent regression or broken agent/channel workflow affecting real users now.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.
    impact:crash-loopThis issue is about crashes, hangs, restart loops, or process-level availability.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    and removed
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Oct 23, 2026
  2. clawsweeper commented on Oct 23, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    Keep open: the disabled-bus fallback is released, but the pinned dependency still connects to D-Bus during package initialization, and maintainer discussion explicitly preserves this issue for that remaining defect.

    Reproducibility: Current imports and pinned dependency source establish launcher execution before main when no session bus is configured or discoverable; the reporter and maintainer provide built-CLI probes, but this review ran no reproduction or tests.

    Root-cause cluster
    Relationship: canonical
    Canonical: #1258
    Summary: This issue retains the eager-startup defect after a merged PR fixed only explicit-disabled-bus fallback; searches found no separate current owner for the remaining work.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Maintainer decision needed

    • Question: Which dependency delivery strategy should remove eager D-Bus initialization while retaining desktop keyrings?
    • Recommendation: Adopt a minimal lazy-initialization change: Prefer an upstream patch or narrowly maintained dependency patch, backed by startup and existing-credential regressions.
    • Why: The defect executes before gog's runtime guards, and the linked upstream workaround removes functionality rather than demonstrating compatible lazy initialization.

    Next step
    Choose a compatible dependency-level lazy-initialization fix and establish a failing subprocess regression for file-backend --version without a discoverable session bus.

    Review details

    Best possible solution:

    Defer dependency D-Bus connections until an applicable backend is opened while preserving existing credentials and the released disabled-bus fallback.

    Do we have a high-confidence way to reproduce the issue?

    Current imports and pinned dependency source establish launcher execution before main when no session bus is configured or discoverable; the reporter and maintainer provide built-CLI probes, but this review ran no reproduction or tests.

    Is this the best way to solve the issue?

    Lazy dependency initialization addresses the remaining failure boundary; broad fallback for unreachable desktop buses could hide existing credentials and should remain outside this repair.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • Removing startup I/O requires a dependency strategy that preserves desktop SecretService and KWallet behavior and access to existing credentials.
    • The reported daemon accumulation and inotify exhaustion were not independently reproduced during this read-only review.

    Codex review notes: model internal, reasoning medium; reviewed against 6d97417eade9.

    Label changes

    Label changes:

    • remove impact:auth-provider: Current review impact labels are impact:crash-loop.

    Label justifications:

    • P1: An official-release report describes repeated startup process leakage exhausting host resources, and current pinned source retains the launcher path.
    • impact:crash-loop: The remaining startup side effect can accumulate session daemons and impair process-level availability on headless hosts.
    Evidence reviewed

    Acceptance criteria:

    • go test ./internal/secrets ./cmd/gog
    • make ci
    • Under an isolated Linux user without discoverable bus files, verify an inert fake dbus-launch records zero attempts for GOG_KEYRING_BACKEND=file gog --version.
    • Verify synthetic-token import and readback with DBUS_SESSION_BUS_ADDRESS=disabled:, auto selection, and an installed but uninitialized pass store.
    • Verify existing encrypted-file, SecretService, and KWallet credentials remain readable.

    What I checked:

    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed November 14, 2026, 12:33 PM ET / 17:33 UTC.

  3. steipete commented on Oct 26, 2026

    @steipete
    Collaborator

    The explicit-disabled-bus fallback is fixed by #1266, merged as 16dfdd8. On headless Linux, DBUS_SESSION_BUS_ADDRESS=disabled: with GOG_KEYRING_BACKEND=auto now selects encrypted file storage, matching the missing-bus case.

    Proof: the built CLI imported a synthetic token and read back the stored account with zero pass or dbus-launch invocations. Linux CLI proof. Focused keyring/rekey tests, local make ci, and CI on the exact PR head passed, including Linux, minimum-Go, macOS, Windows, and Worker checks.

    Thanks @pkyIntelligence for the reproduction. Leaving this issue open: the dependency's eager D-Bus initialization when the address is not explicitly disabled still needs a separate upstream fix.

  4. steipete commented on Oct 27, 2026

    @steipete
    Collaborator

    Rechecked the remaining startup behavior on the dependency-update candidate in #1274. Under an isolated Linux user without a session bus, a fake launcher records two dbus-launch attempts for GOG_KEYRING_BACKEND=file gog --version. With DBUS_SESSION_BUS_ADDRESS=disabled: and GOG_KEYRING_BACKEND=auto, importing a synthetic token succeeds with zero launcher attempts. Built-CLI probe.

    The disabled-bus fallback from #1266 remains correct. Keeping this issue open for the eager D-Bus initialization in the pinned keyring dependency; current package initialization still runs before gog chooses its backend. No real Google credentials or daemon launches were used in the probe.

  5. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    and removed
    impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopThis issue is about crashes, hangs, restart loops, or process-level availability.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions