Snapcraft login expiry issues

I run snapcraft names and snapcraft metrics in an LXD container using an exported login.

export SNAPCRAFT_STORE_CREDENTIALS="$(cat /root/acl)"

# snapcraft commands ...

It seems like, recently, every day the macaroon expires and snapcraft is unable to refresh it. I received this message most recently:

snapcraft internal error: StoreServerError('Store operation failed:\n- macaroon-needs-refresh:

Expired macaroon (age: 118961 seconds)')

Note that a day has 86,400 seconds, so that’s 1.38 days.


I’ve just tried to run snapcraft whoami on my laptop, which complains that:

snapcraft internal error: StoreServerError('Store operation failed:\n- macaroon-needs-refresh:

Expired macaroon (age: 1202105 seconds)')

(nearly 14 days)

I’m informed snapcraft should refresh the macaroon automatically.

So naturally I have tried to login:

snapcraft internal error: CredentialsAlreadyAvailable(“Credentials found for ‘snapcraft’ on ‘dashboard.snapcraft.io’.”)

Full execution log: ‘/home/daniel/.local/state/snapcraft/log/snapcraft-20240911-224428.035373.log’

snapcraft logout && snapcraft login

Did the trick.


  • Is this issue affecting other people?
  • Is this issue known to the Snapcraft team?

CC @mr_cal with whom I conferred prior to writing this post

1 Like

Update: Once again, macaroons expired - this time ~ 1.44 days

it’s not working yet.

I continue to experience the same issue. I wont report back every day

Can you share /home/daniel/.local/state/snapcraft/log/snapcraft-20240911-224428.035373.log?

2024-09-11 22:44:28.037 Starting snapcraft, version 8.3.2.post72+git0d06f800
2024-09-11 22:44:28.037 Log verbosity level set to BRIEF
2024-09-11 22:44:28.037 Configuring application...
2024-09-11 22:44:28.037 Preparing application...
2024-09-11 22:44:28.038 Build plan: platform=None, build_for=None
2024-09-11 22:44:28.038 Running snapcraft login on host
2024-09-11 22:44:28.200 Enter your Ubuntu One e-mail address and password.
2024-09-11 22:44:28.200 If you do not have an Ubuntu One account, you can create one at https://snapcraft.io/account
2024-09-11 22:44:28.200 Emitter: Pausing control of the terminal
2024-09-11 22:46:46.007 Emitter: Resuming control of the terminal
2024-09-11 22:46:46.027 Emitter: Pausing control of the terminal
2024-09-11 22:47:01.517 Emitter: Resuming control of the terminal
2024-09-11 22:47:01.911 snapcraft internal error: CredentialsAlreadyAvailable("Credentials found for 'snapcraft' on 'dashboard.snapcraft.io'.")
2024-09-11 22:47:01.930 Traceback (most recent call last):
2024-09-11 22:47:01.930   File "/snap/snapcraft/12529/lib/python3.10/site-packages/craft_application/application.py", line 538, in run
2024-09-11 22:47:01.930     return_code = dispatcher.run() or os.EX_OK
2024-09-11 22:47:01.930   File "/snap/snapcraft/12529/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run
2024-09-11 22:47:01.930     return self._loaded_command.run(self._parsed_command_args)
2024-09-11 22:47:01.930   File "/snap/snapcraft/12529/lib/python3.10/site-packages/snapcraft/commands/account.py", line 114, in run
2024-09-11 22:47:01.930     store.StoreClientCLI().login()
2024-09-11 22:47:01.930   File "/snap/snapcraft/12529/lib/python3.10/site-packages/snapcraft/store/client.py", line 221, in login
2024-09-11 22:47:01.930     credentials = self.store_client.login(
2024-09-11 22:47:01.930   File "/snap/snapcraft/12529/lib/python3.10/site-packages/craft_store/base_client.py", line 143, in login
2024-09-11 22:47:01.930     self._auth.ensure_no_credentials()
2024-09-11 22:47:01.930   File "/snap/snapcraft/12529/lib/python3.10/site-packages/craft_store/auth.py", line 233, in ensure_no_credentials
2024-09-11 22:47:01.930     raise errors.CredentialsAlreadyAvailable(self.application_name, self.host)
2024-09-11 22:47:01.930 craft_store.errors.CredentialsAlreadyAvailable: Credentials found for 'snapcraft' on 'dashboard.snapcraft.io'.
2024-09-11 22:47:01.930 Full execution log: '/home/daniel/.local/state/snapcraft/log/snapcraft-20240911-224428.035373.log'

This is from my container this morning: Error: IncorrectArgumentCount(7, "You are required to re-login before continuing")

No accompanying log information for it

Here’s the logs for the expired macaroon issue which struck again this morning:

Error: IncorrectArgumentCount(7, "You are required to re-login before continuing")
2024-09-18 10:20:33.907 Starting snapcraft, version 8.4.0.post9+git8faa6d54
2024-09-18 10:20:33.907 Log verbosity level set to BRIEF
2024-09-18 10:20:33.908 Configuring application...
2024-09-18 10:20:33.908 Preparing application...
2024-09-18 10:20:33.909 Build plan: platform=None, build_for=None
2024-09-18 10:20:33.909 Running snapcraft names on host
2024-09-18 10:20:34.055 Falling back to file based storage
2024-09-18 10:20:34.056 Retrieving credentials for 'snapcraft' on 'dashboard.snapcraft.io' from keyring 'auth FileKeyring'.
2024-09-18 10:20:34.056 HTTP 'GET' for 'https://dashboard.snapcraft.io/dev/api/account' with params None and headers {'Accept': 'application/json', 'Authorization': '<macaroon>', 'User-Agent': 'snapcraft/8.4.0.post9+git8faa6d54 ubuntu/22.04 (x86_64)'}
2024-09-18 10:20:46.649 Retrieving credentials for 'snapcraft' on 'dashboard.snapcraft.io' from keyring 'auth FileKeyring'.
2024-09-18 10:20:46.649 HTTP 'POST' for 'https://login.ubuntu.com/api/v2/tokens/refresh' with params None and headers {'Content-Type': 'application/json', 'Accept': 'application/json', 'User-Agent': 'snapcraft/8.4.0.post9+git8faa6d54 ubuntu/22.04 (x86_64)'}
2024-09-18 10:20:46.868 Storing credentials for 'snapcraft' on 'dashboard.snapcraft.io' in keyring 'auth FileKeyring'.
2024-09-18 10:20:46.868 Retrieving credentials for 'snapcraft' on 'dashboard.snapcraft.io' from keyring 'auth FileKeyring'.
2024-09-18 10:20:46.869 HTTP 'GET' for 'https://dashboard.snapcraft.io/dev/api/account' with params None and headers {'Accept': 'application/json', 'Authorization': '<macaroon>', 'User-Agent': 'snapcraft/8.4.0.post9+git8faa6d54 ubuntu/22.04 (x86_64)'}
2024-09-18 10:20:46.894 Retrieving credentials for 'snapcraft' on 'dashboard.snapcraft.io' from keyring 'auth FileKeyring'.
2024-09-18 10:20:46.894 Deleting credentials for 'snapcraft' on 'dashboard.snapcraft.io' from keyring 'auth FileKeyring'.
2024-09-18 10:20:46.895 You are required to re-login before continuing
2024-09-18 10:20:46.895 Enter your Ubuntu One e-mail address and password.
2024-09-18 10:20:46.895 If you do not have an Ubuntu One account, you can create one at https://snapcraft.io/account
2024-09-18 10:20:46.895 prompting not possible with no tty
2024-09-18 10:20:46.895 Full execution log: '/root/.local/state/snapcraft/log/snapcraft-20240918-102033.905902.log'

I’m suspecting this is a regression in snapcraft 8.4: Snapcraft fails to refresh credentials · Issue #5048 · canonical/snapcraft · GitHub

1 Like

Thank you @mr_cal , I look forward to following the progress of that issue.

Just checked:

  • 8.3.4 on my computer is fine
  • 8.4.0.post9+git8faa6d54 on the laptop and in the container experience the issue

I’m glad you can confirm it’s a regression as well.

I refreshed my macaroon while testing today, so I’ll continue debugging when my macaroon expires tomorrow.

Thanks again for the report @DWD, I was able to find the problem: fix: update discharge macaroons by mr-cal · Pull Request #212 · canonical/craft-store · GitHub

Excellent! Well done and thank you!