# Systemd collector "couldn't get dbus connection"

**URL:** <https://discuss.prometheus.io/t/systemd-collector-couldnt-get-dbus-connection/3438>\
**Category:** node\_exporter\
**Created:** [July 30, 2025, 1:49pm UTC](https://discuss.prometheus.io/t/systemd-collector-couldnt-get-dbus-connection/3438 "2025-07-30T13:49:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BugSquanch](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@BugSquanch](https://discuss.prometheus.io/u/BugSquanch)\
**Post date:** [July 30, 2025, 1:49pm UTC](https://discuss.prometheus.io/t/systemd-collector-couldnt-get-dbus-connection/3438/1 "2025-07-30T13:49:47Z")

</div>

Hi everyone!  
I’m in need for some help. 😅

I’m trying to set up the `systemd collector` from `node_exporter` inside a `docker` container. I can’t figure out what the problem is.

The logs show me this, over and over again:

```auto
node_exporter | ts=2025-07-30T13:33:46.548Z caller=collector.go:169 level=error msg="collector failed" name=systemd duration_seconds=5.5409e-05 err="couldn't get dbus connection: dial unix /var/run/dbus/system_bus_socket: connect: no such file or direct
ory"

```

When I exec into the container and `ls the dbus dir` I get this:

```auto
/ $ ls -la /host/var/run/dbus/
total 0
drwxr-xr-x 2 root root 60 Jul 29 23:33 .
drwxr-xr-x 36 root root 920 Jul 30 11:02 ..
srw-rw-rw- 1 root root 0 Jul 29 23:33 system_bus_socket

```

So the file is present.

This is my docker-compose file:

```auto
node_exporter:
  image: quay.io/prometheus/node-exporter:v1.5.0
  container_name: node_exporter
  command:
     - "--path.rootfs=/host"
     - "--collector.systemd"
   pid: host
   restart: unless-stopped
   volumes:
      - /:/host:ro,rslave
   networks:
      - monitoring

```

The rest of node\_exporter is working fine.

Does anyone know what I’m missing here?  
Any help will be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![BugSquanch](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@BugSquanch](https://discuss.prometheus.io/u/BugSquanch)\
**Post date:** [July 30, 2025, 6:37pm UTC](https://discuss.prometheus.io/t/systemd-collector-couldnt-get-dbus-connection/3438/2 "2025-07-30T18:37:03Z")

</div>

I am retarded. It’s right there in the error log lol.  
I mount my `host` to `/host` inside the container. But node\_exporter is looking for `/var/run/dbus/system_bus_socket`, NOT **`/host`** `/var/run/dbus/system_bus_socket`.  
Manually mounting the host’s``/var/run/dbus/system_bus_socket``to `/var/run/dbus/system_bus_socket` fixes my issue.

---

<div class="post-metadata">

**Author:** ![romgo](https://avatars.discourse-cdn.com/v4/letter/r/ecc23a/32.png) [@romgo](https://discuss.prometheus.io/u/romgo)\
**Post date:** [October 13, 2025, 7:59am UTC](https://discuss.prometheus.io/t/systemd-collector-couldnt-get-dbus-connection/3438/3 "2025-10-13T07:59:45Z")

</div>

Hello,

I got the same issue, but in my system (debian 12) the folder `/var/run `is a link to`/run` so it was a broken link inside the container because there is no /run mapping to the host.

So I needed to also directly map this path as follow :

```yaml
  node-exporter:
    image: prom/node-exporter:v1.9.1
    hostname: "node-exporter-{{.Node.Hostname}}"
    command:
      - '--path.rootfs=/host'
      - '--collector.systemd'
      - '--collector.processes'
    deploy:
      mode: global
      resources:
        limits:
          memory: 128M
        reservations:
          memory: 64M
    volumes:
      - '/:/host:ro,rslave'
      - '/var/run/dbus:/var/run/dbus:ro,rslave'

```

I don’t know if this is only related to debian 12.

Hope this can help.
