Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ubuntu 20.04 + 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 libsndfile-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
sudo apt source pulseaudio
# Compile
pulsever=$(pulseaudio --version | awk '{print $2}')
cd /tmp/pulseaudio-$pulsever
sudo ./configure --without-caps
# Create xrdp sound modules
sudo git clone
cd pulseaudio-module-xrdp
sudo ./bootstrap
sudo ./configure PULSE_DIR="/tmp/pulseaudio-$pulsever"
sudo make
#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
sudo service dbus restart
sudo service pulseaudio restart
sudo service xrdp restart

This comment has been minimized.

Copy link

@fluffy-critter fluffy-critter commented Dec 11, 2020

This was incredibly helpful! Thank you so much for writing it.

Some notes, based on my experience building this on xubuntu 20.04:

  • Most of these steps don't have to (and probably shouldn't) run under sudo
  • The sudo install -t step didn't seem to work; sudo make install from the plugin's root directory did, though.
  • No reason to put the module source directory underneath the pulseaudio source directory since the pulseaudio directory is being specified anyway (although there's no harm in it either)

Also at least on my machine the dbus and pulseaudio services weren't running as root, and restarting xrdp was all that was necessary to get audio working on future xrdp sessions (since dbus and pulseaudio are started by the user session).


This comment has been minimized.

Copy link

@CraigCottingham CraigCottingham commented Mar 4, 2021

I forked this gist to and updated it:

  • removed sudo everywhere it wasn't needed (if I missed any, please let me know)
  • built and tested on 20.10
  • built on a Raspberry Pi 4 (so ARM architecture)

This comment has been minimized.

Copy link

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

i followed all the steps

when type

sudo service pulseaudio restart

thats gave me this error

pulseaudio: unrecognized service

is there any problem ?

kindly guid me through to fix this issue


This comment has been minimized.

Copy link

@PhilGarrow PhilGarrow commented Apr 7, 2021

I am just learning about WSL and Ubuntu.
I have tried to follow the above instructions and I got as far as:
pulsever=$(pulseaudio --version | awk '{print $2}')
Where I get the get the error message:
-bash: /usr/bin/pulseaudio: No such file or directory
I am guessing that there is some common knowledge about Linux that I don't know.
Please edit the above instructions to include everything I need to do.
I don't understand what I am supposed to do regarding the comment:
Download pulseaudio source in /tmp directory - Do not forget to enable source repositories
Maybe this is causing the problem?
Thank you in advance for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment