On Tue, Mar 21, 2023 at 12:38 AM Eyal Lebedinsky fedora@eyal.emu.id.au wrote:
[...]
There used to be an environment variable that pointed to the pulseaudio socket, but that seems to have changed (at least in F37). Check that the XDG_RUNTIME_DIR variable is set. It wasn't when I tested going through root. It should point to /run/user/<pid> which is most likely /run/user/1000 unless you aren't the first user.
Yet, it is present and set up. I expect that it is lost by sudo... yes it is. I set it up manually and got a similar error:
[eyal@e7:~]$ sudo -i [root@e7 ~]# set|grep XDG_RUNTIME_DIR [root@e7 ~]# export XDG_RUNTIME_DIR=/run/user/500 [root@e7 ~]# paplay /audio/ogg/beginning.ogg XDG_RUNTIME_DIR (/run/user/500) is not owned by us (uid 0), but by uid 500! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.) Connection failure: Connection refused pa_context_connect() failed: Connection refused
Give `sudo -E` a try.
Jeff