← Back to issue list

Should support keyrings.alt backend for headless systems

View original Github issue

Metadata

Project
charmcraft
Number
#2687
Type
issue
State
open
Author
panlinux
Labels
Created
Updated
Closed

Current evaluation

charmcraft login on headless systems cannot persist credentials: no keyring is available, and the keyrings.alt backend is not bundled in the snap, so PYTHON_KEYRING_BACKEND crashes with ModuleNotFoundError. Unlabeled, no maintainer response.

Suggested action: needs triage

Reason: The issue has no labels, zero comments, and no maintainer acknowledgement in 113 days, so it has not been triaged. It remains valid: current store.py still relies on keyring with only an ephemeral fallback (from PR #1741), and keyrings.alt is absent from pyproject.toml and the snap, so the ModuleNotFoundError is still reproducible. Bundling python3-keyrings.alt (or an equivalent file-based backend) is a plausible fix but needs a maintainer decision on backend choice and passphrase handling for headless use.

Impact: 45 Quick Win: 29.25 Staleness: 50 Complexity: 35 Confidence: 80 Support Request: 15

Issue body

### Check existing issues - [x] I've verified that this bug isn't described by any existing issues. ### Bug description On a headless system, `charmcraft login` warns that it failed to obtain a keyring and that every store interaction will go through the web authentication process again: ``` $ charmcraft login WARNING: Cannot get a keyring. Every store interaction that requires authentication will require you to log in again.Opening an authorization web page in your browser. If it does not open, please open this URL: https://api.jujucharms.com/identity/login?did=a6f.... ``` If I try to switch to the `python3-keyrings.alt` package and the `EncryptedFile` keyring type, it also fails: ``` ubuntu@phased-updater-ops:~$ export PYTHON_KEYRING_BACKEND=keyrings.alt.file.EncryptedKeyring ubuntu@phased-updater-ops:~$ charmcraft login charmcraft internal error: ModuleNotFoundError("No module named 'keyrings'") ``` Probably because the `python3-keyrings.alt` package is not installed inside the snap. Therefore I seem to be forced to export the plain text version of the authentication to a text file with `--export`. ### Steps to reproduce Just run `charmcraft login` on a headless system. As a second step, export `PYTHON_KEYRING_BACKEND=keyrings.alt.file.EncryptedKeyring` and run `charmcraft login` again to get the `ModuleNotFoundError`. ### Environment Ubuntu 24.04 VM. ### Log output ```shell 2026-05-07 19:51:24.841 charmcraft internal error: ModuleNotFoundError("No module named 'keyrings'") 2026-05-07 19:51:24.844 Traceback (most recent call last): 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/craft_application/application.py", line 663, in run 2026-05-07 19:51:24.844 return_code = self._run_inner() 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/application/main.py", line 143, in _run_inner 2026-05-07 19:51:24.844 return super()._run_inner() 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/craft_application/application.py", line 640, in _run_inner 2026-05-07 19:51:24.844 return_code = dispatcher.run() or os.EX_OK 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 564, in run 2026-05-07 19:51:24.844 return self._loaded_command.run(self._parsed_command_args) 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/application/commands/store.py", line 218, in run 2026-05-07 19:51:24.844 self._services.store.login(packages=packages, **kwargs) 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/craft_application/services/service_factory.py", line 333, in __getattr__ 2026-05-07 19:51:24.844 result = self.get_class(name) if name.endswith("Class") else self.get(name) 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/craft_application/services/service_factory.py", line 318, in get 2026-05-07 19:51:24.844 instance.setup() 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/services/store.py", line 199, in setup 2026-05-07 19:51:24.844 super().setup() 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/services/store.py", line 90, in setup 2026-05-07 19:51:24.844 self.client = self.ClientClass( 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/charmcraft/store/client.py", line 163, in __init__ 2026-05-07 19:51:24.844 super().__init__( 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/craft_store/store_client.py", line 93, in __init__ 2026-05-07 19:51:24.844 super().__init__( 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/craft_store/base_client.py", line 79, in __init__ 2026-05-07 19:51:24.844 self._auth = Auth( 2026-05-07 19:51:24.844 ^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/craft_store/auth.py", line 192, in __init__ 2026-05-07 19:51:24.844 self._keyring = keyring.get_keyring() 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/keyring/core.py", line 33, in get_keyring 2026-05-07 19:51:24.844 init_backend() 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/keyring/core.py", line 91, in init_backend 2026-05-07 19:51:24.844 set_keyring(_detect_backend(limit)) 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/keyring/core.py", line 105, in _detect_backend 2026-05-07 19:51:24.844 load_env() 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/keyring/core.py", line 151, in load_env 2026-05-07 19:51:24.844 return load_keyring(os.environ['PYTHON_KEYRING_BACKEND']) 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/keyring/core.py", line 142, in load_keyring 2026-05-07 19:51:24.844 class_ = _load_keyring_class(keyring_name) 2026-05-07 19:51:24.844 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2026-05-07 19:51:24.844 File "/snap/charmcraft/7517/lib/python3.12/site-packages/keyring/core.py", line 132, in _load_keyring_class 2026-05-07 19:51:24.844 __import__(module_name) 2026-05-07 19:51:24.844 ModuleNotFoundError: No module named 'keyrings' ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 29.25
Staleness: 50
Complexity: 35
Confidence: 80
Support Request: 15
needs triage charmcraft login on headless systems cannot persist credentials: no keyring is available, and the keyrings.alt backend is not bundled in the snap, so PYTHON_KEYRING_BACKEND crashes with ModuleNotFoundError. Unlabeled, no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 60
Complexity: 30
Confidence: 85
Support Request: 10
needs triage Request to include keyrings.alt in the charmcraft snap for headless authentication. Currently unlabelled and inactive for 74 days with no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 60
Complexity: 30
Confidence: 85
Support Request: 10
needs triage charmcraft login fails to use keyrings.alt backend on headless systems due to missing python3-keyrings.alt package in the snap, causing a ModuleNotFoundError. Untriaged, no maintainer response.
qwen3.6-35b-moe-q4
Staleness: 45
Complexity: 30
Confidence: 90
Support Request: 20
needs triage Request to include python3-keyrings.alt in the charmcraft snap to support headless authentication backends. Currently unlabelled and awaiting maintainer review.
qwen3.6-35b-a3b-mtp-q6
Staleness: 40
Complexity: 40
Confidence: 90
Support Request: 10
needs triage charmcraft login fails to use keyrings.alt on headless systems due to missing python3-keyrings.alt in the snap, forcing plain text auth export. Issue is open, unassigned, and unreviewed after 38 days.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#1741 (confidence 75%)

    PR 'fix(store): fall back to ephemeral keyring' added the graceful fallback that produces the warning the reporter sees; it mitigates the crash but does not provide persistent credentials on headless systems.

Related issues

No related issues found above the similarity threshold.