Skip to content

Instantly share code, notes, and snippets.



Forked from rkttu/readme.txt
Last active Apr 3, 2021
What would you like to do?
Ubuntu 20.10 + WSL 2 + XRDP PulseAudio
# Credits
# First, you should install XRDP and X11 Desktop Environment first.
# Step 1 - Install Some PreReqs
sudo apt-get install git libpulse-dev autoconf m4 intltool build-essential dpkg-dev libtool libsndfile1-dev libspeexdsp-dev libudev-dev -y
# Enable source repo
sudo cp /etc/apt/sources.list /etc/apt/sources.list~
sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
sudo apt-get update
sudo apt build-dep pulseaudio -y
# Download pulseaudio source in /tmp directory - Do not forget to enable source repositories
cd /tmp
apt source pulseaudio
# Compile
pulsever=$(pulseaudio --version | awk '{print $2}')
cd /tmp/pulseaudio-$pulsever
./configure --without-caps
# Create xrdp sound modules
git clone
cd pulseaudio-module-xrdp
./configure PULSE_DIR="/tmp/pulseaudio-$pulsever"
#copy files to correct location (as defined in /etc/xrdp/pulse/
cd /tmp/pulseaudio-$pulsever/pulseaudio-module-xrdp/src/.libs
sudo install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so
# TODO: Register pulseaudio as a service
# Restart xrdp
## not allowed: "may be requested by dependency only (it is configured to refuse manual start/stop)."
# sudo service dbus restart
## only once pulseaudio has been registered as a service
sudo service pulseaudio restart
sudo service xrdp restart

This comment has been minimized.

Copy link

@rkttu rkttu commented Mar 7, 2021

Thanks for your work! Recently, I added some minor shortcut tricks to bring a more convenient way to run the PulseAudio. Instead of registering the PulseAudio, I created a shortcut for wsl.exe with the below arguments.

%WINDIR%\System32\wsl.exe -d Ubuntu-20.04 -- sudo service dbus start && sudo service xrdp start && pulseaudio & mstsc.exe /v:$(hostname -I)

Shortly, Microsoft will release their own Wayland implementation. But before that, I'm very excited that my script is helped your works. It's my pleasure. ;-)


This comment has been minimized.

Copy link

@Ashit-cloud Ashit-cloud commented Mar 29, 2021

There are few errors I am getting throughout the process, still WSL ubuntu audio not working ,
kindly help me out

1st error

ashit@LAPTOP-9PPP4D71:/tmp/pulseaudio-13.99.1$ ./configure --without-caps
./configure: line 2937: config.log: Permission denied
./configure: line 2947: config.log: Permission denied

2nd error

ashit@LAPTOP-9PPP4D71:/tmp/pulseaudio-13.99.1/pulseaudio-module-xrdp$ ./bootstrap
autoreconf: Entering directory `.'
autoreconf: not using Gettext
autoreconf: running: aclocal --force -I m4
autom4te: cannot open autom4te.cache/requests: Permission denied
aclocal: error: echo failed with exit status: 1
autoreconf: aclocal failed with exit status: 1


ashit@LAPTOP-9PPP4D71:/tmp/pulseaudio-13.99.1/pulseaudio-module-xrdp$ ./configure PULSE_DIR="/tmp/pulseaudio-$pulsever"
./configure: line 2219: config.log: Permission denied
./configure: line 2229: config.log: Permission denied


ashit@LAPTOP-96KP4D71:/tmp/pulseaudio-13.99.1/pulseaudio-module-xrdp$ make
make  all-recursive
make[1]: Entering directory '/tmp/pulseaudio-13.99.1/pulseaudio-module-xrdp'
Making all in src
make[2]: Entering directory '/tmp/pulseaudio-13.99.1/pulseaudio-module-xrdp/src'
  CC       module_xrdp_sink_la-module-xrdp-sink.lo
rm: cannot remove '.libs/module_xrdp_sink_la-module-xrdp-sink.o': Permission denied
rm: cannot remove 'module_xrdp_sink_la-module-xrdp-sink.lo': Permission denied
module-xrdp-sink.c:570:1: fatal error: opening dependency file .deps/module_xrdp_sink_la-module-xrdp-sink.Tpo: Permission denied
  570 | }
      | ^
compilation terminated.
make[2]: *** [Makefile:481: module_xrdp_sink_la-module-xrdp-sink.lo] Error 1
make[2]: Leaving directory '/tmp/pulseaudio-13.99.1/pulseaudio-module-xrdp/src'
make[1]: *** [Makefile:418: all-recursive] Error 1
make[1]: Leaving directory '/tmp/pulseaudio-13.99.1/pulseaudio-module-xrdp'
make: *** [Makefile:350: all] Error 2


ashit@LAPTOP-9PPP4D71:/tmp/pulseaudio-13.99.1/pulseaudio-module-xrdp/src/.libs$ sudo service pulseaudio restart
pulseaudio: unrecognized service

This comment has been minimized.

Copy link
Owner Author

@CraigCottingham CraigCottingham commented Mar 29, 2021

The first error says that you don't have write permission in the directory where you're running configure. I don't know if that's normal for whatever operating system you're running, and determining that and fixing it is out of scope for this gist.

The cleanest and safest way I can think of to make these instructions work for you is to

  1. create a directory in your home directory like mkdir -p ~/pulseaudio, then
  2. start following the instructions above from line 22, replacing /tmp with ~/pulseaudio everywhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment