Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime dependency on dbus-daemon #1

Closed
TheMeaningfulEngineer opened this issue Apr 17, 2018 · 4 comments
Closed

Runtime dependency on dbus-daemon #1

TheMeaningfulEngineer opened this issue Apr 17, 2018 · 4 comments

Comments

@TheMeaningfulEngineer
Copy link

Hey,
am just going through your code examples, and wanted to try out one where a service is being registered on the bus.

However the examples fails the following way:

./bigben_server
Traceback (most recent call last):
  File "./bigben_server", line 139, in <module>
    conn = dbus.Connection.bus_get(DBUS.BUS_SESSION, private = False)
  File "/usr/lib/python3.5/site-packages/dbussy.py", line 2843, in bus_get
    my_error.raise_if_set()
  File "/usr/lib/python3.5/site-packages/dbussy.py", line 4869, in raise_if_set
    raise DBusError(self.name, self.message)
dbussy.DBusError: org.freedesktop.DBus.Error.NotSupported -- Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

This is most likely an issue on my side given that it's the same issue that pops
up if I try to run, for example dbus-monitor.

However ./introspect system org.bluez /org/bluez/hci0 seems to be running
ok.

How do runtime dependencies for those two examples differ?

@TheMeaningfulEngineer TheMeaningfulEngineer changed the title Runtime dependency on dbus-daemon dependency Runtime dependency on dbus-daemon Apr 17, 2018
@ldo
Copy link
Owner

ldo commented Apr 17, 2018

Are you logged into a GUI session? Otherwise you won’t have a session bus.

As I understand it, the environment variable DBUS_SESSION_BUS_ADDRESS needs to point to the address for connecting to the session bus. For example, in my current session, this is defined as

DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus

Otherwise, this is possibly a question for the dbus mailing list.

@TheMeaningfulEngineer
Copy link
Author

Are you logged into a GUI session? Otherwise you won’t have a session bus.

Nope, it's a CLI only system.

I've modified it to use the system bus which seems to solve the above issue.
Changed this line to:

conn = dbus.Connection.bus_get(DBUS.BUS_SYSTEM, private = False)

Got some permission errors but it does seem to drop the session bus dependency.

@TheMeaningfulEngineer
Copy link
Author

This was a misunderstanding of d-bus from my side.
The example has been written for systems that have a session bus
that wasn't the case for me on a headless embedded system.

Found a good explanation why here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=690530

Closing issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@ldo @TheMeaningfulEngineer and others