[pulseaudio-discuss] Service File for running in system mode

Florian Lindner mailinglists at xgm.de
Tue Oct 4 17:42:20 UTC 2016


Hey,

ok, my working configuration on Arch with pulseaudio 9.0.

The unit file:

# /etc/systemd/system/pulseaudio.service
[Unit]
Description=PulseAudio system server
After=dbus.socket
Wants=dbus.socket

[Service]
Type=notify
ExecStart=/usr/bin/pulseaudio --daemonize=no --system --realtime
--disallow-module-loading --disallow-exit --log-target=journal

[Install]
WantedBy=sound.target


Configure users according to:

https://rudd-o.com/linux-and-free-software/how-to-make-pulseaudio-run-once-at-boot-for-all-your-users

In /etc/pulse/client.conf set

default-server = /var/run/pulse/native

Add user pulse to group audio.
The client user does not need audio group.

Seems to work so far...

Thanks for any improvements
Florian

Am 04.10.2016 um 13:22 schrieb Tanu Kaskinen:
> On Thu, 2016-09-29 at 17:52 +0200, Florian Lindner wrote:
>> Hello,
>>
>> I know that running pulseaudio in system mode is discouraged, but there
>> are valid use cases.
>>
>> Is there an official upstream systemd service file for that? I found a
>> couple of variants on the internet, but I would prefer to use an
>> recommeded one?
> 
> No, there's no official upstream file. I think it would be good to have
> one, though. Would you like to contribute a patch?
> 
>> - Is is Type simple or notify?
> 
> notify
> 
>> - Should --disallow-exit be set?
> 
> Yes, I think that's a good idea.
> 
>> - I have found service files that use "After=sound.target dbus.service"
>> as well as "Before=sound.target". What is correct?
> 
> To me it seems most sensible to have pulseaudio as a part of
> sound.target, so using WantedBy=sound.target would make the most sense
> to me.
> 
> For dealing with the dbus dependency, I think Wants=dbus.socket and
> After=dbus.socket would be appropriate.
> 
> My advice is not based on trying to actually run pulseaudio in the
> system mode as a systemd service.
> 
>> - What is it WantedBy?
> 
> If you use it in the pulseaudio service file, it makes pulseaudio a
> dependency for something else. See here for details:
> https://www.freedesktop.org/software/systemd/man/systemd.unit.html
> 


More information about the pulseaudio-discuss mailing list