See Ash Code logo See Ash Code

What “unlocked” meant during my keyring repair

Ashlynn Antrobus
• • 3 min read

The unlock command printed a socket path. The collection was still locked.

That was one of several misleading successes during my October keyring repair. The graphical prompt rejected my password. Methods that had previously worked from the command line stopped working. Starting another daemon could change the output without unlocking the collection my applications were using.

There were four saved items to preserve. Replacing the keyring with an empty one would have made the investigation much easier and defeated its purpose.

An older GNOME Keyring interface lists keyrings and a stored item with its password masked.

A separate example of the keyring interface, not my collection: GNOME Keyring screenshot, GNOME and karderio, GNU LGPL 2.1 or later; unmodified.

I had to identify which daemon owned the collection

The relevant pieces were connected like this:

Application in the intended user session
  -> user D-Bus: org.freedesktop.secrets
       -> authoritative gnome-keyring-daemon
            ├─ control socket in the user runtime directory
            └─ stored login.keyring collection: four items

Graphical unlock prompt -> interaction with that service

An isolated temporary D-Bus session could activate a different daemon. Successfully talking to it wouldn’t establish that an application on the normal user bus could access the same collection.

By the end of the process investigation, seven orphaned keyring daemons were involved. Several listeners appeared against the same control path. Stopping the systemd unit hadn’t stopped those independent processes.

After terminating the identified orphans and restarting the user service and socket, one daemon owned both the Secret Service name and the control socket. That made the next unlock test meaningful.

The password had an invisible extra byte

The other problem was a trailing newline in the keyring’s actual password. During the earlier interactive setup, I’d pressed Enter before sending EOF. The newline had become part of what the keyring expected.

That explained why typing the visible password into another interface wasn’t necessarily supplying the same bytes. A patched unlock utility preserved its input exactly and could send the password the existing keyring needed.

I verified the collection’s Locked property rather than treating a successful-looking command as proof:

org.freedesktop.Secret.Collection.Locked
  before unlock: true
  after unlock:  false

Recovery included checking the saved items

Once the real collection was unlocked, I changed its password through the existing daemon to remove the unwanted newline. The encrypted keyring was backed up first. Verification with the new password recovered all four item sections.

The unlock script then needed to send the new password without adding a newline. The final lock-and-unlock repair used that script against the same authoritative daemon. I kept the distinction between the collection’s lock state and the integrity of its saved contents: both needed checking.

The account running the application had to reach the daemon that could unlock those four items. I’d run into a similar problem matching a visible window to the right process in the browser repair.

AA

Written by Ashlynn Antrobus

Software developer, author, and builder. Sharing technical lessons learned from building tools like Ebook2Text, IndexedDict, and rag-mcp, and navigating life as a programmer with dyslexia.