canonical / snapcraft

Package, distribute, and update any app for Linux and IoT.
https://snapcraft.io
GNU General Public License v3.0
1.18k stars 445 forks source link

Fails to login when Kwallet is default keyring #5137

Open eeickmeyer opened 2 hours ago

eeickmeyer commented 2 hours ago

Bug Description

When Kwallet is default keyring, snapcraft throws an error that python-dbus is not installed. I assume, therefore, that python-dbus is not included in the snap and therefore it is unable to communicate with dbus in the system.

To Reproduce

Install snapcraft snap install snapcraft on Kubuntu or Ubuntu Studio Attempt snapcraft login or any other item where snapcraft requires access to the system keyring Most of the time* it will fail with:

snapcraft internal error: RuntimeError('python-dbus not installed')    

*I say most of the time because this is inconsistent between installations, but this happened on a clean install I did to alleviate any error on my part. I have a separate upgraded install where it worked, but this is reproducible 100% of the time on the clean install.

Environment

Running on Ubuntu Studio 24.10, but this has happened under 24.04 LTS as well.

snapcraft.yaml

No relevant snapcraft.yaml as this happens when merely accessing the keyring via `snapcraft login` or `snapcraft upload` or the like.

Relevant log output

2024-10-31 09:26:56.195 Starting snapcraft, version 8.4.4
2024-10-31 09:26:56.195 Log verbosity level set to BRIEF
2024-10-31 09:26:56.195 Preparing application...
2024-10-31 09:26:56.195 Configuring application...
2024-10-31 09:26:56.196 Setting up ConfigService
2024-10-31 09:26:56.229 Build plan: platform=None, build_for=None
2024-10-31 09:26:56.229 Running snapcraft login on host
2024-10-31 09:26:56.230 snapcraft internal error: RuntimeError('python-dbus not installed')
2024-10-31 09:26:56.232 Traceback (most recent call last):
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/craft_application/application.py", line 568, in run
2024-10-31 09:26:56.232     return_code = self._run_inner()
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/application.py", line 215, in _run_inner
2024-10-31 09:26:56.232     return_code = super()._run_inner()
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/craft_application/application.py", line 549, in _run_inner
2024-10-31 09:26:56.232     return_code = dispatcher.run() or os.EX_OK
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run
2024-10-31 09:26:56.232     return self._loaded_command.run(self._parsed_command_args)
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/commands/account.py", line 114, in run
2024-10-31 09:26:56.232     store.StoreClientCLI().login()
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/store/client.py", line 179, in __init__
2024-10-31 09:26:56.232     self.store_client = get_client(ephemeral=ephemeral)
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/snapcraft/store/client.py", line 161, in get_client
2024-10-31 09:26:56.232     client = craft_store.UbuntuOneStoreClient(
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/craft_store/ubuntu_one_store_client.py", line 46, in __init__
2024-10-31 09:26:56.232     super().__init__(
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/craft_store/base_client.py", line 78, in __init__
2024-10-31 09:26:56.232     self._auth = Auth(
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/craft_store/auth.py", line 189, in __init__
2024-10-31 09:26:56.232     self._keyring = keyring.get_keyring()
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/keyring/core.py", line 33, in get_keyring
2024-10-31 09:26:56.232     init_backend()
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/keyring/core.py", line 84, in init_backend
2024-10-31 09:26:56.232     set_keyring(_detect_backend(limit))
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/keyring/core.py", line 99, in _detect_backend
2024-10-31 09:26:56.232     or load_config()
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/keyring/core.py", line 184, in load_config
2024-10-31 09:26:56.232     return load_keyring(keyring_name)
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/keyring/core.py", line 137, in load_keyring
2024-10-31 09:26:56.232     class_.priority
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/jaraco/classes/properties.py", line 202, in __get__
2024-10-31 09:26:56.232     return self.fget.__get__(None, owner)()
2024-10-31 09:26:56.232   File "/snap/snapcraft/12961/lib/python3.10/site-packages/keyring/backends/kwallet.py", line 43, in priority
2024-10-31 09:26:56.232     raise RuntimeError('python-dbus not installed')
2024-10-31 09:26:56.232 RuntimeError: python-dbus not installed
2024-10-31 09:26:56.232 Full execution log: '/home/erich/.local/state/snapcraft/log/snapcraft-20241031-092656.194389.log'

Additional context

I believe this can be alleviated by simply including python-dbus in the snapcraft snap, but this is theory.

lengau commented 2 hours ago

Thanks for the report! I'm not facing this on Kubuntu 24.10 with the same revision of snapcraft you have. I don't have gnome-keyring installed either. Could you list the packages you have?

I do think that python-dbus would probably fix this for you, but I'd like to find the underlying difference between our machines that's causing this.

eeickmeyer commented 2 hours ago

Could you list the packages you have?

Alex, my friend, that was an excellent way to literally crash a Github page because, well, I tried to paste that in a code box. :rofl:

Instead, here's a text doc attachment that is sure not to crash it. We're talking Ubuntu Studio here. We ship... packages. :laughing:

installed.txt

lengau commented 1 hour ago

That was my secret plan all along! 😜

My first guess in the difference is the plasma-secrets package - not sure whether I installed it manually or not, but I have it installed. If that's what it is maybe we should ask the Kubuntu team to include it in the next release in addition to adding python-dbus to the snap. @mr-cal any reason you can think of not to include python-dbus?

eeickmeyer commented 1 hour ago

My first guess in the difference is the plasma-secrets package - not sure whether I installed it manually or not, but I have it installed.

Not sure how you have that installed because apt search plasma-secrets returns null and apt install plasma-secrets gives me

$ sudo apt install plasma-secrets
Error: Unable to locate package plasma-secrets

There's some strange magic you have going on there Mr. Lowe. :suspect: :grin: