# Issues with DBus in generic AARCH64 image

**URL:** <https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847>\
**Category:** balenaOS\
**Created:** [February 23, 2021, 9:03am UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847 "2021-02-23T09:03:32Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thijs](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@Thijs](https://forums.balena.io/u/Thijs)\
**Post date:** [February 23, 2021, 9:03am UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/1 "2021-02-23T09:03:32Z")

</div>

Hello,

We’re trying to build an application for an AARCH64 device. As we have no possibility to flash BalenaOS on the device, we decided to run BalenaOS in Docker, with the generic AARCH64 option available in BalenaCloud.  
We managed to do the setup correctly, I think, as all our containers are automatically deployed to BalenaOS and are started. However, one of our containers fails to run. This container makes use of DBus and if we check the logs of that container, the following error is shown:

(node:33) UnhandledPromiseRejectionWarning: Error initializing network manager: Error: Failed to connect to socket /host/run/dbus/system\_bus\_socket: No such file or directory  
(Use `node --trace-warnings ...` to show where the warning was created)  
(node:33) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see [Command-line options | Node.js v15.9.0 Documentation](https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode)). (rejection id: 2)  
(node:33) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

As you can see, the container can’t access the dbus system bus socket on the host container, eventhough it’s there. We found that this behavior happens if the dbus label is not provided in the docker-compose file, however we did add this label. This is part of our docker-compose file:

environment:  
DBUS\_SYSTEM\_BUS\_ADDRESS=unix:path=/host/run/dbus/system\_bus\_socket  
labels:  
io.balena.features.dbus: ‘1’

I’m not sure how to continue to get this container working in Balena. Do you have any idea what we’re doing wrong or what we have to do to fix this issue?  
Thanks in advance for the help.

---

<div class="post-metadata">

**Author:** ![nghiant2710](https://avatars.discourse-cdn.com/v4/letter/n/90db22/32.png) [@nghiant2710](https://forums.balena.io/u/nghiant2710)\
**Post date:** [February 24, 2021, 2:32am UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/4 "2021-02-24T02:32:56Z")

</div>

Hi,

Can you please share with us your docker-compose file so we can have a look?

---

<div class="post-metadata">

**Author:** ![Thijs](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@Thijs](https://forums.balena.io/u/Thijs)\
**Post date:** [February 24, 2021, 8:08am UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/6 "2021-02-24T08:08:51Z")

</div>

The docker-compose file:

version: “2.1” # Currently the maximum version that is supported by Balena, see [Multiple containers - Balena Documentation](https://www.balena.io/docs/learn/develop/multicontainer/)

volumes:  
prometheus-data:  
grafana-data:  
meter2mqtt-sqlite:  
meter2mqtt-secrets:  
auth-sqlite:  
auth-private:  
auth-public:

services:  
prometheus:  
build:  
context: .  
dockerfile: dockerfiles/prometheus  
volumes:  
- prometheus-data:/prometheus  
restart: “unless-stopped”  
command:  
- ‘–config.file=/etc/prometheus/prometheus.yml’  
- ‘–storage.tsdb.path=/prometheus’  
- ‘–storage.tsdb.retention.time=92d’ # Should be 3 months, but months are not available. Make it 92d (92 days) instead.

node-exporter:  
image: prom/node-exporter:latest  
restart: “unless-stopped”

grafana:  
build:  
context: .  
dockerfile: dockerfiles/grafana  
depends\_on:  
- prometheus  
volumes:  
- grafana-data:/var/lib/grafana  
environment:  
- GF\_USERS\_ALLOW\_SIGN\_UP=false  
- GF\_SECURITY\_ALLOW\_EMBEDDING=true  
- GF\_USERS\_DEFAULT\_THEME=light  
- GF\_DASHBOARDS\_DEFAULT\_HOME\_DASHBOARD\_PATH=/etc/grafana/provisioning/dashboards-json/skdbyte\_dashboard.json  
- GF\_AUTH\_LOGIN\_COOKIE\_NAME=skdbyte\_refresh\_token  
- SKDBYTE\_PROMETHEUS\_URL=http://localhost:9090  
- GF\_SECURITY\_ADMIN\_USER=Admin  
- GF\_SECURITY\_ADMIN\_PASSWORD=admin  
- SKDBYTE\_GRAFANA\_URL=http://localhost:3000  
restart: “unless-stopped”

meter2mqtt:  
build:  
context: .  
dockerfile: dockerfiles/meter2mqtt  
working\_dir: /home/node/app  
environment:  
- NODE\_ENV=production  
- NODE\_PATH=/home/node/app/node\_modules  
- TYPEORM\_CONNECTION=sqlite  
- TYPEORM\_DATABASE=/home/sqlite/meter2mqtt.sqlite  
- TYPEORM\_LOGGING=false  
- TYPEORM\_ENTITIES=/home/node/dist/Entity/_.js  
- TYPEORM\_MIGRATIONS=/home/node/dist/Migrations/_.js  
- TYPEORM\_MIGRATIONS\_TABLE\_NAME=migrations  
- SKDBYTE\_SUPERVISE\_INTERVAL=2000  
- SKDBYTE\_MQTT\_ADDRESS=mqtt://mqtt  
- SKDBYTE\_DEFAULT\_METER\_POLL\_INTERVAL=3600000  
- SKDBYTE\_MAX\_SLAVES\_WITHOUT\_LICENSE=10  
- SKDBYTE\_PROMETHEUS\_URL=http://localhost:9090  
ports:  
- “8002:8002”  
volumes:  
- meter2mqtt-sqlite:/home/sqlite  
- meter2mqtt-secrets:/home/secrets/public  
depends\_on:  
- mqtt  
restart: “unless-stopped”  
command: “npm run start”

mqtt:  
image: “eclipse-mosquitto:1.6.13”  
networks:  
- skdbyte  
restart: “unless-stopped”

mqtt2prometheus:  
build:  
context: .  
dockerfile: dockerfiles/mqtt2prometheus  
working\_dir: /home/node/app  
ports:  
- “8003:8003” # Must be bound to in order for the prometheus scraper to access it.  
environment:  
- NODE\_ENV=production  
- NODE\_PATH=/home/node/app/node\_modules  
- SKDBYTE\_LICENSED=1  
depends\_on:  
- mqtt  
restart: “unless-stopped”  
command: “npm run start”

admin:  
build:  
context: .  
dockerfile: dockerfiles/admin  
working\_dir: /home/node/app  
environment:  
- NODE\_ENV=production  
- NODE\_PATH=/home/node/app/node\_modules  
- REACT\_APP\_PORT\_AUTH=8001  
- REACT\_APP\_PORT\_CONFIG=8001  
- REACT\_APP\_PORT\_METER=8002  
- REACT\_APP\_PORT\_GRAFANA=3000  
ports:  
- “8000:3000”  
depends\_on:  
- auth  
restart: “unless-stopped”  
command: “./node\_modules/serve/bin/serve.js -s build -l 3000”

auth:  
build:  
context: .  
dockerfile: dockerfiles/auth  
working\_dir: /home/node/app  
environment:  
- NODE\_ENV=production  
- NODE\_PATH=/home/node/app/node\_modules  
- TYPEORM\_CONNECTION=sqlite  
- TYPEORM\_DATABASE=/home/sqlite/auth.sqlite  
- TYPEORM\_LOGGING=false  
- TYPEORM\_ENTITIES=/home/node/dist/Entity/_.js  
- TYPEORM\_MIGRATIONS=/home/node/dist/Migrations/_.js  
- TYPEORM\_MIGRATIONS\_TABLE\_NAME=migrations  
- DISPLAY=:0  
- DBUS\_SYSTEM\_BUS\_ADDRESS=unix:path=/host/run/dbus/system\_bus\_socket  
- JWT\_TOKEN\_TTL=5 minutes  
- JWT\_REFRESH\_TOKEN\_NAME=skdbyte\_refresh\_token  
- GF\_SECURITY\_ADMIN\_USER=Admin  
- GF\_SECURITY\_ADMIN\_PASSWORD=admin  
- SKDBYTE\_GRAFANA\_URL=http://localhost:3000  
- SKDBYTE\_LICENSED=1  
labels:  
io.balena.features.dbus: ‘1’  
volumes:  
- auth-sqlite:/home/sqlite  
- auth-private:/home/secrets/private  
- auth-public:/home/secrets/public  
restart: “unless-stopped”  
command: “npm run start:prod”  
privileged: true

---

<div class="post-metadata">

**Author:** ![Thijs](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@Thijs](https://forums.balena.io/u/Thijs)\
**Post date:** [February 24, 2021, 8:12am UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/7 "2021-02-24T08:12:31Z")

</div>

We use this script to start the balenaos container: [balenaos-in-container/balenaos-in-container.sh at master · balena-os/balenaos-in-container · GitHub](https://github.com/balena-os/balenaos-in-container/blob/master/balenaos-in-container.sh)

We removed the dns part on line 162, as this was causing the container to have dns issues.

We start the container with the following command:  
./balenaos-in-container.sh --image resin/resinos:2.12.4\_rev1.dev-generic-aarch64 --id test -c /config.json --detach --extra-args “-p 3000:3000 -p 8000:8000 -p 8001:8001 -p 8002:8002 -p 8003:8003”

---

<div class="post-metadata">

**Author:** ![Thijs](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@Thijs](https://forums.balena.io/u/Thijs)\
**Post date:** [February 24, 2021, 8:31am UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/8 "2021-02-24T08:31:18Z")

</div>

The auth container is the one with the dbus issues btw.

---

<div class="post-metadata">

**Author:** ![Thijs](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@Thijs](https://forums.balena.io/u/Thijs)\
**Post date:** [March 1, 2021, 2:51pm UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/9 "2021-03-01T14:51:02Z")

</div>

Do you have any update on this? Just to be sure that this post isn’t forgotten.

---

<div class="post-metadata">

**Author:** ![klutchell](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/klutchell/32/861_2.png) [@klutchell](https://forums.balena.io/u/klutchell)\
**Post date:** [March 3, 2021, 9:23pm UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/10 "2021-03-03T21:23:49Z")

</div>

This is quite interesting, I’m not sure I’ve ever seen dbus being accessed from a service on balenaOS in a container like this. Just to clarify, you would like the `auth` service to access the dbus of the hostOS or the balenaOS?

---

<div class="post-metadata">

**Author:** ![Thijs](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@Thijs](https://forums.balena.io/u/Thijs)\
**Post date:** [March 4, 2021, 8:56am UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/12 "2021-03-04T08:56:20Z")

</div>

We would like to access the dbus of the hostOS. We need access to the WLAN and other network cards. It’s also a solution if this is possible with the dbus of balenaOS while it’s runnning in a container.

---

<div class="post-metadata">

**Author:** ![zwhitchcox](https://avatars.discourse-cdn.com/v4/letter/z/8e7dd6/32.png) [@zwhitchcox](https://forums.balena.io/u/zwhitchcox)\
**Post date:** [March 4, 2021, 6:55pm UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/13 "2021-03-04T18:55:42Z")

</div>

Hi Thijs,

Kyle suggested adding a bind mount to your container as an extra argument to docker, i.e.,

```auto
-b /run/dbus/system_bus_socket:/run/dbus/system_bus_socket

```

I would also suggest adding the argument `--network host`, as this will give you complete access to the devices network, and you also won’t have to expose every port.

If you don’t want balenaOS to share the network with the host os, I think you can just use the argument

```auto
--cap-add NET_ADMIN

```

Although, there might be some more privileges you need to add ([see here](https://gist.github.com/computermouth/4a0c2653951b2836bde64524bb206af6)).

First I would go with sharing the network just for debugging purposes at least.

---

<div class="post-metadata">

**Author:** ![Thijs](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@Thijs](https://forums.balena.io/u/Thijs)\
**Post date:** [March 4, 2021, 7:44pm UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/15 "2021-03-04T19:44:01Z")

</div>

I’ve tried adding that bind mount (I expect u meant -v instead of -b, that’s what I tried at least), but this doesn’t seem to work. I’ve played around a bit, and figured out that any bind mount I create in /run on the balenaOS isn’t actually there. i.e. if I bindmount /run/dbus/system\_bus\_socket:/run/testfolder/system\_bus\_socket there won’t be a folder named testfolder in /run. However, if I check the volumes of the container, it does say the bindmount is there. I’m not sure why this is happening, but the only thing I could come up with is that the /run folder get’s overridden during the container creation. If I make a bind mount like this: /run/dbus/system\_bus\_socket:/root/dbus/system\_bus\_socket the file is there. However, I can’t configure balena to check for the dbus in any other location than /run/dbus/system\_bus\_socket

I’ve tried adding the --network host, but this didn’t help. The only noticeable change is that I can’t access the device via SSH anymore. (it lost it’s ip, I managed to fix this by restarting the device)

If I use the --cap-add NET\_ADMIN argument I don’t have this issue, but the auth container is still complaining about that it can’t find /host/run/dbus/system\_bus\_socket (which is there in the balenaOS container, but I don’t think it’s the one from the hostOS)

---

<div class="post-metadata">

**Author:** ![klutchell](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/klutchell/32/861_2.png) [@klutchell](https://forums.balena.io/u/klutchell)\
**Post date:** [March 5, 2021, 7:42pm UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/16 "2021-03-05T19:42:49Z")

</div>

Ah yes, I forgot that `/run` is remounted as `tmpfs` in balenaOS at runtime, so we can’t put mounts there for now. Let me try some things and I’ll get back to you.

---

<div class="post-metadata">

**Author:** ![klutchell](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/klutchell/32/861_2.png) [@klutchell](https://forums.balena.io/u/klutchell)\
**Post date:** [March 5, 2021, 8:08pm UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/17 "2021-03-05T20:08:01Z")

</div>

So I think the best way to achieve this is configure the host OS dbus to listen on a local network socket (in addition to the default unix file socket). This can be done via `session.conf` in either /etc/dbus-1 or /usr/share/dbus-1, but is a little out of scope for support so I’ll leave that part to you.

Then, if you are in host networking mode, you can simply set `DBUS_SYSTEM_BUS_ADDRESS=tcp:host=localhost,port=12434` or if you are in bridge networking you can dynamically determine the address of the host by looking at the assigned container bridge address and subnet. You can also remove `io.balena.features.dbus` as itsn’t serving any purpose.

Specifically it is this line that is the issue in your case, combined with the fact that balenaOS mounts `/run` as `tmpfs`.

> <https://github.com/balena-io/balena-supervisor/blob/master/src/compose/utils.ts#L337>

Another workaround I dismissed was re-purposing another feature label, like `io.balena.features.firmware` and sneaking the hostOS socket mount into `/lib/firmware` but I can’t recommend that method and it’s definitely way out of scope for support. This TCP socket workaround is definitely the route I would go depending on how many hosts I needed to configure.

---

<div class="post-metadata">

**Author:** ![Thijs](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@Thijs](https://forums.balena.io/u/Thijs)\
**Post date:** [March 19, 2021, 9:57am UTC](https://forums.balena.io/t/issues-with-dbus-in-generic-aarch64-image/259847/19 "2021-03-19T09:57:42Z")

</div>

Accessing the dbus via TCP didn’t work completely, as we seemed to not have the rights to do some of the necessary calls. But by re-purposing the firmware label so we could access the dbus via socket did do the trick for us. Thanks for your help!
