← Back to issue list

[1.5.0] Charmcraft login not finding keyring

View original Github issue

Metadata

Project
charmcraft
Number
#719
Type
issue
State
closed
Author
phvalguima
Labels
Created
Updated
Closed

Current evaluation

Closed without a code fix. Identified as an environmental configuration issue. Users resolved it by using dbus-run-session or explicitly setting PYTHON_KEYRING_BACKEND to bypass automatic keyring detection failures.

Suggested action:

No scores available.

Issue body

Hi, My snap has upgraded to: 1.5.0+7.g51565d8 When I run: ``` $ sudo -u <user> charmcraft login No keyring found to store or retrieve credentials from. Full execution log: ... ``` Running the same command with debug option returns: ``` $ sudo -u <user> charmcraft login -v 2022-03-18 15:52:12.112 Starting charmcraft version 1.5.0+7.g51565d8 2022-03-18 15:52:12.112 Logging execution to 2022-03-18 15:52:12.199 No keyring found to store or retrieve credentials from. 2022-03-18 15:52:12.200 Traceback (most recent call last): 2022-03-18 15:52:12.200 File "/snap/charmcraft/849/lib/charmcraft/commands/store/store.py", line 179, in __init__ 2022-03-18 15:52:12.200 self._client = Client(charmhub_config.api_url, charmhub_config.storage_url) 2022-03-18 15:52:12.200 File "/snap/charmcraft/849/lib/charmcraft/commands/store/client.py", line 57, in __init__ 2022-03-18 15:52:12.200 super().__init__( 2022-03-18 15:52:12.200 File "/snap/charmcraft/849/lib/craft_store/store_client.py", line 84, in __init__ 2022-03-18 15:52:12.200 super().__init__( 2022-03-18 15:52:12.200 File "/snap/charmcraft/849/lib/craft_store/base_client.py", line 65, in __init__ 2022-03-18 15:52:12.200 self._auth = Auth( 2022-03-18 15:52:12.200 File "/snap/charmcraft/849/lib/craft_store/auth.py", line 103, in __init__ 2022-03-18 15:52:12.200 raise errors.NoKeyringError() 2022-03-18 15:52:12.200 craft_store.errors.NoKeyringError: No keyring found to store or retrieve credentials from. ``` Which fails in this check: ``` ... self._keyring = keyring.get_keyring() # This keyring would fail on first use, fail early instead. if isinstance(self._keyring, keyring.backends.fail.Keyring): ## <<<<---------------------- raise errors.NoKeyringError() ... ``` However, if I manually install the same keyring lib (23.5.0) and just run it, I get: ``` $ sudo -u <user> python3 -c "import keyring; key=keyring.get_keyring(); print(key)" keyring.backends.libsecret.Keyring (priority: 4.8) ``` I was expecting to actually see ```keyring.backends.fail.Keyring```, just like it happens with auth.py above. Nonetheless, I'd expect ```charmcraft login``` to always work, even if I do not have a keyring. Or at least give me exact steps of what I should be doing as an user to setup the keyring and login. Also, I am using "sudo" just because my original user was logged in with charmcraft when we used to have v1.4.0 and I could not reproduce the issue with that user. When running with sudo, it likely misses some of the variables needed to correctly configure charmcraft. Workaround: ``` $ keyring --list # select one of the keyrings $ sudo -u <user> PYTHON_KEYRING_BACKEND=<chose-keyring> charmcraft login ```

Evaluation history

Date Model Scores Action Summary
qwen3.6-35b-a3b-mtp-q6 Closed without a code fix. Identified as an environmental configuration issue. Users resolved it by using dbus-run-session or explicitly setting PYTHON_KEYRING_BACKEND to bypass automatic keyring detection failures.
qwen/qwen3.6-35b-a3b Closed. Not code-fixed; users resolved the keyring detection failure by setting PYTHON_KEYRING_BACKEND or running charmcraft in a dbus session with gnome-keyring-daemon. Maintainers directed users to upstream keyring documentation for headless environments.
qwen/qwen3.6-35b-a3b Closed. The failure stems from keyring library behavior in headless or VM environments, not a charmcraft bug. Resolved by setting PYTHON_KEYRING_BACKEND or executing commands via dbus-run-session with gnome-keyring-daemon.
qwen3.6-35b-a3b-mtp-q6 Closed as a headless environment config issue. Users must run charmcraft in a dbus session and unlock gnome-keyring. A dbus-run-session and gnome-keyring-daemon workaround was confirmed effective.
qwen3.6-35b-a3b-mtp-q6 Closed without a fix. charmcraft login failed due to keyring detection issues. Maintainers directed users to upstream keyring docs. Resolution relies on workarounds like PYTHON_KEYRING_BACKEND or dbus-run-session with gnome-keyring-daemon.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#672 charmcraft 1.4.0: impossible to login to charmhub charmcraft closed Closed as expected behavior. Charmcraft falls back to a non-persistent memory ring on headless systems lacking a keyring, preventing credential persistence. Maintainers advised exporting credentials via environment variables instead of implementing a code fix.
74%