8

I've installed Git and libsecret on an CentOS 7 Server. I used git-credentials-store to store my credentials in clear text on the server. Now I wanna use libsecret but unfortunately I'm getting D-Bus errors, if I configure git-credential-libsecret as credential helper.

I've already installed dbus and dbus-x11 and launched dbus via below command but I'm still getting errors.

dbus-launch --sh-syntax

Error:

$ git pull origin master

** (process:66155): CRITICAL **: 08:19:33.936: could not connect to Secret Service: Cannot autolaunch D-Bus without X11 $DISPLAY

** (process:66160): CRITICAL **: 08:19:34.209: store failed: Cannot autolaunch D-Bus without X11 $DISPLAY

EDIT:

After installation of gnome-keyring I get the following error

** Message: 14:10:49.566: Remote error from secret service: org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.Secret.Collection' on object at path /org/freedesktop/secrets/collection/login

Community
  • 1
  • 1
Paul1896
  • 85
  • 1
  • 1
  • 4

2 Answers2

6

You need to use export $(dbus-launch) to evaluate the variables which dbus-launch outputs, so that ${DBUS_SESSION_BUS_ADDRESS} is set in your environment. See also: How to export DBUS_SESSION_BUS_ADDRESS

If ${DBUS_SESSION_BUS_ADDRESS} is not set in your environment, the D-Bus client library will assume no dbus-daemon is running and will attempt to auto-launch one. Without a ${DISPLAY}, that’s not possible; hence the error message you see.

Philip Withnall
  • 5,293
  • 14
  • 28
  • Thanks @Philip! Now I'm getting the following errors ** (process:46160): CRITICAL **: lookup failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files – Paul1896 Dec 05 '18 at 13:27
  • Make sure that the file `org.freedesktop.secrets.service` is installed into the directory where your session bus is configured to look for services. Typically this is `/usr/share/dbus-1/services`, but might be different if you’re using a custom configuration. I suspect you’ve installed libsecret in a custom prefix rather than system-wide, which would cause this problem. Did you use the distro-provided RPMs? – Philip Withnall Dec 06 '18 at 13:29
  • Thanks for your answer :) I didn't find that file on the filesystem. I've installed libsecret via the provided yum repos. – Paul1896 Dec 06 '18 at 14:38
  • 1
    It might be provided by the `gnome-keyring` package instead of libsecret. It certainly is on Fedora. – Philip Withnall Dec 06 '18 at 16:28
  • If someone wants to launch dbus with fixed address, set an environment variable `DBUS_SESSION_BUS_ADDRESS` with the value `unix:path=some_directory` and enter the command `dbus-daemon --session --fork --address=$DBUS_SESSION_BUS_ADDRESS > somefile`. In my case I couldn't use `export $(dbus-launch)` cause its value changes every time I launch it. – cointreau May 04 '23 at 00:17
0

You can run it headless, but you need to follow the recommendations from the Python keyring package to "trick" it.

https://keyring.readthedocs.io/en/latest/#using-keyring-on-headless-linux-systems

dragon788
  • 3,583
  • 1
  • 40
  • 49