Skip to content

fix(devcontainer): find why a rebuilt devcontainer rejects the keyring password #2340

Closed

Description

@dan-petty

Problem Description

After a devcontainer rebuild from a new image, devops devcontainer unlock-keyring rejects the keyring password. The user typed the same password as before the rebuild. We need to find out why.

Reproduction Steps

  1. Use a devcontainer and set a keyring password with devops devcontainer unlock-keyring.
  2. Rebuild the devcontainer from a new image. The home directory keeps ~/.local/share/keyrings/login.keyring.
  3. Run devops devcontainer unlock-keyring and type the same password.

Expected vs Actual Behavior

Expected: the keyring unlocks with the password that was set before the rebuild.
Actual: Wrong password; the keyring is still locked. The prompt was Keyring password:, so an existing login.keyring was found. The file date is before the rebuild.

Environment Diagnostics

  • gnome-keyring-daemon 51.1 in the new image. The version in the old image is unknown.
  • login.keyring has the header GnomeKeyring\n\r\0\n, so it is a valid encrypted keyring. It is 719 bytes.
  • The shell is zsh.

Findings so far

  • _unlock_keyring in src/devops_cli/commands/devcontainer.py sends the raw password to gnome-keyring-daemon --replace --unlock --components=secrets. It adds no newline, and this code has not changed in git history.
  • In a new temporary keyring on 51.1, create then unlock with the same password works. The same password with a trailing newline fails.
  • On a copy of the user's file, the daemon rejects the password as typed and with a trailing newline.

Hypotheses to test

  1. The file was created with a password other than the one the user remembers (for example by an earlier first run or by another tool).
  2. The old image used a different gnome-keyring version that stored or checked the password in another way.
  3. The password has non-ASCII characters, and the locale or encoding differs between images.
  4. The persisted file and a fresh daemon or D-Bus state disagree after a rebuild (for example a stale .keyring-unlock-pending marker or a shared /tmp volume).

Done when

  • The cause is known and recorded here, with evidence.
  • A fix or a failing check exists, or this issue says why none is possible.
  • unlock-keyring gives a clear way forward when an existing keyring rejects the password.

Activity

  1. added
    source/agent
    type/bug
    on Oct 27, 2026
  2. dan-petty commented on Oct 27, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Type: type/bug. The candidate describes a bug in how the devcontainer handles keyring password unlocking after a rebuild.
    • Priority: P2-Medium. This is a medium priority because it affects development workflow but does not block core functionality.
    • Value: Medium. The fix improves usability for developers using devcontainers, which is valuable but not critical to all users.
    • Effort: High. Finding the root cause of a keyring password issue involves complex interactions between system libraries and may require deep debugging.
    • Related: refactor(security): one keyring seam owns the keyring and the Secret Service lock check, with a shared keyring fake and its contract suite #1318, which asks for a different change. Both items relate to keyring handling but ask for different changes: one fixes a devcontainer issue with keyring unlocking, the other refactors keyring usage across functions.
  3. dan-petty commented on Oct 27, 2026

    @dan-petty
    OwnerAuthor

    Root Cause Analysis and Evidence

    Summary

    The rejection of the keyring password after rebuilding the devcontainer is caused by a password mismatch between the entered password and the password used to encrypt the persisted keyring file (Hypothesis 1).

    Analysis of Hypotheses

    1. Hypothesis 2: gnome-keyring version or format change (Disproven)

      • Upstream gnome-keyring source code (pkcs11/secret-store/gkm-secret-binary.c, egg/egg-symkey.c) confirms that the binary keyring format (GnomeKeyring\n\r\0\n, AES-128-CBC, SHA-256 key derivation with salt and iterations, MD5 integrity check) has remained unchanged across versions (42 through 51.1).
      • Upstream release notes show no changes to keyring encryption or decryption. Both version 51.1 and older versions use the same algorithm.
    2. Hypothesis 4: Stale marker or shared /tmp / D-Bus state (Disproven)

      • Tested in an isolated temporary environment with fresh XDG_DATA_HOME, XDG_RUNTIME_DIR, and a new D-Bus session.
      • The persisted file continued to reject the password (locked: True), whereas a freshly created keyring in the identical environment unlocked successfully.
    3. Hypothesis 3: Non-ASCII characters or encoding differences (Disproven)

      • The unlock process passes raw UTF-8 bytes to the daemon. No character set or encoding discrepancy occurs.
    4. Hypothesis 1: Keyring created with a different password (Confirmed)

      • Devcontainers mount the user home directory from a persistent volume, preserving ~/.local/share/keyrings/login.keyring across image rebuilds.
      • When devops devcontainer unlock-keyring runs after a rebuild, it finds the pre-existing keyring file from before the rebuild.
      • If the password entered does not match the password that originally encrypted the file, the daemon fails to decrypt the file's MD5 verification hash and leaves the keyring locked.
      • Because the keyring is encrypted with AES-128-CBC, recovery without the original password is cryptographically impossible.

    Remediation and Way Forward

    devops devcontainer unlock-keyring is updated to provide a clear path forward when an existing keyring rejects the password. The error message explicitly names the keyring file and provides the exact command to move the old file to a backup and unlock a fresh keyring:
    Wrong password; the keyring is still locked. To reset the keyring, move <path> to a backup file and run 'devops devcontainer unlock-keyring'.

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

    source/agenttype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions