2

I created a namespace and ran a terminal like that:

ip netns exec <namespace> gnome-terminal

As by default namespace are handled in root, when I open the terminal I change to my normal user:

su <user>

Then I run firefox, spotify, etc. the sound is not heard in headphones, something you notice is that in the sound configuration (gnome) is that there is no application that emits sound. When done normally, the application that emits sound appears in a list, however when done as explained, the list appears empty.

1
  • Quick guess: Pulseaudio is using a unix domain socket, and that socket is not available in your network namespace.
    – dirkt
    Commented May 7, 2019 at 6:11

2 Answers 2

3

PulseAudio selects the path through the environment variable XDG_RUNTIME_DIR. When you change to root you must make sure that the environment variables you need are lost to us.

1

in my case, to get sound working with chrome when being run with netns exec and setuidgid, i set the "PULSE_SERVER", "PULSE_COOKIE" variables accordingly:

sudo ip netns exec myNamespace setuidgid drgecko \
     bash -c "HOME='/home/drgecko' PULSE_SERVER=/run/user/$(id -u drgecko)/pulse/native PULSE_COOKIE=/home/drgecko/.config/pulse/cookie google-chrome"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .