[pulseaudio-discuss] how to Start a pulseaudio application as a daemon with systemd

Christophe Lohr christophe.lohr at cegetel.net
Tue May 8 17:50:54 UTC 2018

  I'm coding a small application which use pulseaudio.
This application works well when I test it inside my user session (x11,
dbus, xfce, etc.)

Now I would like to start this application as a deamon with systemd (I
wrote a simple foobar.service script according to systemd tutorials).

Unfortunately this fails with messages:
mai 08 17:29:02 systemd[1]: Started FooBar.
mai 08 17:29:02 pulseaudio[25472]: [pulseaudio] server-lookup.c: Unable
to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to
autolaunch a dbus-daemon without a $DISPLAY for X11
mai 08 17:29:02 systemd[1]: foobar.service: Main process exited,
code=exited, status=1/FAILURE
mai 08 17:29:02 systemd[1]: foobar.service: Unit entered failed state.
mai 08 17:29:02 systemd[1]: foobar.service: Failed with result 'exit-code'.

If I understand well, the pulseaudio client library doesn't find how to
reach the pulseaudio server, isn't it?
How to fix this?

Shall I start a pulseaudio server dedicated to the foobar user (the one
who start my foobar daemon)?
Or a "system" pulseaudio server?

Best regards

More information about the pulseaudio-discuss mailing list