xRDP – How to redirect Sound on Ubuntu 18.04

Hello world,

Here we are again with a new post about xRDP running on top of Ubuntu 18.04.  Today, the post will try to explain how to configure sound redirection within your xRDP session.  This topic is not new and yes sound redirection is supported with the latest build of xRDP.  The process has been explained and described in the xRDP wiki .  Moreover, searching for the most appropriate information, we also found out that Ubuntu 18.04 ship with a script that suppose to perform all the necessary actions needed to integrate sound redirection in xRDP session. 

Based on these information, we have decided to perform the installation and configuration needed to have sound redirection working. This post will describe our journey and findings in order to get the sound redirection working….. 

Let’s have a look…! 

Assumptions & Pre-reqs


This post will demonstrate how to configure an Ubuntu 18.04 system to use sound redirection when using xRDP remote desktop software solution. Personally, we do not use this feature but because we have receive the request we have decided to take  a look into the installation process and share our findings in this post. Actually, with Ubuntu 18.04, the process should be as simple as executing two commands 

apt install xrdp-pulseaudio-installer

As you will see, we have encountered a small issue with this approach…but nothing that can be fixed….. 


This procedure has bee performed using a specific environment.  The following conditions were met when we have performed the installation and configuration activities

  • We have tested the script on Ubuntu 18.04 with the latest patches (at moment of writing)
  • No additional desktop interface has been installed. 
  • We have performed the test on a Virtual Machine running on Virtual box (where sound capabilities were present inside the virtual machine)
  • xRDP software has been already installed on the system (at least version 0.9.5)


We assume that you have internet connection on the Ubuntu machine.  The internet connection is needed to download the necessary packages that will be installed on your system.

Configuring Sound Redirection Overview

The first installation attempt 

The first things that we have done was to check if the Ubuntu 18.04 system was running the pulseaudio software.  To perform this check, simply type in a Terminal console the following command 

pulseaudio --version

The output should look like the screenshot below.  This means that you have the pulseaudio components installed on your system. 


Click on Picture for Better Resolution

The next step in the installation consist of installing the new xrdp-pulseaudio-installer package from the Ubuntu Repository.  To perform this action, simply issue the following command 

sudo apt-get install xrdp-pulseaudio-installer  -y


Click on Picture for Better Resolution

You might be prompted for a password.  Provide it and proceed to the next step… 

The final step should consist of executing the following script that will basically download the pulseaudio source and compile them in order to generate two files that will be used by xRDP to redirect the sound 

sudo xrdp-build-pulse-modules


Click on Picture for Better Resolution

However; it seems that there is an error in the script as the following message shows up after the script has run : cd cannot open pulseaudio directory (This seems to be a know bug see here)


Click on Picture for Better Resolution

The script is not able to open the pulseaudio directory because the dget command seems to have an issue (see screenshot)


Click on Picture for Better Resolution

So, at this stage, we have not successfully performed our sound redirection configuration…

Our procedure for Sound Redirection 

Because we do not want to change/modify/interfere with the debugging process, instead of updating the xrdp-build-pulse-modules script, we have decided to first perform a manual installation on a Ubuntu 18.04 system.  Later on, we will probably either create a dedicated script that would perform the installation correctly or we would include this process in our famous Std-Install-Xrdp-v0.x.sh script.

Enable Source code repository 

So, the first thing to do in order to have successful installation  would be to enable the source repository.  To enable this via the GUI, search for the Update & Sources applet and click on it 


Click on Picture for Better Resolution

in the Update and Source dialog Box, tick the checkbox next to the Source code


Click on Picture for Better Resolution

You might get prompted for a password.  Provide it and proceed. You should see something like the screenshot below


Click on Picture for Better Resolution

Press on Close button. You will then be see a popup where you have to click on the reload button in order to have the changes updated on your system 


Click on Picture for Better Resolution

Wait for the system to update the source repositories….


Click on Picture for Better Resolution

At this stage we are ready to move forward….. 

Download Pulseaudio source and compile it 

In this step, we will need to download the pulseaudio binaries and compile them.  No installation is needed here.  The compilation will provide the necessary libraries needed by the xRDP sound redirection compilation process.   So, to download the pulseaudio sources, we will issue the following commands 

cd /tmp
sudo apt source pulseaudio 

This will download the pulseaudio package in the /tmp folder.  So, to compile it, we have to go to the /tmp/pulseaudio* directory and execute the following command 

cd /tmp/pulseaudio*
sudo ./configure

Building the Pulseaudio Module

Since we have the necessary pulseaudio source in tmp directory, it’s time to compile them so they can be used by the xRDP software.  To compile them, we will issue the following commands 

cd /usr/src/xrdp-pulseaudio-installer
make PULSE_DIR="/tmp/pulseaudio-11.1"

This will because create two additional module-xrdp*.so files. These files needs to be copied into the correct location so xRDP can perform sound redirection  

Installing the Pulseaudio Module

This is an important one.  As you know, we are focusing on Ubuntu and we have seen a lot of blogs mentioning that the two module files generated above needs to be copied in the following location /usr/lib/pulse-11.1/modules.    This is wrong !!  

These files needs to be copied in the following location  /var/lib/xrdp-pulseaudio-installer.  So, we will run the following command to copy the correct files into the correct location….

install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so

Testing  the Pulseaudio Module feature 

If you perform a remote desktop connection to your Ubuntu, go to the Settings Applet and select sound.  As shown in the picture, you should see a beautiful xrdp sink object under sound card.  If you have that, you almost sure that the sound redirection will work on your system.   


Click on Picture for Better Resolution

To test that, you need to ensure that the remote desktop client has been configured accordingly.  If you are using the microsoft mstsc.exe client, ensure that sound redirection is enabled.   To ensure that sound redirection is enabled, click on the show options


Click on Picture for Better Resolution

This will open the detailed view of the mstsc.exe client and you can set more options there….. 


Click on Picture for Better Resolution

In the advanced view, click on the local resources. In the remote Audio section, click on settings button 


Click on Picture for Better Resolution

Ensure that the first option is selected 


Click on Picture for Better Resolution

When remote desktop connection is established, within your xrdp session, try to launch a music application or browse the internet to find some files with sound in it.  If everything is ok, you should get the sound redirected to your computer and enjoy a little bit more the xRDP features….

Final Notes

Voila ! This is it for this post.  Normally, the installation and compilation process to enable sound redirection should be quite straight forward.  However, it’s seems that there is a small bug in the build pulse audio script.  We have decided not to change the existing script and we have moved forward performing a manual installation.  The next step for us would be to integrate this process and information into the Std-Install-xRDP script.  Because this  feature is not really used by a lot of people (at least around me), the sound redirection configuration will be an option in the script.  So, we will re-work the script to add an additional switch to allow the sound redirection configuration 

This is it for today

Till next time 

See ya


5 thoughts on “xRDP – How to redirect Sound on Ubuntu 18.04

  1. Thanks, worked with some minor modifications. I now have audio redirection from Ubuntu 18.04 to Windows 10 🙂

    cd /tmp
    sudo apt source pulseaudio
    cd pulseaudio*/
    sudo ./configure
    cd /usr/src/xrdp-pulseaudio-installer
    sudo make PULSE_DIR=”/tmp/pulseaudio-11.1″
    sudo install -t “/var/lib/xrdp-pulseaudio-installer” -D -m 644 *.so

  2. @Francois,

    thank for the visit and the feedback…We are pleased to see that our work can be useful and used by anyone…
    Till next time
    See ya

Leave a Reply