Hello World,
Still at an early stage and still need to be confirmed and approved (by xRDP maintainers), we are happy to let you know that there is a way to make xrdp sound redirection working when using Pipewire sound server. This solution has been worked out and shared by Hiero (one of our most active reader).
Until today, xRDP sound redirection is only supported when Pulseaudio Sound server is used. However, more and more Linux operating systems (like Ubuntu 22.10 or Fedora) are slowly moving away from Pulseaudio and prefer to use the new kid in town ie Pipewire.
Hiero has been working on this specific topic and came up with different ways to allow xrdp sound redirection when Pipewire is installed by default. Hiero has published and shared all its findings with the xRDP team. You can find out all the explanation and code by visiting this link.
The proposed solution is still under investigation by th xRDP Team but we thought that it would be nice to already have a look at the solution, test it and share our findings….
So, let’s do this ….
Overview
As explained earlier, xRDP sound redirection capability is only available on systems running Pulseaudio Sound server. This is because the way the sound redirection module is compiled expect Pulseaudio as a sound server. The solution is working quite ok when your system ships with Pulseaudio Server. Now that Ubuntu 22.10 (and other recent linux distributions) ship with Pipewire by default, the existing xrdp sound redirection method is not working.
To overcome this situation, multiple solutions can be developed to re-introduce xRDP sound redirection when using Pipewire. After reviewing the discussions and proposed solution described in this link,it seems to us that the most logical choice would be to indeed rewrite a module that would work with Pipewire. This is exactly what Hiero did. He wrote a small module that would make xrdp sound redirection working when using Pipewire.
In this post, we will explain how to compile this new module and test sound redirection against Pipewire
Disclaimer
Prerequisites and assumptions
Since this module is still quite new, we have performed the compilation in our lab environment. In order for you to get similar result, we assume the following
- We assume that your machine is connected to internet while performing the installation. This is needed as additional packages and software needs to be downloaded and installed on your Ubuntu machine
- This post applies only for Ubuntu 22.10 Release
- You have already xRDP Software installed on your machine
- We are using a Virtual machine to perform our test. The VM is running on top of Hyper-V server
- All the files will be Downloaded in the ~/Downloads Folder
Step 1 – Download the source files
For your convenience, we have uploaded the necessary files in our web server. However, we want to stress out that these files have been developped and provided by Hiero. All the credits goes to him ! You can download them via the Terminal console by issuing the following commands
cd ~/Downloads wget https://www.c-nergy.be/downloads/xRDP/module-xrdp-pipewire.zip
Click on Picture for better Resolution
Credits : This module has been provided by Hiero
Step 2 – unzip the file
After downloading the zip package containing the file, you will need to unzip it first. To unzip the package, you can use the Terminal console and issue the following command
unzip module-xrdp-pipewire.zip cd module-xrdp-pipewire
Click on Picture for better Resolution
Step 3 – Compile the new xrdp-pipewire module
It’s time for us to perform the compilation of this module. Based on the instruction provided by Hiero, the following commands needs to be issued in the Terminal console
Install additional packages
You first need to ensure that the following packages are available and have been installed on your system. To install them, you can issue the following command
sudo apt install build-essential pkg-config libspa-0.2-dev libpipewire-0.3-dev pulseaudio-utils
You might get prompted for your password. Provide it and wait for completion. This process can take some time
Click on Picture for better Resolution
Compiling the module
In this stage, we will create the module for pipewire and xrdp support. To create this module, we will need to compile the necessary source files provided with the download. To compile your code, simply issue the following command in a Terminal Console
cc -o libpipewire-module-xrdp-pipewire.so module-xrdp-pipewire.c -shared -fPIC $(pkg-config --cflags libpipewire-0.3)
Click on Picture for better Resolution
System Configuration
When the module has been generated, it’s time to configure the system so it can make use of it. The following commands needs to be executed in order to copy the files into the correct location and grant them the necessary permissions to make them working.
sudo cp libpipewire-module-xrdp-pipewire.so $(pkg-config --variable=moduledir libpipewire-0.3)/. sudo chmod 644 $(pkg-config --variable=moduledir libpipewire-0.3)/libpipewire-module-xrdp-pipewire.so sudo mkdir -p /usr/local/libexec/pipewire-module-xrdp sudo cp load_pw_modules.sh /usr/local/libexec/pipewire-module-xrdp/. sudo chmod 755 /usr/local/libexec/pipewire-module-xrdp/load_pw_modules.sh sudo cp pipewire-xrdp.desktop /etc/xdg/autostart/. sudo chmod 644 /etc/xdg/autostart/pipewire-xrdp.desktop
Click on Picture for better Resolution
Post-Configuration
Based on the pipewire version your system is running, you might need to perform a final post-configuration action. If your Pipewire version is 0.3.5.8 (the one present in Ubuntu 22.10), you will need to execute the following command in your Terminal console
cc -o pw-cli_0358_mod pw-cli_0358_mod.c $(pkg-config --cflags --libs libpipewire-0.3) sudo cp pw-cli_0358_mod /usr/local/libexec/pipewire-module-xrdp/. sudo chmod 755 /usr/local/libexec/pipewire-module-xrdp/pw-cli_0358_mod
Click on Picture for better Resolution
Note :
To check your pipewire version, simply issue the following command
pipewire --version
Step 4 – Test your configuration
It’s time to test your configuration. You first need to ensure that nobody is logged on locally on the Ubuntu machine. Then, you can perform your remote desktop connection against your Ubuntu machine. You will see the xRDP login screen. Provide your credentials and you should see your Ubuntu Desktop. To check if sound redirection is enabled, you will open the Settings App and go to sound Node. If you see xrdp-sink and xrdp-source, this means that sound redirection has been successfully configured against your system
Click on Picture for better Resolution
The ultimate test is to test the sound by using the built-in tools or better by browsing the internet and play a video or a music and play it on your remote session. If everything works as expected, you will get sound redirection working. In our test, we have to say that the in the beginning the sound is a little bit choppy but then sound quality is quite good (over LAN). No delays and no chopping sound… Really impressive for an early stage development solution.
Final Notes
Voila ! This is it for this post.
We are really impressed by the work provided by Hiero. He has deliver a possible solution to the xRDP sound redirection limitation encountered when using pipewire as Sound Server. There are multiple other options that has been mentioned. However, we think that the module approach is the best so far. The expected results are there and the compilation process is really quite straight forward.
As we are short in time (for blogging) at the moment, we will try to integrate this piece of code in our xrdp-installer script and publish it as a preview version. People can then perform more tests against more Linux Distributions and feedback can be provided to the xrdp maintainers.
Special Thanks to Hiero who shared this information with us and for the great work, help and constructive comments he is providing.
Till next time
See ya
$ cc -o libpipewire-module-xrdp-pipewire.so module-xrdp-pipewire.c -shared -fPIC $(pkg-config –cflags libpipewire-0.3)
module-xrdp-pipewire.c:47:10: fatal error: spa/utils/dll.h: No such file or directory
47 | #include
| ^~~~~~~~~~~~~~~~~
compilation terminated.
So there’s a missing dependency in your instructions.
(Trying to get sound on latest Mint 21.1 Cinnamon, running in Hyper-V, but still no sound device detected, still missing the audio redirection for xRDP)
For infor about the failed compilation (missing “spa/utils/dll.h”). Here are version displayed by apt:
$ sudo apt install build-essential pkg-config libspa-0.2-dev libpipewire-0.3-dev pulseaudio-utils
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
build-essential is already the newest version (12.9ubuntu3).
pkg-config is already the newest version (0.29.2-1ubuntu3).
libpipewire-0.3-dev is already the newest version (0.3.48-1ubuntu3).
libspa-0.2-dev is already the newest version (0.3.48-1ubuntu3).
pulseaudio-utils is already the newest version (1:15.99.1+dfsg1-1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
@Philippe,
Thank you for visiting our blog and providing feedback.
Ok, this is a strange one… we see that you have the lisbpa-0.2-dev installed on your system which should provide you the necessary dependencies
However, we are noticing that the libspa-0.2-dev package shows version 0.3.48-xxxx..
In our Ubuntu 22.10 system, we see that the package version is set to 0.3.58-xxxxx
In our Ubuntu 22.10 system, we see that the pulseaudio-utils package is set to 1:16.1+dsg-xxxx
Are you running these commands against Ubuntu 22.10 + PipeWire Sound Server available ?
It looks like you are running these commands against an UBuntu 22.04
Can you check on your system that you have the following file/folder. Check /usr/include/spa-0.2/spa/utils ?
The module/commands have been tested only on Ubuntu 22.10 + latest updates
Waiting for your feedback
Till next time
See ya
Hello,
It looks pipewire version is 0.3.48.
module-xrdp-pipewire.c requires pipewire version 0,3,56 or after.
To confirm pipewire version, run pipewire –version.
@Hiero,
Thank you for the feedback.. Yes, we have guessed that a specific pipewire version would be needed to have the module working as expected. So far, as mentioned in the title of the post, we are mainly focusing on Ubuntu 22.10 where the correct Pipewire version is indeed available… As soon as we have a little bit more time, we will provide more information and perform extensive testing
Till next time
See ya
Sorry , I did not write about pipewire version.
I confirmed module-xrdp-pipewire.c works on 0.3.56 and after all the versions to latest 0.3.65.
By the way, pipewire and pulseaudio are installed as default on Linux MINT 21.
However, pipewire is installed for video caputring. Audio is still supported by pulseaudio.
It is the same as Ubuntu 22.04.
Hello Hiero,
Ok, no worries… we understand your statement… We were just mentioning that at this stage, your module has only been tested against Ubuntu 22.10 where Pipewire is the default Sound server. We know that in Ubuntu 22.04 there is a mix between PulseAudio and Pipewire software packages and for xRDP we are only using PulseAudio approach….
Till next time
See ya
worked on ubuntu 22.10 using msrd client on macOS 13.2. thanks!
@Jeff,
Thank you for visiting our blog and sharing your findings… We are happy to see that you have found out what was the problem. Indeed, as far as we know, there should not be a problem to install xrdp and ssh side by side. We have tested multiple times and we have always able to perform xrdp and or ssh connections. We are happy to see that the problem was more related to MacOS configuration. Thank you for sharing your findings since this will definitely help other users out there..
For the sound redirection on Ubuntu 22.10, you can have a look at this post (http://c-nergy.be/blog/?p=18772) but note this is really an early development option and might need to be tweaked in the future…
Till next time
See ya
been looking for a solution to this for the past few weeks… took some time to determine the specific issue was that sound redirection and pipewire weren’t getting along. Installing this module and rebooting worked like a charm.
@Matthew,
Thank you for visiting our blog and providing feedback. happy to see that the proposed solution works as expected (so far)
Till next time
See ya
Worked on Xubuntu 23.04! Thanks!
@Vinicius,
Thank you for the feedback and visiting our blog ! Happy to see that this tip is still working on the latest version of Ubuntu flavors
Till next time
See ya
Work on Debian 12, thanks !
@gt,
Thank you for visiting our blog and providing feedback… Nice ! so this seems to work as well on Debian which ships with Pipewire as well now…. Still waiting for xrdp team to integrate this code to their solution
Till next time
See ya
@Griffon,
I would like to report that after the installation of xrdp sink from above and when I connect to xRDP session, I notice that there will be following message appear when I start terminal:
server does not have extension for dpms option
xset: unknown option 0
It seems the system is functioning normally, and the sound redirection is also working. I am using Debian 12.
@gt,
Thank you for visiting our blog and providing feedback. We are happy to hear that the sound redirection with Pipewire is working… We will publish a new post soon that will tackle the sound redirection in a slightly different way.
Stay Tuned
Till next time
See ya
when I issues command: cc -o libpipewire-module-xrdp-pipewire.so module-xrdp-pipewire.c -shared -fPIC $(pkg-config –cflags libpipewire-0.3)
get the error
No such file or directory
43 | #include
@R,
Thank you for visiting our blog and providing some feedback. We have been working on some new instructions about Pipewire sound and xRDP. The post is almost ready and should be made available soon. If possible, try the new instructions and provide feedback. The post should be available in the next 2 weeks
In the mean time, we will try to check the problem with this post… we have noticed that indeed some time some errors are thrown….
Till next time
See ya
Thanks, I wasted all day yesterday trying before I found these instructions.
Can confirm it works on Debian 12 Stable with Gnome desktop (libpipewire 0.3.65)
@Lux,
Thanks for visiting our blog and providing your feedback. This post was looking into the possibility to have sound redirection working with Pipewire and xRDP… This post is providing really early stage instructions…
Please that in a few weeks, new instructions will be provided…and possibly we will integrate the code into our xrdp-installer script
Till next time
See ya