Ubuntu – How to start/configure pulseaudio remotely with ssh

environment-variablespulseaudiosoundssh

I have a remote machine to which I can ssh. On the remote machine there is a program that uses pulse audio to get input from a USB microphone attached to the remote machine. This setup works fine when operated locally, i.e. I can get input from pulse audio when connected locally.

Over ssh, I receive the error:

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

Equally, when I try to open pavucontrol on the remote machine via ssh -X, I get the message:

Connection to PulseAudio failed. … In this case this is likely
because PULSE_SERVER in the Environment/X11 Root Window Properties or
default-server in client.conf is misconfingured.

pulseaudio --start
N: [pulseaudio] main.c: User-configured server at {30ab51874e4a0ca492830f1400000007}unix:/home/user2/.pulse/30ab51874e4a0ca492830f1400000007-runtime/native, refusing to start/autospawn.

Attempting to start pulse audio with x11: start-pulseaudio-x11

Connection failure: Connection refused
pa_context_connect() failed: Connection refused

pulseaudio –check returns straight to the command prompt.

If I attempt to get the ssh X properties, I get:

user1@remote-pc:~$: xprop -root | grep PULSE
PULSE_COOKIE(STRING) = Some stuff here
PULSE_SERVER(STRING) = "{30ab51874e4a0ca492830f1400000007}unix:/home/user2/.pulse/30ab51874e4a0ca492830f1400000007-runtime/native"
PULSE_SESSION_ID(STRING) = "30ab51874e4a0ca492830f1400000007-1407765989.424751-1424846683"
PULSE_ID(STRING) = "12165@30ab51874e4a0ca492830f1400000007/2040"

Ok. I have seen questions related to this issue, but in each case, the asker wants to transmit sound across a network connection, which I do >not< want to do. So what do I configure PULSE_SERVER to be?

Best Answer

I seem to have resolved the problem by running

pax11publish -r

Now, xprop -root | grep PULSE shows:

PULSE_SERVER(STRING) = "{9899a0f46bdae6bbc8e6e8b200000005}unix:/home/user1/.pulse/9899a0f46bdae6bbc8e6e8b200000005-runtime/native"

Apparently pulseaudio --check should normally go to the command prompt. Apparently this indicates it is running.