balena-io-experimental / audio

Audio building block for balenaOS, based on pulseaudio.
https://hub.balena.io/blocks
31 stars 13 forks source link

Evaluate running daemon in user mode instead of system #8

Closed tmigone closed 4 years ago

tmigone commented 4 years ago

System mode for pulseaudio daemon is meant to be used in embedded setups where the concept of users doesn't make much sense. There are some drawbacks of using system mode, most notably that pacmd doesn't work (and devs seem to not give system mode much attention).

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/

tmigone commented 4 years ago

Compelling reasons for not running in system mode can be found here: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/

Specifically, this: When in system mode, shared memory data transport is disabled for security reasons, which means: much higher memory usage and CPU load in system mode

Since we want to keep this primitive's footprint as small as possible, and there isn't a good reason for running in system mode, we should use user mode.

doronbehar commented 4 years ago

I understand the concern, and I do not strongly disagree / agree. But, it's kind of self contradicting that the logs says:

W: [pulseaudio] main.c: This program is not intended to be run as root (unless --system is specified).
doronbehar commented 4 years ago

Also, note that pacmd doesn't work, but pactl does, and pactl can even work in every container if prefixed with env OULSE_SERVER=.