Skip to content

fix(linux): create default Secret Service collection when missing#49

Merged
juacker merged 1 commit into
mainfrom
fix/create-default-keyring-collection
Jun 11, 2026
Merged

fix(linux): create default Secret Service collection when missing#49
juacker merged 1 commit into
mainfrom
fix/create-default-keyring-collection

Conversation

@juacker

@juacker juacker commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Problem

On Xubuntu live sessions, autologin setups, and fresh user accounts, creating the first provider fails with:

Failed to store provider credential: Couldn't access platform secure storage: Secret Service: no result found

gnome-keyring is running with the secrets component, but no keyring collection exists (~/.local/share/keyrings/ is empty): PAM only creates and unlocks the login collection during a password login, which never happens with autologin/live sessions. The Secret Service then has nothing behind the default alias and returns no result found, blocking onboarding.

The keyring crate (3.x) cannot self-heal: its create path for the special default target calls get_default_collection() again instead of creating a collection, so every write keeps failing.

Fix

On Linux, when a secret write fails with NoStorageAccess: ... no result found:

  1. Call SecretService::create_collection("Default keyring", "default") via dbus-secret-service — the daemon shows its own password dialog (same UX as secret-tool / Seahorse), so the user owns the keyring password and the collection is the system-wide default, shared by every libsecret consumer.
  2. Retry the write once.
  3. If the user dismisses the dialog, return an actionable error (mentioning Seahorse and the autologin caveat) instead of the cryptic one.

dbus-secret-service is the exact crate+version keyring already uses for its sync secret-service backend, so this adds no new transitive code. Reads/deletes are unchanged (NoEntry was already handled).

Testing

  • cargo check passes.
  • Reproduced on a Xubuntu live ISO: provider creation failed with the error above; after creating a default collection (manually via secret-tool, which performs the same D-Bus call this PR automates) credential storage works.

On live sessions, autologin setups, and fresh accounts, gnome-keyring may
run with no keyring collection at all: PAM only creates the login
collection during a password login. Storing a provider/MCP credential then
fails with "Secret Service: no result found", blocking onboarding.

The keyring crate cannot self-heal here: its create path for the special
'default' target only re-reads the alias instead of creating a collection.

Detect this case on secret writes and ask the Secret Service daemon to
create a collection registered as the 'default' alias (the daemon shows
its own password dialog, so the user owns the keyring password), then
retry the write once. If the user dismisses the dialog, return an
actionable error instead of the cryptic one.

Uses dbus-secret-service directly - the same crate/version keyring already
pulls in for its sync secret-service backend, so no new transitive code.
@juacker juacker merged commit 66255a8 into main Jun 11, 2026
1 check 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