jaraco / keyring

MIT License
1.23k stars 151 forks source link

DBusKeyring is unable to connect to the kwallet service in kloczek's environment #553

Open jaraco opened 2 years ago

jaraco commented 2 years ago

The third class of issues appears to be that the DBusKeyring is unable to connect to the kwallet service:

FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_delete_present - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_delete_not_present - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnk...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_delete_one_in_group - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUn...
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: Could not activate remote peer.

I don't see that error reported anywhere. @mitya57 do you have any recommendations on how this user can avoid these errors when running the tests (either by improving the viability detection in the backend or by properly configuring the environment to work with the backend)?

Originally posted by @jaraco in https://github.com/jaraco/keyring/issues/550#issuecomment-981131207

jaraco commented 2 years ago

@mitya57 had this to say:

I don't understand why that could happen.

We have the following code to check that the service is activatable:

https://github.com/jaraco/keyring/blob/0f0faf1243c6e53c9258bf47eaf6aa5b55514112/keyring/backends/kwallet.py#L49-L55

If that check passes, then the service should be activatable, and ServiceUnknown error should not happen.

@kloczek Do you have kwallet installed on the system where tests were run?

Can you run this code and check what it prints?

>>> from keyring.backends import kwallet
>>> print(kwallet.DBusKeyring.viable)
jaraco commented 2 years ago

@kloczek confirmed that kwallet is installed:

During that test I had installed but I was not aware that it is here some test dependency

[tkloczko@ss-desktop SPECS]$ rpm -q kf5-kwallet
kf5-kwallet-5.88.0-2.g2v.x86_64

We'd still like to know what is the result of kwallet.DBusKeyring.viable.

kloczek commented 2 years ago

We'd still like to know what is the result of kwallet.DBusKeyring.viable.

How can I diagnose that?

Only FTR .. just tested 23.5.0 and still I see:

FAILED tests/test_packaging.py::test_entry_point - ValueError: too many values to unpack (expected 1)
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_password_set_get - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnkno...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_difficult_chars - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknow...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_delete_present - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_delete_not_present - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnk...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_delete_one_in_group - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUn...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_unicode_chars - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown:...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_unicode_and_ascii_chars - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.Servi...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_different_user - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown...
FAILED tests/backends/test_kwallet.py::TestDBusKWallet::test_credential - keyring.errors.InitError: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: Co...
jaraco commented 2 years ago

Can you run this code and check what it prints?

>>> from keyring.backends import kwallet
>>> print(kwallet.DBusKeyring.viable)