xRDP – Sound not always working on Ubuntu 19.10 – Quick Fix

Hello World, 

Recently, we have released the all new in one xrdp installer script (see at http://c-nergy.be/blog/?p=14029) and we have been working in fine tuning and customizing our new xrdp installation script.  While working on this version of the script, we have already identified some minor issues that have been explained in the following posts : 

These issues have been identified and the script already incorporate the fix.   However, we have noticed also during our tests with Ubuntu 19.10 and xRDP that the sound redirection is not working in a consistent way.  This post will explain what to do if you encounter the specific issue as described below… 

Let’s go ! 

Problem Description 

Let’s assume that you have used the latest version of the xrdp installation script (i.e. xrdp-installer-1.0.sh) on Ubuntu 19.10 and you have decided to enable sound redirection (whatever the installation mode you have selected).  You would have executed one of the following command in a terminal session (after making the script executable)

# Make the script executable  
chmod +x ~/Downloads/xrdp-installer-1.0.sh 

# Option 1 - Execute this to perform a standard installation with sound redirection
./xrdp-installer-1.0.sh -s   

# Option 2 - Execute this to perform a custom installation with sound redirection
./xrdp-installer-1.0.sh -c -s 

Note :  please read complete instructions on how to use the xrdp-installer-v1.0.sh script at http://c-nergy.be/blog/?p=14029

If everything is ok, you should be able to perform a remote connection to your Ubuntu and have access to the standard Ubuntu Desktop interface with the Dock bar on the left side.  If you are really lucky, you can check the sound card settings and you should see that the output device is showing something like the screenshot below (xrdp sink)

Click on picture for better resolution 

This is what you should see (screenshot above) in order to have sound redirection working as expected…. 

If you are not lucky, when checking your sound card settings within your remote session, you will not see any xrdp sink reference and the sound redirection is basically not working.  The funny thing is that you could start your xrdp session and have no sound. But then, after a variable amount of time,  xrdp sound redirection might start to work (with no user intervention) or will never show the xrdp sink reference in the sound settings.  If you see dummy output device in your sound settings page, sound redirection will not work !

Click on picture for better resolution 

The Quick Fix 

We found a quick fix for this issue.  In fact, we hope that some future Ubuntu updates might fix the issue.  In the mean time, if you want to use sound redirection in conjunction with xrdp, you will need to perform the following action.   

  • Perform your remote connection to Ubuntu using your favorite rdp client
  • When remotely connected, open a terminal console and issue the following command 
    • pulseaudio -k
  • Open then your system settings > Sound > and check that xrdp sink object is showing up 

The xrdp sound redirection will stay between login/logout but if the Ubuntu machine restart, you might need to re-issue this fix in order to have the sound redirection working again….

Demo

As a bonus, we have made a quick and dirty video to show you that this fix seems to work all the time 

 

Hope you enjoyed this post 

Till next time

See ya 

7 thoughts on “xRDP – Sound not always working on Ubuntu 19.10 – Quick Fix

  1. Thanks for the info. I find that even through this command can make xrdp audio sink to appear reliably, there can still be no sound on ubuntu 20.04. Not sure if you notice the same.

    Also, is there a way to automate this command on every xrdp connection?

    Thanks.

  2. @Jun Sun,

    It happens that indeed there is a long delay before the sound start to work but this should be working also in Ubuntu 20.04….. So far, we never encountered issues with sound not working…If time permit, we will check again
    To have the command executed on each xrdp connection, probably the easiest would be to use a login script (with maybe advanced detection logic to identify if this is a remote login or a console login )
    Hope this help
    Till next time

    See ya

  3. I’ve installed xrdp yesterday. I’ve compiled modules myself and installed. After that audio volume was disabled and youtube in the browser haven’t worked. Strangely if I run gvim and cause beeping (pressing up at the beginning of file) then I hear the sound.
    My case is CentOS 8. However your simple trick with pulseaudio -k works! Thank you very much.

  4. Many thanks for all the information. It worked on my Ubuntu 20.10 installation. It needs the pulseaudio -k fix every time. But within time i hope this will be fixed.
    Thumbs up!

  5. Hello Rob,
    Happy to see that this tip is indeed still working… we hope too that this annoyance will be fixed in some future release…we might try to fix this issue (more a workaround) with our xrdp-installer script in a future release
    Thanks for the visit and positive feedback

    Till next time
    See ya

  6. Hi,
    Great script! Any thoughts on solving audio stutter? I have tried all the recommended changes in daemon.conf and default.pa
    Thanks
    Tom

  7. @Tom,

    with sound redirection, you mileage will vary. We have achieved acceptable results on a LAN network and when the target machine is using a physical sound card.
    We have also been able to achieve acceptable results (but not always) when using Hyper-v VM generation 2. We would need to perform some additional tests to see if we can improve this but we are really lacking time lately

    Hope this help
    Till next time
    See ya

Leave a Reply