-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
DBus: connecting without DBUS_SESSION_BUS_ADDRESS environment variable #394
Comments
Just linking here the same issue that had been reported by some BSD users: #363.
My guess (and it's not an educated one): those tools connect to the running dbus services, whereas signal-cli needs to register its (new) dbus service. Here is a SO question that gives an example of registering a basic "hello world" dbus service. If running that code also requires setting the env variable on your system, then we know it's not just a signal-cli issue. |
Thanks for linking that! The code example given in the SO question was written for dbus-python, which I couldn't install for some reason, so instead I found this equivalent (I think) example from pydbus, which registers a new service named Running that script raises no errors for me, even in the absence of the
So it appears to me that registering vs. connecting doesn't appear to be the source of the issue. |
An aside: the error message I receive is "Cannot Resolve Session Bus Address", which differs from the one described by #363, which is "Failed to connect to bus: No such file or directory". Perhaps they are the same underlying error (with different messages because of the differing OS platform), and it seems likely that they share the same cause, but I'm going to hold off on closing this issue as a duplicate of that one just in case there happen to be other differences. I propose, since the specific issue of running the dbus daemon without |
👍 for testing the code! I vaguely remember the
Yes, I've noticed that too (only after posting). They just have the fix in common - setting the environment variable seems to work for both. |
I've done quite a bit of searching through the dbus code, and among other things I discovered that for the MacOSX, at least, the dbus helper programs (like dbus-send) actually spawn a subprocess to query
Importantly, these environment variables are NOT available to SSH sessions (I have documented some workarounds on the wiki). On the Mac, dbus-send first looks to see if |
I'm not sure how DBus works on Free BSD (and thus issue #363) but it appears that the authors of DBus (freedesktop.org) assume that there is a well-known location for the system and session bus sockets (respectively, All this happens behind the scenes on standard Linux desktop startups, but on other systems, you may need to rely on
This is essentially the reverse of the process described in this blog post |
I've updated signal-cli to use the hypfview dbus-java 4.0 beta, which uses native java unix sockets, that should resolve at least some dbus issues. |
After quite a lot of struggle, I finally managed to get signal-cli to find DBus from within an Alpine Linux Docker container. In case it's helpful for anyone else, here's what it took...
RUN apk add --no-cache dbus-x11 Needs to be
CMD sh -c 'dbus-launch && yarn start'
But the values weren't being set (leading to a And the values would change every time (I believe because the Docker Container ID changed), so I couldn't hardcode them in. Instead, by modifying the launch command from above, this would set the environment variables on launch: CMD sh -c 'eval $(dbus-launch --sh-syntax) && yarn start' Now signal-cli would use DBus from within the container!
Signal messages successfully received and sent! 🎉🎉 |
It appears, per #258, that the
DBUS_SESSION_BUS_ADDRESS
environment variable needs to be set in order for signal-cli to be able to detect and connect to a running DBus user session bus. Yet many other DBus-interacting programs, e.g. thedbus-send
CLI tool, Python'spydbus
library, etc., are capable of detecting and establishing a session bus connection even in the absence of theDBUS_SESSION_BUS_ADDRESS
environment variable. Why is that?I don't know very much about DBus, so this is more of a question than an actual issue--how do those other things succeed at connecting to DBus even though the environment variable is unset? And if those things can do it, shouldn't it be nice for signal-cli to be able to do that as well?
Relevant information: my OS is Void Linux, signal-cli version 0.7.1 (downloaded via GH release binary tar).
The text was updated successfully, but these errors were encountered: