neutrinolabs / pulseaudio-module-xrdp

xrdp sink / source pulseaudio modules
GNU Lesser General Public License v2.1
215 stars 42 forks source link

Debian 10: no sound, Code 11 - module-xrdp-sink.c: sink_process_msg: not running #44

Open manutenfruits opened 4 years ago

manutenfruits commented 4 years ago

I followed the steps on the README on Debian Buster and I see the "xrdp sink" on pulseaudio but hear no sound.

I stopped pulseaudio in systemd, made sure no instances were running and ran pulseaudio -vvvv as a regular user on a terminal. I see this in stdout:

D: [xrdp-sink] module-xrdp-sink.c: Thread starting up
D: [xrdp-sink] module-xrdp-sink.c: sink_process_msg: code 11
E: [xrdp-sink] module-xrdp-sink.c: sink_process_msg: not running
E: [xrdp-sink] module-xrdp-sink.c: close_send:
D: [xrdp-sink] module-xrdp-sink.c: process_render: u->block_usec 30000

How can I troubleshoot this further?

For more info, I added these lines to /etc/pulse/default.pa (the others were already present):

### XRDP modules
.ifexists module-xrdp-sink.so
load-module module-xrdp-sink.so
.endif
.ifexists module-xrdp-source.so
load-module module-xrdp-source.so
.endif
veixus commented 4 years ago

Hi, I have stumbled on similar problem myself on Ubuntu 20.04 release. By accident I did a "killall pulseaudio" and something started working. I felt like it was hopeless. Maybe there's a conflict of some sort that someone more experienced could dig into? Perhaps give it a try?

What I did to fix this weird thing to survive a reboot was to "mask" the launches of pulseaudio service and to start it later instead with xdg autostart:

systemctl --user mask pulseaudio.service

contents of ~/.config/autostart/pulseaudio.desktop

[Desktop Entry]
Type=Application
Exec=pulseaudio
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=pulseaudio
Name=pulseaudio
Comment[en_US]=pulseaudio
Comment=pulseaudio
t0dbld commented 4 years ago

Can confirm this works ! Kali Linux Pulseaudio 13.0 xrdp 0.9.12

didierjrichard commented 4 years ago

I confirm there's a glitch with Ubuntu 20..04. Worked like a charm on previous 18.04, then after upgrade, no more sound from the speakers. Strangely enough, 'pavucontrol' and the likes showed everything running OK, including the moving bars, yet nothing comes out. There's some sort of conflict between 20.04's version of pulseaudio (13.99.1), associated systemd in --user mode, and the xrdp sink. Recommendations by veixus did the job, I now get sound back from xrdp applications, thanks !

kkwpsi commented 4 years ago

I have the same problem on Debian 11 and pulseaudio 13.0. I tried module-sink-xrdp that compiled from source and various versions from net. No luck. Veixus' solution doesn't work for me, because I only run pulseaudio as regular user, not as a service.

ghost commented 4 years ago

Same symptoms here on Ubuntu 20.10 on pulseaudio 13.99.2.

Kishi85 commented 3 years ago

Hi, I have stumbled on similar problem myself on Ubuntu 20.04 release. By accident I did a "killall pulseaudio" and something started working. I felt like it was hopeless. Maybe there's a conflict of some sort that someone more experienced could dig into? Perhaps give it a try?

What I did to fix this weird thing to survive a reboot was to "mask" the launches of pulseaudio service and to start it later instead with xdg autostart:

systemctl --user mask pulseaudio.service

contents of ~/.config/autostart/pulseaudio.desktop

[Desktop Entry]
Type=Application
Exec=pulseaudio
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=pulseaudio
Name=pulseaudio
Comment[en_US]=pulseaudio
Comment=pulseaudio

I've hit this issue as well now and after some debugging i think i unterstand how this workaround fixes it.

The main problem here is that systemd does not use environment variables from the user session when starting services, which means that the necessary environment variables PULSE_SCRIPT, XRDP_SOCKET_PATH, XRDP_PULSE_SOURCE_SOCKET and XRDP_PULSE_SINK_SOCKET are not passed along to pulseaudio when the session (and therefore the pulseaudio user service) starts up.

metalefty commented 3 years ago

See also https://github.com/neutrinolabs/xrdp/discussions/1910

matt335672 commented 3 years ago

Note: Edited 5th October 2021 to improve files

Here's a possible way forward:-

1) Read #59 to get some background. 2) Build the pulseaudio module from my testing branch https://github.com/matt335672/pulseaudio-module-xrdp/tree/module_params

3) Edit /etc/xrdp/sesman.ini and comment out the PULSE_SCRIPT= line in the [SessionVariables] section.

4) Create this file in /etc/xdg/autostart/pulseaudio-xrdp.desktop

[Desktop Entry]
Version=1.0
Name=PulseAudio xrdp modules
Comment=Load PulseAudio Modules for xrdp
Exec=/etc/xrdp/load_pa_modules.sh
Terminal=false
Type=Application
Categories=
GenericName=

5) Create this file in /etc/xrdp/load_pa_modules.sh:-

#!/bin/sh

PACTL=/usr/bin/pactl

if [ -n "$XRDP_SESSION" -a \
     -n "$XRDP_SOCKET_PATH" -a \
     -n "$XRDP_PULSE_SINK_SOCKET" -a \
     -n "$XRDP_PULSE_SOURCE_SOCKET" ]
then
    # Unload modules
    $PACTL unload-module module-xrdp-sink >/dev/null 2>&1
    $PACTL unload-module module-xrdp-source >/dev/null 2>&1

    # Reload modules
    $PACTL load-module module-xrdp-sink \
        xrdp_socket_path=$XRDP_SOCKET_PATH \
        xrdp_pulse_sink_socket=$XRDP_PULSE_SINK_SOCKET && \
    \
    $PACTL load-module module-xrdp-source \
        xrdp_socket_path=$XRDP_SOCKET_PATH \
        xrdp_pulse_source_socket=$XRDP_PULSE_SOURCE_SOCKET
fi

exit $?

6) Make /etc/xrdp/load_pa_modules.sh executable

Reboot for a proper test. I use paplay /usr/share/sounds/sound-icons/trumpet-12.wav

Works for me on Debian 10 and 11 using XFCE.

Bear in mind you can't log the same user in to an xrdp session and the console on these OSes.

Any feedback welcome.