omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Passwordless cleartext default keyring is destroyed by any app that stores a multi-line secret, leaving an unlock prompt on every autologin boot

Open duckzooka opened this issue 2 months ago • 4 comments

What happened

On a stock Omarchy install with autologin, an unlock dialog started appearing on every boot:

Authentication required — An application wants access to the keyring "Default Keyring", but it is locked.

Nothing in the dialog identifies the cause, and it began days after the change that triggered it. The root cause is that Omarchy's passwordless cleartext default keyring cannot survive an application storing a multi-line secret — and once it is corrupted, autologin guarantees the replacement keyring can never be unlocked automatically.

Expected

Either the passwordless keyring keeps working regardless of what a Secret Service client stores, or the breakage is surfaced as itself rather than as a recurring password prompt for a keyring the user never knowingly created.

Mechanism

  1. install/user/default-keyring.sh writes ~/.local/share/keyrings/Default_keyring.keyring in gnome-keyring's cleartext format (no password), and install/login/sddm.sh strips the pam_gnome_keyring auth lines from /etc/pam.d/sddm. This is deliberate and necessary: autologin means PAM never receives a password, so a password-protected keyring could never be unlocked (gkr-pam: no password is available for user on every boot).

  2. The cleartext format is line-based INI, with each secret written as a single secret= line. Any application that stores a value containing a newline therefore writes a file gnome-keyring can no longer parse. In my case Ente Auth (ente-auth-bin, via flutter_secure_storage_linux) stored a 194-byte pretty-printed JSON blob containing 4 raw newlines.

  3. The write reports success and works for the rest of that session, because the daemon serves it from memory. On the next boot:

    gnome-keyring-daemon[1060]: keyring was in an invalid or unrecognized format: \
        /home/<user>/.local/share/keyrings/Default_keyring.keyring
    
  4. The daemon rejects the entire file, so unrelated secrets go with it — here Chromium's Chromium Safe Storage key, which Omarchy itself points at libsecret (see #10346). With no loadable default keyring, the next client to ask for a secret triggers gnome-keyring's create-a-keyring prompt, and the keyring that gets created is password-protected (Default_Keyring.keyring, with ~/.local/share/keyrings/default repointed to it).

  5. From then on, every boot: autologin gives gkr-pam nothing, the keyring stays locked, and the first autostarted Secret Service client raises the dialog. On my machine that is the Remmina applet, four seconds into the session.

Steps to reproduce

  1. Stock Omarchy install with autologin enabled (the default).
  2. Install any application that stores a multi-line secret via libsecret — e.g. ente-auth-bin, or any Flutter app using flutter_secure_storage — then launch it and sign in.
  3. journalctl -b | grep -i 'unrecognized format' — the default keyring is already unparseable.
  4. Reboot. Accept the keyring-creation prompt (or let an app trigger it).
  5. Reboot again → the "Default Keyring is locked" dialog now appears on every boot.

Evidence

# every boot, twice
gnome-keyring-daemon[1060]: keyring was in an invalid or unrecognized format: \
    /home/<user>/.local/share/keyrings/Default_keyring.keyring

# every boot, inherent to autologin
sddm-helper[1100]: gkr-pam: no password is available for user
sddm-helper[1100]: gkr-pam: couldn't unlock the login keyring.

# the corrupting record, as written into the cleartext keyring (values redacted)
[3]
item-type=0
display-name=io.ente.auth/FlutterSecureStorage
secret={
  "auth_secret_key": "<REDACTED>",
  "key": "<REDACTED>",
  "secret_key": "<REDACTED>",
}
mtime=1788365819
ctime=1788365819

System details

  • Omarchy 4.0.3-1, Arch Linux, kernel 7.2.3-arch1-3
  • gnome-keyring 1:50.0-1, libsecret 0.21.7-1, sddm 0.21.0-7
  • /etc/sddm.conf.d/autologin.conf with User=/Session=omarchy.desktop
  • LUKS full-disk encryption, passphrase at boot, no TPM enrollment
  • Trigger package: ente-auth-bin 4.4.24-1

(omarchy debug --no-sudo --print is referenced in the contributing docs but there is no debug route in 4.0.3 — omarchy commands --all has no match — so the above is assembled by hand.)

Suggested directions

  • Don't let it fail silently. Detect an unparseable keyring at login and surface it, rather than letting gnome-keyring quietly create a password-protected replacement that autologin can never open. The user-visible symptom is currently indistinguishable from an unrelated misconfiguration.
  • Or move off the cleartext format. Provision a password-protected keyring and unlock it at session start from a 0600 file in the user's home — the binary format stores secrets as opaque byte buffers, so arbitrary bytes are safe. On a LUKS install this is the same security boundary the cleartext keyring already relies on. That is what I did locally: a Type=oneshot user unit ordered Before=xdg-desktop-autostart.target that calls org.gnome.keyring.InternalUnsupportedGuiltRiddenInterface.UnlockWithMasterPassword on the collection returned by ReadAlias("default"). It runs about three seconds before the first autostarted client asks for a secret.
  • At minimum, document the constraint, since the failure mode is silent, delayed, and presents as an unexplained password prompt.

The app-side fix is being tracked upstream at juliansteenbakker/flutter_secure_storage#951 (base64-encode before storing). But storing a newline-containing secret is legal per the Secret Service API and round-trips fine in a password-protected keyring, so any Secret Service client can reproduce this — it isn't specific to Ente Auth or to Flutter.

Possibly related

  • #9235 — same end state (secrets orphaned, keyring recreated), different mechanism: two daemons racing on the file. Worth checking whether some reports there are actually this bug.
  • #10243 / #10396 — pam_gnome_keyring stripped from sddm but not sddm-autologin
  • #10127 — closed: keyring recreated on password-based SDDM login
  • #4004 — closed: "Keyring 'Default' asked to be created at every start up"
  • #10346 — pins Electron's password store to gnome-libsecret, which widens the set of apps writing into this keyring
  • #10984 — pins gcr-prompter's workspace, i.e. treats the symptom's placement

duckzooka avatar Sep 10 '26 15:09 duckzooka

Hit the identical failure on Omarchy 4.0.2, with a different trigger: Proton VPN (proton-vpn-qt-app 1.10.6 / python-proton-keyring-linux 0.2.3). Its SSO session item is a JSON blob with embedded PEM certificates (~2.5 KB, 19 raw newlines). Result over 9 days: four successive keyring files (Default_keyring, Default_Keyring, Default_Keyring_1, Default_keyring_1), each one working for a session, then rejected at the next boot with keyring was in an invalid or unrecognized format, and Chrome/Chromium/Slack/VS Code/gh/omamail all losing their keys each time. Chrome drops every cookie and saved login it can no longer decrypt, so this reads to the user as "all my passwords are gone after every reboot".

Two things worth adding to the analysis above:

1. Upstream mechanism, and why it is repairable without data loss. In pkcs11/secret-store/gkm-secret-textual.c gnome-keyring writes secrets with g_key_file_set_value() (raw, no escaping) but reads them back with g_key_file_get_string() (which unescapes \n). So a secret containing a newline is written as a physical line break, and GKeyFile refuses the file on reload. Because the reader unescapes, folding the stray lines back into the secret= line as literal \n gives the daemon exactly the value it holds in memory — nothing changes for any app. Upstream: gnome-keyring#103 and gnome-keyring#147; the Proton side is tracked in ProtonVPN/proton-vpn-gtk-app#100 and ProtonVPN/python-proton-keyring-linux#5. The encrypted (binary) format is unaffected, which is why this only bites passwordless/autologin setups, i.e. every stock Omarchy install.

2. A mitigation Omarchy could ship today. Since the daemon serves the corrupted file fine from memory and only fails on the next start, a repair step immediately before the daemon starts fixes it before anything is lost. I am running this as a drop-in on the user unit:

# ~/.config/systemd/user/gnome-keyring-daemon.service.d/keyring-repair.conf
[Service]
ExecStartPre=-%h/.local/bin/keyring-repair

keyring-repair (python, uses GLib.KeyFile from python-gobject, already on every Omarchy install) does, for each ~/.local/share/keyrings/*.keyring that starts with [keyring]:

  • try GLib.KeyFile.load_from_file(); if it loads, do nothing;
  • otherwise copy the file aside, then walk it line by line: a line is a real key only if it is one of the keys the text format ever writes (display-name, ctime, mtime, lock-on-idle, lock-after, item-type, secret, binary-secret, name, type, value); any other non-header line is appended to the previous value as \n. Matching on the known key set matters because base64 lines can end in = and JSON lines contain =;
  • verify the result loads with GLib.KeyFile, and only then replace the file atomically.

Tested against the three real corrupted files from this machine: all load afterwards and every secret, including the multi-line Proton one, reads back byte-identical to the original raw text via get_string(). Happy to turn this into a PR (script under bin/ plus the drop-in written by default-keyring.sh) if maintainers want it; it is a small, self-contained guard that would have prevented this issue, #9235 and #5105.

For Proton VPN specifically, the app can be kept out of gnome-keyring entirely with PROTON_LOADER_OVERRIDES=keyring=json (e.g. in ~/.config/environment.d/), which makes it use its own JSON-file backend under ~/.config/Proton/.

philipleuf avatar Sep 15 '26 15:09 philipleuf

Third independent reproduction, same trigger as philipleuf's comment: Proton VPN SSO item (a ~2.4 KB JSON blob with 17 raw newlines, proton-sso-account-*). This time on gnome-keyring 1:50.0, SDDM autologin. After an Omarchy update + reboot the daemon rejected the default keyring (keyring was in an invalid or unrecognized format), the create-keyring prompt fired, and an empty Default_1.keyring became the default — orphaning 9 secrets (GitHub x2, Proton SSO x2, Home Assistant, Chromium/Code Safe Storage, Mojang token, Chrome dummy entry).

Wanted to add a verified, self-contained workaround for the durable side (moving off cleartext), in case it helps others stuck between boots:

  1. Recovered the secrets from the rejected cleartext file (plain INI parse, values intact).
  2. Created a password-protected collection headless via org.gnome.keyring.InternalUnsupportedGuiltRiddenInterface.CreateWithMasterPassword on /org/freedesktop/secrets (the high-level secretstorage API can't do it — CreateCollection/unlock always go through a prompt), then stored all items into it.
  3. Made the protected file the default: renamed it to ~/.local/share/keyrings/Default.keyring (the filename, not SetAlias, is what the daemon resolves as the default collection for GetDefaultCollection/ReadAlias("default")) and set the default pointer file to Default.
  4. A Type=simple user unit After=gnome-keyring-daemon.service that calls UnlockWithMasterPassword from a 0600 master-password file at session start.

Verified across a full cold systemctl --user restart gnome-keyring-daemon: the protected file loads as Default, stays Locked=true at rest, the unit unlocks it, and secret-tool lookup returns every secret (including the multi-line Proton one, byte-identical). No prompt at autologin.

So the binary-format direction suggested in the issue works in practice and is scriptable without any user interaction. The in-place textual repair in #11697 is obviously less invasive (no re-encryption of everything), so I'm not advocating for one approach over the other — just confirming both ends of the problem (diagnosis + durable mitigation) on a fourth machine.

exclude-barrier avatar Sep 16 '26 13:09 exclude-barrier

Automated duplication check: this issue looks similar to #5105, which covers the same Keyring invalid format wipes stored secrets. I keep that one open and close this one to keep the discussion in one place.

If you feel this is the wrong decision, please open the issue again with a note on the difference.

bjarneo avatar Sep 21 '26 05:09 bjarneo

Reproduced this with a different trigger — Seahorse's "Change Password" also causes it, not just multi-line-secret writes

Hit this same failure mode independently tonight, via a different path than described above. Posting here since it looks like the same root cause, just a different way to trigger it.

Environment: Omarchy (current as of Sep 2026), SDDM + Hyprland/uwsm session, on a LUKS-encrypted root.

Reproduction (no app involved — pure GUI action):

  1. Open Seahorse ("Passwords and Keys"), right-click the "Default" keyring → Change Password.
  2. Set any new password — reproduces with both a blank password and a non-blank one.
  3. Reboot.
  4. gnome-keyring-daemon logs keyring was in an invalid or unrecognized format: .../Default.keyring and silently creates a new, empty replacement collection instead of using the existing one — same symptom as the original report (unlock prompt appears, previously-stored secrets are inaccessible via the daemon).

This suggests the underlying bug isn't specific to apps writing multi-line secrets — it looks like gnome-keyring-daemon's own write path (at least via Seahorse, possibly more broadly) produces an on-disk format its own reader can't parse back on next start.

Also reproduces with autologin disabled, not just during autologin as the title implies — same exact failure, same log line, whether or not /etc/sddm.conf.d/autologin.conf is present.

Secondary complication found: repeating this cycle a few times (each corruption → daemon creates a new collection → that one also gets touched/corrupted later) leaves multiple Default_N.keyring files behind in ~/.local/share/keyrings/, all internally reporting collection name "Default" (confirmed via file(1): a genuinely valid one reports as GNOME keyring, major version 0, minor version 0, crypto type 0 (AES)..., while a corrupted one just reports as plain ASCII text). With multiple same-named collections on disk, which one the daemon picks as "the" Default collection seems to vary across boots, compounding the confusion.

Workaround that's been stable across multiple reboots for us:

  • Identify the one genuinely valid file with file ~/.local/share/keyrings/*.keyring (look for the GNOME keyring, major version 0... signature vs. plain ASCII text).
  • Delete the other/corrupted/empty duplicates so there's no ambiguity.
  • Set the password through the native "create new keyring" prompt that appears automatically at boot when no valid collection exists — not retroactively via Seahorse, which appears to be part of what triggers this.
  • A passwordless "Default" keyring currently seems unsafe to rely on for this reason — any tool touching it (multi-line secret, or just Seahorse) seems able to retrigger the corruption.

Happy to provide journalctl excerpts or further detail if useful.

alFrame avatar Sep 30 '26 18:09 alFrame