WSL2: Cannot use `$SNAPCRAFT_STORE_CREDENTIALS` for login
Metadata
Current evaluation
Credential login worked again after updated Windows, WSL2, Ubuntu, Snap, and Snapcraft components; the reporter closed the report as no longer reproducible, with no linked fix.
Resolution: closed stale
Reason: The reporter's September 17, 2024 closing comment said the failure disappeared after updating all components and that there was no value in investigating an unidentified transient. No resolving PR or commit was identified.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
WSL2 doesn't run with a proper desktop session and must authenticate with the `SNAPCRAFT_STORE_CREDENTIALS` environment variable. This has traditionally worked for years.
Having tried recently, this no longer works, Snapcraft will unconditionally complain about lack of system keyring and refuse to consider the environment variable.
### To Reproduce
* Install WSL2, Snapcraft snap
* Export login-token (`snapcraft export-login $fileName`), export it into the environment variable, and try perform a server-authenticated action.
```
james@James-Desktop:~/pinta-snap$ export SNAPCRAFT_STORE_CREDENTIALS=$(cat ../token)
james@James-Desktop:~/pinta-snap$ snapcraft upload pinta_2.1.2_amd64.snap --release=stable
snapcraft internal error: NoKeyringError('No keyring found to store or retrieve credentials from.')
```
### Environment
```
james@James-Desktop:~/pinta-snap$ snapcraft version
snapcraft 8.3.2
james@James-Desktop:~/pinta-snap$ snap version
snap 2.63+22.04ubuntu0.1
snapd unavailable
series 16
Windows Subsystem for Linux -
kernel 5.15.153.1-microsoft-standard-WSL2 (amd64)
```
Windows environment: Fully updated Windows 11 22H2 (latest GA release)
### snapcraft.yaml
```shell
N/A
```
### Relevant log output
```shell
2024-08-23 20:06:17.990 Starting snapcraft, version 8.3.2
2024-08-23 20:06:17.990 Log verbosity level set to BRIEF
2024-08-23 20:06:17.990 Configuring application...
2024-08-23 20:06:17.990 Preparing application...
2024-08-23 20:06:17.990 Build plan: platform=None, build_for=None
2024-08-23 20:06:17.991 Running snapcraft upload on host
2024-08-23 20:06:18.013 snapcraft internal error: NoKeyringError('No keyring found to store or retrieve credentials from.')
2024-08-23 20:06:18.015 Traceback (most recent call last):
2024-08-23 20:06:18.015 File "/snap/snapcraft/12378/lib/python3.10/site-packages/craft_application/application.py", line 530, in run
2024-08-23 20:06:18.015 return_code = dispatcher.run() or 0
2024-08-23 20:06:18.015 File "/snap/snapcraft/12378/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run
2024-08-23 20:06:18.015 return self._loaded_command.run(self._parsed_command_args)
2024-08-23 20:06:18.015 File "/snap/snapcraft/12378/lib/python3.10/site-packages/snapcraft/commands/upload.py", line 114, in run
2024-08-23 20:06:18.015 client = store.StoreClientCLI()
2024-08-23 20:06:18.015 File "/snap/snapcraft/12378/lib/python3.10/site-packages/snapcraft/store/client.py", line 179, in __init__
2024-08-23 20:06:18.015 self.store_client = get_client(ephemeral=ephemeral)
2024-08-23 20:06:18.015 File "/snap/snapcraft/12378/lib/python3.10/site-packages/snapcraft/store/client.py", line 161, in get_client
2024-08-23 20:06:18.015 client = craft_store.UbuntuOneStoreClient(
2024-08-23 20:06:18.015 File "/snap/snapcraft/12378/lib/python3.10/site-packages/craft_store/ubuntu_one_store_client.py", line 47, in __init__
2024-08-23 20:06:18.015 super().__init__(
2024-08-23 20:06:18.015 File "/snap/snapcraft/12378/lib/python3.10/site-packages/craft_store/base_client.py", line 77, in __init__
2024-08-23 20:06:18.015 self._auth = Auth(
2024-08-23 20:06:18.015 File "/snap/snapcraft/12378/lib/python3.10/site-packages/craft_store/auth.py", line 201, in __init__
2024-08-23 20:06:18.015 raise errors.NoKeyringError
2024-08-23 20:06:18.015 craft_store.errors.NoKeyringError: No keyring found to store or retrieve credentials from.
2024-08-23 20:06:18.015 Full execution log: '/home/james/.local/state/snapcraft/log/snapcraft-20240823-200617.989721.log'
```
### Additional context
_No response_
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed stale | Credential login worked again after updated Windows, WSL2, Ubuntu, Snap, and Snapcraft components; the reporter closed the report as no longer reproducible, with no linked fix. | |
| stealth/space-bunny-alpha | — | closed not a bug | Environment-variable login worked again after updates to Windows, WSL2, Ubuntu, Snap, and Snapcraft; the reporter closed it as no longer reproducible, with no fixing PR or commit identified. | |
| stealth/space-bunny-alpha | — | closed stale | No code fix was identified; the reporter confirmed login worked after updating Windows, WSL2, Ubuntu, Snap, and Snapcraft, then closed the report. | |
| stealth/space-bunny-alpha | — | closed stale | Reporter could no longer reproduce the WSL2 keyring failure after updating Windows/WSL/Ubuntu/Snap/Snapcraft; SNAPCRAFT_STORE_CREDENTIALS login worked again. Closed by author 2024-09-17 with no Snapcraft code fix. | |
| stealth/space-bunny-alpha | — | closed not a bug | SNAPCRAFT_STORE_CREDENTIALS login worked again with the reporter's latest Windows, WSL2, Ubuntu, Snap, and Snapcraft updates. The reporter closed the report as no longer reproducible; no resolving PR or commit was cited. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed by author after system updates resolved the SNAPCRAFT_STORE_CREDENTIALS login failure in WSL2. No code changes were applied; the issue was fixed externally by environment updates. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed by author after Windows, WSL, Ubuntu, Snap, and Snapcraft updates resolved the WSL2 keyring error. No code changes were required; the environment variable authentication began working again following system updates. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as fixed after author confirmed the WSL2 Snapcraft login failure resolved following recent Windows, WSL, and Snapcraft updates. No code changes were required. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Snapcraft on WSL2 failed to use SNAPCRAFT_STORE_CREDENTIALS for login, throwing a NoKeyringError. Fixed by environment updates across Windows, WSL, Ubuntu, and Snapcraft. The author closed the report as functionality was restored. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/craft-store#119
(confidence 95%)
A maintainer cited this earlier keyring-handling change but said it did not change the reported behavior.
-
Related To:
canonical/craft-store#170
(confidence 95%)
A maintainer cited this keyring-handling change but said it did not change the reported behavior.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1978518 login still promots for username and password when using SNAPCRAFT_STORE_CREDENTIALS | snapcraft (launchpad) | closed | Closed as a usage misunderstanding: SNAPCRAFT_STORE_CREDENTIALS authenticates Snapcraft commands without running `snapcraft login`; no code fix was needed. | |
| #1791879 snapcraft reports invalid credentials after successful login (new account) | snapcraft (launchpad) | closed | Closed as not a bug: the 2018-09-11 comment identified using `snap login` instead of `snapcraft login` as the cause, and the reporter marked the issue invalid. |