dbcli / pgcli

Postgres CLI with autocompletion and syntax highlighting
http://pgcli.com
BSD 3-Clause "New" or "Revised" License
12.11k stars 557 forks source link

pgcli was stuck until it timed out with dbus error #1289

Closed lrprawira closed 12 months ago

lrprawira commented 3 years ago

Description

pgcli command just got stuck when executed but can still be aborted. Here is the traceback from when it timed out after 120 seconds:

Traceback (most recent call last):
  File "/usr/bin/pgcli", line 33, in <module>
    sys.exit(load_entry_point('pgcli==3.1.0', 'console_scripts', 'pgcli')())
  File "/home/ccxex29/.local/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/ccxex29/.local/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/ccxex29/.local/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ccxex29/.local/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pgcli/main.py", line 1313, in cli
    pgcli.connect(database, host, user, port)
  File "/usr/lib/python3.9/site-packages/pgcli/main.py", line 531, in connect
    passwd = keyring.get_password("pgcli", key)
  File "/usr/lib/python3.9/site-packages/keyring/core.py", line 55, in get_password
    return get_keyring().get_password(service_name, username)
  File "/usr/lib/python3.9/site-packages/keyring/backends/SecretService.py", line 78, in get_password
    collection = self.get_preferred_collection()
  File "/usr/lib/python3.9/site-packages/keyring/backends/SecretService.py", line 61, in get_preferred_collection
    collection = secretstorage.get_default_collection(bus)
  File "/usr/lib/python3.9/site-packages/secretstorage/collection.py", line 161, in get_default_collection
    return Collection(connection)
  File "/usr/lib/python3.9/site-packages/secretstorage/collection.py", line 44, in __init__
    self._collection.get_property('Label')
  File "/usr/lib/python3.9/site-packages/secretstorage/util.py", line 64, in get_property
    (signature, value), = self.send_and_get_reply(msg)
  File "/usr/lib/python3.9/site-packages/secretstorage/util.py", line 46, in send_and_get_reply
    return self._connection.send_and_get_reply(msg, unwrap=True)
  File "/usr/lib/python3.9/site-packages/jeepney/io/blocking.py", line 190, in send_and_get_reply
    return unwrap_msg(msg_in)
  File "/usr/lib/python3.9/site-packages/jeepney/wrappers.py", line 214, in unwrap_msg
    raise DBusErrorResponse(msg)
jeepney.wrappers.DBusErrorResponse: [org.freedesktop.DBus.Error.TimedOut] ("Failed to activate service 'org.freedesktop.secrets': timed out (service_start_timeout=120000ms)",)

Your environment

evoludigit commented 2 years ago

I have had encountered the same problem on Archlinux with DWM.

It was related to archlinux and the DBUS_SESSION_BUS_ADDRESS environment variable being setup incorrectly with something along the lines of unix:abstract=/tmp/dbus-randomchars,guid=aguidishere.

I also had no password keyring nor login password showing up in Seahorse, the GNOME application for managing encryption keys and passwords in the GNOME Keyring which is used by pgcli.

Following this post, I could solve my problem by exporting the following environnment variable in my .zshrc : export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus

sevillaarvin commented 2 years ago

I have had encountered the same problem on Archlinux with DWM.

It was related to archlinux and the DBUS_SESSION_BUS_ADDRESS environment variable being setup incorrectly with something along the lines of unix:abstract=/tmp/dbus-randomchars,guid=aguidishere.

I also had no password keyring nor login password showing up in Seahorse, the GNOME application for managing encryption keys and passwords in the GNOME Keyring which is used by pgcli.

Following this post, I could solve my problem by exporting the following environnment variable in my .zshrc : export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus

Thanks! Having the same problem with manjaro/bspwm. One day I hope to figure out how dbus works.

dbaty commented 12 months ago

Thanks for the detailed answer, @evoludigit. :heart: No response from the original reporter for 18 months, I'll suppose that they have applied your fix. I'm thus closing this issue.