On 3/20/23 07:22, Eyal Lebedinsky wrote:
Fedora 36 up-to-date.
$ uname -a Linux e4.eyal.emu.id.au 6.1.15-100.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Mar 3 17:22:46 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
I have a script running as root (using sudo) and in it I play a sound paplay /audio/ogg/beginning.ogg and it always worked.
Then a few days ago it stopped and I now get an error. Something changed.
$ sudo paplay /audio/ogg/beginning.ogg Connection failure: Connection refused pa_context_connect() failed: Connection refused
Playing sounds from a userid not "logged in" has always been very problematic and took me a lot of experimentations in the past. My current solution is something like: (this is run with the user logged in and "owning" the audio)
pactl load-module module-native-protocol-tcp listen=127.0.0.1 export PULSE_SERVER='tcp:127.0.0.1:4713' pax11publish -e xhost si:localuser:mysecondaryuser
where "mysecondaryuser" should be root in your case.
This is basically - enabling TCP connections to pulseaudio (or pipewire emulation) - making the path available to users able to interact with the X11 session - enabling a user to access the X11 session
No warranty that it will work in your case. No idea how this would be adapted when using Wayland instead of X11.
Regards.