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

Collector.user fails with dbus error #42

Open
2knarf opened this issue Nov 1, 2021 · 1 comment
Open

Collector.user fails with dbus error #42

2knarf opened this issue Nov 1, 2021 · 1 comment

Comments

@2knarf
Copy link

2knarf commented Nov 1, 2021

root@util03:~/systemd_exporter-0.4.0.linux-amd64# ./systemd_exporter --log.level="debug" --collector.user
INFO[0000] Starting systemd_exporter (version=0.4.0, branch=HEAD, revision=bf3e6eb30bcc6cb222b9ab5ec50fab3bd0f75a67) source="main.go:41"
INFO[0000] Build context (go=go1.13.10, user=root@a01a64035e14, date=20200421-03:35:32) source="main.go:42"
INFO[0000] Listening on :9558 source="main.go:88"

ERRO[0003] could not get list of systemd units from dbus: Process org.freedesktop.systemd1 exited with status 1 source="systemd.go:228"

@sydoracle
Copy link

If anyone else hits this, it could be down to an old version of DBUS

There's a stub version of "/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service" which calls /bin/false

From systemd/systemd#5247
"org.freedesktop.systemd1 is an interface to interact with Systemd via DBus, and to my knowledge, it is the only purpose of this service file. The /bin/false thing is just a stub thing, it could be /dev/null, or whatever (falsy thing). The Exec property is just to make the service file a valid one, and have nothing to do with starting or stopping Systemd, or DBus interactions with it."

I believe it is fixed in dbus 1.11
systemd/systemd#13396

"Since dbus 1.11.0, a dbus-daemon that is run with --systemd-activation automatically assumes that o.fd.systemd1 is an activatable service. As a result, with a new enough dbus version, /usr/share/dbus-1/services/org.freedesktop.systemd1.service and /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service should become unnecessary, and they can be removed."

Try the following:
dbus-send --session --print-reply --reply-timeout=2000 --type=method_call --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager.ListUnits | head

If it fails with a "Autolaunch error: X11 initialization failed." you can get around that with a export $(dbus-launch)
I've got one system where "dbus-daemon --version" is 1.10.24 which then gives an error
"Error org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1"

On a later system (DBus 1.12.8) it succeeds and lists the services.

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