D-Bus setup failed: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory

When running my composite docker application I am getting error:

18.06.19 00:41:35 (+0200)  pulseaudio  D-Bus setup failed: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory

I have no clue how to fix this.

FYI the relevant part of my docker-compose.yml

version: '2'
services:
  ...
  pulseaudio:
    image: woahbase/alpine-pulseaudio:armhf
    #restart: always
    #network_mode: host
    #privileged: true
    labels:
      io.balena.features.dbus: '1'
      io.balena.features.kernel-modules: '1'

Hey, I believe you just need to tell pulseaudio where to find the dbus socket, detailed here: https://www.balena.io/docs/learn/develop/runtime/#dbus-communication-with-host-os

You could set DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket in the environment section of the pulseaudio service, and this should fix your issue.

1 Like

Thanks a lot.
Like you proposed: adding the last 2 lines (see below) in my docker-compose.yml for the pulseaudio service specification fixed this issue.

  pulseaudio:
    image: woahbase/alpine-pulseaudio:armhf
    #restart: always
    #network_mode: host
    privileged: true
    labels:
      io.balena.features.dbus: '1'
      io.balena.features.kernel-modules: '1'
    environment:
      - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket

Great to hear! Thanks for posting your code for anybody else that has this issue :slight_smile:

I would suggest adding this to the documentation here: https://www.balena.io/docs/learn/develop/runtime/#dbus-communication-with-host-os

I realize it’s standard docker stuff but it seems like a cleaner solution than exporting in the container or having a convenience script doing it.

Thanks, the PR is pending here: https://github.com/balena-io/docs/pull/1395