[pulseaudio-discuss] System-wide PulseAudio instance with realtime priority as non-root from systemd

Matt Garman matthew.garman at gmail.com
Fri Oct 30 22:13:35 UTC 2020

My use case is as follows: I am trying to set up a Raspberry Pi as a
sound server for my Linux PC.  My Linux PC will use PulseAudio's
networking capability to send the audio to the Raspberry Pi, which is
connected to a stereo system.

All the examples I've found online for doing this seem to suggest
running the PulseAudio instance on the RPi in system mode.  But with
all the warnings about system mode, I thought I'd try to achieve this
running Pulse in user mode.

Furthermore, I want to have Pulse start automatically at boot time on
the RPI, and run with real time priority.  I want PulseAudio to run as
user "pulse".

I have this in /etc/security/limits.conf:

pulse   -       rtprio 90
pulse   -       nice    -19

And this in /etc/pulse/daemon.conf

realtime-scheduling = yes
realtime-priority = 5

And it seems to work as expected when launched from the CLI:

# runuser -u pulse -- /usr/bin/pulseaudio --daemonize=no
--disallow-module-loading --disallow-exit=yes --disable-shm=no

Pulse prints this when starting:

I: [pulseaudio] core-util.c: Successfully gained nice level -11

And looking at the process via "top" or "ps" shows that it is indeed
running as the user "pulse".

I have this in my systemd service file:

ExecStartPre=/bin/mkdir -p /var/run/pulse
ExecStartPre=/bin/chown -R pulse:pulse /var/run/pulse
ExecStart=/usr/bin/pulseaudio --daemonize=no --disallow-module-loading
--disallow-exit=yes --disable-shm=no --verbose

And when I to "systemctl start pulseaudio", it starts, but not with
realtime priority, and I have this in journalctl:

Oct 30 17:09:00 dietpi-music pulseaudio[1104]: I: [pulseaudio] main.c:
setrlimit(RLIMIT_NICE, (31, 31)) failed: Operation not permitted
Oct 30 17:09:00 dietpi-music pulseaudio[1104]: I: [pulseaudio] main.c:
setrlimit(RLIMIT_RTPRIO, (9, 9)) failed: Operation not permitted

What am I missing?


More information about the pulseaudio-discuss mailing list