# Bonjour resin.io

**URL:** <https://forums.balena.io/t/bonjour-resin-io/2592>\
**Category:** Product support\
**Created:** [February 19, 2018, 2:50am UTC](https://forums.balena.io/t/bonjour-resin-io/2592 "2018-02-19T02:50:57Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![brice](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/brice/32/484_2.png) [@brice](https://forums.balena.io/u/brice)\
**Post date:** [February 19, 2018, 2:50am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/1 "2018-02-19T02:50:57Z")

</div>

I’m using [resin.io/bonjour](http://resin.io/bonjour) node module to advertise a service but it comes back with no addresses when using bonjour browser on mac, if I discover locally on the box it returns the information correctly.

Any recommendations?

---

<div class="post-metadata">

**Author:** ![pimterry](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pimterry/32/140_2.png) [@pimterry](https://forums.balena.io/u/pimterry)\
**Post date:** [February 19, 2018, 9:03am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/4 "2018-02-19T09:03:38Z")

</div>

Hi Brice,

That module is mainly used in Resin within the CLI to search for local devices using Bonjour/mDNS, rather than to advertise them. The device itself already has Avahi configured in the OS, so you’ll find this works much more reliably if you configure the OS’s Avahi instance using D-Bus, rather than starting your own competing mDNS service on the same device.

There’s a Python example of a full project doing exactly that here: [https://github.com/resin-io-playground/resin-avahi-dbus](https://github.com/resin-io-playground/resin-avahi-dbus).

It looks like you’re using JS though, is that right? [https://github.com/resin-io-modules/resin-discoverable-services/blob/master/lib/backends/avahi.coffee](https://github.com/resin-io-modules/resin-discoverable-services/blob/master/lib/backends/avahi.coffee) may be of interest. That’s JS (well, coffeescript) code to query Avahi over D-Bus when searching for devices, but you should be able to get some working logic to publish devices too from there.

---

<div class="post-metadata">

**Author:** ![brice](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/brice/32/484_2.png) [@brice](https://forums.balena.io/u/brice)\
**Post date:** [February 19, 2018, 9:22am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/6 "2018-02-19T09:22:34Z")

</div>

Awesome, thanks @pimterry will give this a try, I’m trying to have a consistent build that works on mac and in my [resin.io](http://resin.io) container, hence why I was keen to use the bonjour module. I’ve tested [https://github.com/ardean/spread-the-word](https://github.com/ardean/spread-the-word) today and it’s working ok even if the package is fairly recent.

---

<div class="post-metadata">

**Author:** ![brice](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/brice/32/484_2.png) [@brice](https://forums.balena.io/u/brice)\
**Post date:** [February 26, 2018, 1:50am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/8 "2018-02-26T01:50:39Z")

</div>

@pimterry is there a way to disable avahi on the host container via dBus or other method? Would this cause issues? Would rather use my own broadcasting service.

---

<div class="post-metadata">

**Author:** ![brice](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/brice/32/484_2.png) [@brice](https://forums.balena.io/u/brice)\
**Post date:** [March 2, 2018, 10:05am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/11 "2018-03-02T10:05:42Z")

</div>

@pimterry I’m using dbus-native to talk to Avahi via dbus but can’t get the interface, any idea what’s going on please?

```
const dbus = require('dbus-native');
const bus = dbus.systemBus();
const service = bus.getService('org.freedesktop.Avahi').getInterface('/', 'org.freedesktop.Avahi.Server', (err, interface) => {
        console.log(err);
        console.log(interface);
}); 

```

I get a `No such interface found` error.

---

<div class="post-metadata">

**Author:** ![pimterry](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pimterry/32/140_2.png) [@pimterry](https://forums.balena.io/u/pimterry)\
**Post date:** [March 2, 2018, 10:56am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/12 "2018-03-02T10:56:35Z")

</div>

@brice Have you set the DBUS address to use the host DBUS? That would cause this. You need to run something like `export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket` beforehand.

The example python project for this has some details at [https://github.com/resin-io-playground/resin-avahi-dbus](https://github.com/resin-io-playground/resin-avahi-dbus), and there’s docs on this specifically here: [https://docs.resin.io/runtime/runtime/#dbus-communication-with-hostos](https://docs.resin.io/runtime/runtime/#dbus-communication-with-hostos)

---

<div class="post-metadata">

**Author:** ![pimterry](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pimterry/32/140_2.png) [@pimterry](https://forums.balena.io/u/pimterry)\
**Post date:** [March 2, 2018, 10:58am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/13 "2018-03-02T10:58:53Z")

</div>

To answer your previous question as well:

> is there a way to disable avahi on the host container via dBus or other method? Would this cause issues? Would rather use my own broadcasting service.

I’ve been talking to some of the team to see if we have any solutions here, but right now I’m not aware of any way to do that.

---

<div class="post-metadata">

**Author:** ![brice](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/brice/32/484_2.png) [@brice](https://forums.balena.io/u/brice)\
**Post date:** [March 2, 2018, 11:01am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/15 "2018-03-02T11:01:19Z")

</div>

I’ve setup the env, but still getting the same error. Tried with dbus and dbus-native.

If I use dbus-send I can talk to avahi but dbus-send doesn’t support array of array of bytes which is required when broadcasting a new service on Avahi.

---

<div class="post-metadata">

**Author:** ![brice](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/brice/32/484_2.png) [@brice](https://forums.balena.io/u/brice)\
**Post date:** [March 19, 2018, 4:42am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/21 "2018-03-19T04:42:13Z")

</div>

@pimterry I’m still stuck on this one, that’s the code I’m using:

```
const dbus = require('dbus-native')

const bus = dbus.systemBus();
bus.getService('org.freedesktop.Avahi').getInterface('/', 'org.freedesktop.Avahi.Server', (err, interface) => {
  console.error(err);
  console.info(interface);
});

process.stdin.resume();

```

`DBUS_SYSTEM_BUS_ADDRESS` is correctly set, and I keep getting a `No such interface found` error from dbus-native. I must be missing something obvious, any idea please?

PS: happy birthday 😅

---

<div class="post-metadata">

**Author:** ![brice](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/brice/32/484_2.png) [@brice](https://forums.balena.io/u/brice)\
**Post date:** [March 19, 2018, 5:03am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/22 "2018-03-19T05:03:45Z")

</div>

For some reasons the list of methods is empty, even when using dbus-send:

```
dbus-send --system --print-reply --dest=org.freedesktop.Avahi / org.freedesktop.DBus.Introspectable.Introspect
method return sender=:1.4 -> dest=:1.93 reply_serial=2
   string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
</node>
"
```

---

<div class="post-metadata">

**Author:** ![samjrdn](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/samjrdn/32/1040_2.png) [@samjrdn](https://forums.balena.io/u/samjrdn)\
**Post date:** [July 4, 2018, 8:13pm UTC](https://forums.balena.io/t/bonjour-resin-io/2592/25 "2018-07-04T20:13:05Z")

</div>

Any progress on this issue? I am running into it as well.

It looks like the Avahi interface description document is not present under `/usr/share/dbus-1/interfaces/`. The `dbus-native` library relies on DBus’ introspection description documents to allow access to the interfaces. I’m not sure if there is a way to add it since the location is in the read-only image.

---

<div class="post-metadata">

**Author:** ![brice](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/brice/32/484_2.png) [@brice](https://forums.balena.io/u/brice)\
**Post date:** [July 5, 2018, 1:42am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/26 "2018-07-05T01:42:26Z")

</div>

@samjrdn my work around was to install `avahi-utils` on the box and use that to broadcast using `avahi-publish`

---

<div class="post-metadata">

**Author:** ![lekkas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/lekkas/32/78_2.png) [@lekkas](https://forums.balena.io/u/lekkas)\
**Post date:** [July 12, 2018, 11:00am UTC](https://forums.balena.io/t/bonjour-resin-io/2592/30 "2018-07-12T11:00:08Z")

</div>

Hi @brice,

What is the device type that you noticed this issue at?

---

<div class="post-metadata">

**Author:** ![brice](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/brice/32/484_2.png) [@brice](https://forums.balena.io/u/brice)\
**Post date:** [July 12, 2018, 12:52pm UTC](https://forums.balena.io/t/bonjour-resin-io/2592/35 "2018-07-12T12:52:51Z")

</div>

Using the IntelNUC image on a Zotac computer.

---

<div class="post-metadata">

**Author:** ![lekkas](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/lekkas/32/78_2.png) [@lekkas](https://forums.balena.io/u/lekkas)\
**Post date:** [August 12, 2018, 1:50pm UTC](https://forums.balena.io/t/bonjour-resin-io/2592/37 "2018-08-12T13:50:00Z")

</div>

Thank you @brice, I have created an issue at [https://github.com/resin-os/meta-resin/issues/1140](https://github.com/resin-os/meta-resin/issues/1140) where you can track progress.

---

<div class="post-metadata">

**Author:** ![brice](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/brice/32/484_2.png) [@brice](https://forums.balena.io/u/brice)\
**Post date:** [August 12, 2018, 9:23pm UTC](https://forums.balena.io/t/bonjour-resin-io/2592/38 "2018-08-12T21:23:54Z")

</div>

Awesome thanks
