Charmcraft and the "No keyring found" error

One of the improvements we did to Charmcraft in the last few months (well, actually to the Craft Store library which is used by Charmcraft) is to securely store the credentials obtained from the user’s login to Charmhub in a keyring in the user’s machine.

But sometimes Charmcraft fails to find a keyring in the user’s environment. The environment may not have a keyring, or it may not be accessible from the snap in which Charmcraft runs.

One simple workaround for this is to install the gnome-keyring package. It’s recommended even in non-GNOME environments (the name is misleading, it’s a simple package and will not bring a zillion dependencies).

In some cases it is more complicated. Please explore the documentation for the Python keyring library which shows several tips for different environments.

All that said, generally there are no keyrings by default in CI/CD or other remote systems; for Charmcraft to work in those environments the user should login in their machine and export the credentials, and then use them in the remote system, as is explained in this forum post.

Please comment on this post with your experience, issues, problems and how/if you solved them. Thanks!

1 Like

Hey, cool! I got this working with gnome-keyring.

It’s a little bit of a headache to get the keyring unlocked from the CLI, though. I found a hacky script that prompts for the current user’s password, then restarts the daemon. It didn’t feel super great to do things that way, though. How are you unlocking the keyring from the CLI?

1 Like