xRDP – Easy install xRDP on Ubuntu 20.04,22.04,23.XX,24.04 (Script Version 1.5 – Pre Release)

Hello World, 

As you probably know by now, Ubuntu 24.04 Long Term Support (LTS) has been released in April 25, 2024.   Canonical has introduced a number of changes that make this release appealing. The new release looks modern and responsive.  The new and updated Ubuntu installer is really nice and looks modern.  The general look and feel seems the same but this release seems really smooth and user experience is good.   The other major feature (we are interested in) is the gnome remote login feature (see Testing Gnome 46 Remote Login Feature) which provide kind of the same functionality as xRDP but out of the box ! 

However, we are still releasing our xrdp-installer script even if another solution exists nowadays.  The script can be used by people preferring or used to work with xRDP software and for other distributions not based on Gnome Desktop.  

Today, we are releasing the version 1.5 of the xrdp-installer script which support Ubuntu 24.04 Distribution. 

So, let’s see what’s new in this release… πŸ™‚ 

Overview

By now, you should know that the xrdp-installer script aim to ease installation and post-configuration actions of xRDP on top of Ubuntu Operating system.  xRDP is a piece of software that enable remote desktop services on Linux.   This means that windows users can use their Remote desktop client (mstsc) and perform a remote connection to Ubuntu Computer.   

Initially, the script was supporting only Ubuntu with Gnome Desktop interface. However,  recent version of script tries to detect the Desktop interface in use and try to perform the post-configuration actions as required.  Recent version of the script also can run against Debian Operating system as well.  Please note that supporting other Flavors is based on a Best effort approach.

What’s new in this release (Version 1.5) ?

Adding Support for Ubuntu 24.04

Since Ubuntu 24.04 has been released, it was time to update the script and include support for Ubuntu 24.04.  This release should be seen again as an important maintenance release of the script.  We have not much time lately to introduce new features but we are trying to provide a useable script which support latest Ubuntu distribution releases. 

So, yes, version 1.5 of the script can run against Ubuntu 24.04 !

Correct detection of xrdp/xorgxrdp packages when -d (or -dev) option selected

We have introduced in the previous script version, the option to download and test the latest dev branch for xrdp and xorgxrdp.  This option has been introduced mainly for early adopter and we do not know how many people are using this option.    However,  one of our readers (Hiero πŸ™‚ ) has noticed that the code was not returning the expected values.  Based on Hiero’s feedback, we have updated the script and now, the code will find the correct version and will perform the installation accordingly 

Fixing checkinstall usage 

We have noticed that when using the script in custom mode, compilation was failing on Ubuntu 24.04 (beta).  After some investigation, we have found out that the issue was related to the checkinstall utility. 
 
When using the custom installation mode,  the script will use the checkinstall utility to compile and build deb packages for xrdp and xorgxrdp software.  In previous versions, the script was running fine without the parameters -fstrans.   It seems that a change has been introduced in Ubuntu (and Debian) where this switch is now required.  The code has been updated accordingly and now compilation is working as expected.

Adding flatpak support for Polkit exceptions

In the previous version of the script, we introduced this exceptions rules for flatpak but we have noticed some errors and issues.  If you have flatpak installed on your system and you run the script, exceptions rules will be created accordingly.  However, if you install flatpak after running the xrdp script, there will be no exception rules created.   To overcome this situation, we have decided to create the exceptions rules independently of flatpak is installed or not on your system.  If you have it, rules will apply immediately.  If you install flatpak afterwards, since the exceptions rules are there, there will be no need to re-run the script and no popup should be appearing.  

Incompatible version xorgxrdp & xRDP 

The team behind the xRDP software has introduced a number of important changes that affect the way the script behaves.  Recently, the team has released the version 0.10 of xorgxrdp package (as a latest release).  However, the team is still providing as latest release of xrdp version 0.9.25.  If you use the script with custom installation mode, the compilation process will fail because these packages are not compatible with each others.    

We have modified the code in order to provide a quick workaround.  The script will try to download a higher version of the xrdp package which are marked as pre-releases.  As soon as the xrdp reaches final release, the script will detect it and use the correct production ready package. 

startwm.sh & .xsessionrc usage changes

xRDP 0.10 has introduced some major changes in their software.  There is an improved version of startwm.sh file which makes the usage of the .xsessionrc file useless.  There is no need to export variable used to detect Desktop interface and there is no need to use the legacy approach based on the .xsesionrc file.  To keep the same look’n and feel, the script will now create a file called 90-xrdp-default-desktop.sh located in le located in /etc/profile.d/

Credits : Hiero has provided us the information and has also provided a piece of code that has been used in the script. 

Detect pkaction version 

The previous version of the script has introduced this detected.  This version of the script has slightly changed the logic.   It seems that when recent version of pkaction is available, we need less exceptions rules files to be created.  When an older version of pkaction is used, exceptions rules with .pkla extensions will be created accordingly.  The only exception files that will be created by default will be the one related to the flatpak technology. 

Other Bug Fixing & Updates

Based on some feedback from our users (Thank you Hiero), we have reviewed the code and integrated either the suggested changes or correctly some errors that were detected. 

  • A new package for xrdp-pipewire module is available.  The script will now try to use the package from Ubuntu repo.  If not found, the script will built the sound redirection module from sources. Again, this information was provided by Hiero who spotted the presence of the package in the Ubuntu repository.  
  • Better detection for Sound server when using non-english version
  • Fixing, debugging an code cleanup  
  • removing the XDG_DATA_DIRS variable from the script.  This is not needed anymore
  • xRDP Credentials page will get unique background color now (grey)
  • In the previous version of the script, we have added support for LMDE.  We have noticed that code to add sources repository was not present.  This release add this code and now sources repositories needed to compile sound redirection are available

Credits & Contributions 

For this release,  there was a massive contribution from Hiero.   He has provided really good feedback but also piece of code to be integrated in the script.   It’s important for us to mention this.  We are mentioning Hiero’s contribution in this blog but if you look inside the code of the script, all credits for the code sections provided or updated should be clearly mentioned and identified. 
 
Thank you Hiero  πŸ™‚

How to Use the Script

The xrdp-installer-1.5 script will work in a similar way as the previous versions. The following section will explain how to download, extract, set executable mode and perform the installation using the script.  The script provides some switches that can be used to customize the installation process.  

So, let’s see how this would be working…. 

Disclaimer

The script is provided AS IS.  Use it at your own risk !!! 

Prerequisites and assumptions  

The following conditions should be met in order to have the best results while using the script

  • 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

Script version & Supported Ubuntu Version

The xrdp-installer-1.5.sh script will support the following Ubuntu operating system version assuming that Gnome Desktop is the default Desktop interface

  • Ubuntu 20.04.x
  • Ubuntu 22.04.x
  • Ubuntu 23.10.x
  • Ubuntu 24.04.x
  • Debian 10 
  • Debian 11 (only if you select custom mode installation !!!) 
  • Debian 12 

The xrdp-installer-1.5.sh script can be run against the following Ubuntu flavors but we cannot guarantee that everything will work as expected (best effort)

  • Kubuntu (20.04 and later)
  • Ubuntu Budgie (20.04 and later)
  • Ubuntu Mate (20.04 and later)
  • Xubuntu (20.04 and later)
  • Lubuntu (20.04 and later)  
  • Linux Mint (Experimental at this stage)
  • LMDE (Experimental at this stage) 
  • Pop!_OS  22.04 

Note :  If you are running any of these distributions and you want to help us improving the support on those, please download and test the script.  Do no hesitate to share your findings so we can try to incorporate them in the next release 

Step 1 – Download the script

To download the script, you have multiple options.   You can from a Terminal issue the following command 

wget https://www.c-nergy.be/downloads/xRDP/xrdp-installer-1.5.zip

You can also simply use your browser and click on the link to download the script :  

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 xrdp-installer-1.5.zip 

You can also use the GUI and the Nautilus file manager to select the downloaded package, right-click on it and select the option Extract Here

Step 2 – Set Execute Right on the script

Download the xrdp-installer-1.5.sh script to your system, extract content and mark it as executable . To do this, perform the following action in a terminal console

chmod +x  ~/Downloads/xrdp-installer-1.5.sh

Note : Adjust the path where the xrdp-Installer-1.5.sh script to reflect your environment

Step 2 – Run as normal user 

The script needs to be run as a normal user.  The script will start running and will prompt you for password when sudo actions are initiated.  If you run the script as root or using sudo command, the Download folder does not exist for the root user and the script fails to run as expected.   To overcome this situation, the script also check which user is executing the script. If the script is run under sudo or root accounts, a warning message will be displayed and the script will not execute

Step 3 – Switches and parameters 

The xrdp-installer-1.5.sh script can be executed as is (with no parameters or switches). This will perform a standard (and basic) installation of xRDP.  No sound or custom xrdp login script will be made available.  However, remote desktop, drive redirection and clipboard redirection would be available with this installation mode.  

The xrdp-installer-1.5.sh script accept also some additional parameters that will help customize the xrdp installation and enable additional features.  The script provides the following parameters 

--help or -h          => will display a basic help menu
--sound or -s         => will enable sound redirection 
--loginscreen or -l   => will customize the xRDP login screen 
--remove or -r        => will remove the xrdp package 
--custom or -c        => will perform a custom installation (i.e. compiled from sources)
--dev or -d           => will perform a custom installation using dev branch (unstable version)

Step 4 – Perform xRDP installation using the script 

The following sections will provide some examples and scenario on how you can use the script….. 

Standard Installation – No Parameter

As mentioned above, you can decide to use the default xrdp package available in the Ubuntu repository and perform a basic installation which will provide you remote desktop capability and will also customize the remote sesssion.  The script will ensure that the same look n’ feel will be maintained when the user logs on locally or remotely. 

To perform a standard installation, you execute the script with no parameters.  Open a Terminal console, browse to the location where the script has been downloaded and issue the following command 

 ./xrdp-installer-1.5.sh

When the xrdp installation package will start, you be requested to enter your password. Provide the password and proceed with the installation. Wait for completion of the script.  The machine will not reboot automatically when done so you can review the actions performed by the script….

Standard Installation with Parameters

The script can be used to perform a standard installation and still passes some parameters to get the most of the xRDP packages and their features.  For all the Ubuntu versions, we could use the following combination of parameters 

./xrdp-installer-1.5.sh -s      (this would enable the sound redirection) 
./xrdp-installer-1.5.sh -l      (this would customize the xrdp login screen -see here)

Obviously, you can combine the switches (any order) to have more features enabled  

./xrdp-installer-1.5.sh -s -l      (this would enable the sound redirection and customize the xrdp login screen)

Important Notes

The script can be run multiple times on the same machine.  If you have run initially the script with no parameters but you decide afterward to enable additional features, the script can be re-executed and the additional features will be enabled.  

Custom Installation – Default Installation 

Custom installation script is really flexible. Custom installation means that the script will compile the xrdp package from the source binaries. The custom installation script always uses the latest xrdp package version available 

To perform a custom installation, you will need at minimum to pass one parameter.  The following command line shows you how to perform a custom installation  

./xrdp-installer-1.5.sh -c     (this would perform a custom installation but will not enabled adv features like sound redirection or custom login screen)

Custom Installation – Additional Options  

If a user wants to enable additional features, you will pass some additional parameters as shown in the following examples 

./xrdp-installer-1.5sh -c -s     (this would perform a custom install and enable sound redirection)
./xrdp-installer-1.5.sh -c -l     (this would perform a custom install and customize xrdp login screen)
./xrdp-installer-1.5.sh -c -l -s  (this would perform a custom install, enable sound and customize login screen)

Important Notes

The script can be run multiple times on the same machine.  If you have run initially the script with no parameters but you decide afterward to enable additional features, the script can be re-executed and the additional features will be enabled.  

Remove Installation option

This version of the script also ship with the option to remove xRDP package.  The removal option should be only used  if you have uses this version of this script to perform the installation.  To remove the xrdp package, you would simply execute the following command  

./xrdp-installer-1.5.sh -r     (to remove the xrdp packages)

Step 5 – Test your configuration 

After the script has run and after the reboot/shutdown and start process, it’s time to test and see if you can indeed perform a smooth remote connection to your Ubuntu machine.  Start your favorite rdp client and simply enter your credentials and start testing your installation.  If everything is ok, you will see a similar Desktop interface where Gnome Desktop is used and the Dock is visible. 

Limitations

Switch between standard and Custom install

This version of the script can be run multiple times on the same machine.  However, because of this new behavior, you cannot perform a standard installation and then decide to perform the custom installation.  Once you have selected your installation mode, you will have to stick to it.  This is kind of checked by the script.  

So, if you have performed a standard installation but afterwards you might want to use the custom installation option, the script will ignore the request.  If you want to move from standard install mode to custom mode (or vice versa), the correct process is 

  • remove xrdp (using the xrdp-installer-1.5.sh -r option) 
  • Reboot
  • perform a new installation using your selected installation mode (standard or custom install mode) 
  • Reboot

Known issues, Fixed Issues and limitations, New Behavior 

Known Issues 

Black Screen or disconnected immediately after connecting

As mentioned and explained multiple times,  this situation will happen (or can happen) when the same user account is used concurrently locally and remotely.  In other words,  the problem is related to the fact that the same user account is already logged in locally and a remote connection is attempted at the same time.  With xRDP software solution, a specific user account can be logged on either locally or remotely but not both….  

Ubuntu 24.04 seems to have introduced a small change when such situation would happen.  If the user is remotely logged on via xRDP software and if the same user tries to login locally, he will be presented with the following popup (see screenshot) 

Click on Picture for better Resolution

The only problem is that if you click Force Stop button, it seems not to work.  The remote session is not killed.  We have not tried this on older Ubuntu releases but I think this is because of the gnome-remote-login addition in Gnome 46.  

If a user is logged on locally and if the same user tries to perform a remote connection to the machine, the user will get informed about an existing session already running as shown in the screenshot below

Click on Picture for better Resolution

Again, here there is no way to stop the existing session.  You will need to logout locally from the session or you will need to find other ways (such as ssh or another user account) that can be used to disconnect the existing session.

Custom xRDP Login page

The script offers the option to customize the look’n feel of the xrdp login page.  However, since the xrdp files controlling visual aspects have been updated, you might slight different colors issues when using the script.   This is really a minor issue and we will tackle this on the next release.  You will notice this custom login page only if you use the -l switch when running the script. 

Gnome-remote Login

In ubuntu 24.04, gnome remote login feature has been introduced which allows you to perform also remote desktop connection to your Ubuntu.  If this feature is enabled, it will be using port 3389 by default.   Since xRDP is also using port 3389 by default, there might be conflicts between these two software.  The script is not checking for gnome remote login presence (yet ?) and you will need to ensure that only one solution will be used or you will need to use different ports for one of the software.  

Installation over SSH will not work as expected 

In the past, it was possible to perform the installation of xrdp through ssh connection using previous versions of the script.  Previous version of the script would try to detect the desktop interface in use and perform the post configuration changes needed.  This ssh installation is best effort and it might not work as expected.  The version 1.5 of the script will run through the ssh connection but it will not configured the desktop interface to be used.  There is a minor change that need to be added in the code.  This will be done in the next release that will be available soon. 

Update : April 29,2024 – The script has been updated and this issue has been fixed

Final Notes

This is it for this post !   

The script version has not been tested extensively but it should work in most cases.  The script should be seen as a important maintenance release in order to maintain usability.  Please if you have time or want to help us in creating the best xRDP installer script, download the script, test it and provide constructive feedback.  If you find a bug or an issue with the script, let us know as well so we can try to fix it.   

Till next time 

See ya  

11 thoughts on “xRDP – Easy install xRDP on Ubuntu 20.04,22.04,23.XX,24.04 (Script Version 1.5 – Pre Release)

  1. Hello
    This Script is Working fine with RDP Sound Redirection

    Thanks. Thanks a lot to TEAM.

  2. Can you support Zorin OS, which is based on Ubuntu 22.04?
    Currently the script aborts as it detects an unsupported Linux version, while I think it should be able to install xrdp just fine…
    Or perhaps provide a switch to skip the OS check?
    Thanks,
    Lieven

  3. @Vinod,
    Thank you for visiting our blog and providing feedback. We need your feedback to ensure that the script is working as expected… Thank you very much for the positive feedback

    Till next time
    See ya

  4. @Lieven,

    Thank you for providing some feedback and visiting our blog. We will try to add support for Zorin OS in the next update of the script or indeed adding a switch to bypass the check_os. We will see what makes more sense for us.
    If you really want to give it try right now, you can edit the script and go to line 1372 (or around this line) and comment the code for the check_os

    So change from


    #---------------------------------------------------#
    #-- Step 1 - Try to Detect Ubuntu Version.... #
    #---------------------------------------------------#

    check_os

    to


    #---------------------------------------------------#
    #-- Step 1 - Try to Detect Ubuntu Version.... #
    #---------------------------------------------------#

    #check_os

    Use this at your own risk.. We never tested this on Zorin_OS.

    Hope this help
    Till next time
    See ya

  5. Worked exactly as expected on ubuntu 24.04, sounds works as well. Appreciate the great guide!

  6. Great script! It worked great in Ubuntu 22.04. Unfortunately it has a big issue in Ubuntu 24.04. After boot I can login fine but after a while I can no longer log in, I either get a black screen or the window closes and returns to the rdp login window. All users are logged out. Restart xrdp service does not help. Only way I found to get it working again is restarting the computer.

    Errors found in the logs are:
    [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
    May 21 14:26:09 TIEPLGEN01 xrdp[213720]: [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
    May 21 14:26:09 TIEPLGEN01 xrdp[213720]: [ERROR] xrdp_sec_incoming: xrdp_iso_incoming failed
    May 21 14:26:09 TIEPLGEN01 xrdp[213720]: [ERROR] [ITU-T X.224] Connection Sequence: CR-TPDU (Connection Request) failed
    May 21 14:26:09 TIEPLGEN01 xrdp[213720]: [ERROR] libxrdp_force_read: bad header length 3

    May 21 14:39:03 TIEPLGEN01 xrdp-sesman[214484]: [INFO ] Terminating the xrdp channel server (pid 214537) on display 12
    May 21 14:39:03 TIEPLGEN01 xrdp-sesman[214484]: [INFO ] Terminating X server (pid 214487) on display 12
    May 21 14:39:03 TIEPLGEN01 xrdp-sesman[214484]: pam_unix(xrdp-sesman:session): session closed for user doctor
    May 21 14:39:03 TIEPLGEN01 xrdp-sesman[214484]: [INFO ] Calling auth_stop_session and auth_end from pid 214484
    May 21 14:39:03 TIEPLGEN01 xrdp-sesman[214484]: [WARN ] Window manager (pid 214486, display 12) exited quickly (1 secs). This could indicate a window manager config problem
    May 21 14:39:03 TIEPLGEN01 xrdp-sesman[214484]: [WARN ] Window manager (pid 214486, display 12) exited with non-zero exit code 1 and signal 0. This could indicate a window manager config problem
    May 21 14:39:03 TIEPLGEN01 gnome-session-binary[214486]: WARNING: Session manager already running!
    May 21 14:39:03 TIEPLGEN01 gnome-session[214486]: gnome-session-binary[214486]: WARNING: Session manager already running!
    May 21 14:39:02 TIEPLGEN01 gnome-session[214628]: gnome-session-check-accelerated: GLES Helper exited with code 512
    May 21 14:39:02 TIEPLGEN01 gnome-session[214655]: libEGL warning: egl: failed to create dri2 screen
    May 21 14:39:02 TIEPLGEN01 gnome-session[214655]: MESA: error: ZINK: failed to choose pdev
    May 21 14:39:02 TIEPLGEN01 gnome-session[214655]: libEGL warning: DRI2: failed to authenticate
    May 21 14:39:02 TIEPLGEN01 gnome-session[214628]: gnome-session-check-accelerated: GL Helper exited with code 512
    May 21 14:39:02 TIEPLGEN01 gnome-session[214629]: glx: failed to create drisw screen
    May 21 14:39:02 TIEPLGEN01 gnome-session[214629]: MESA: error: ZINK: failed to choose pdev
    May 21 14:39:02 TIEPLGEN01 gnome-session[214628]: glx: failed to create drisw screen
    May 21 14:39:02 TIEPLGEN01 gnome-session[214628]: MESA: error: ZINK: failed to choose pdev

    Any idea what might be causing this?

  7. Hi! First, thanks for this fantastic script! It’s been a huge help and solved numerous problems for me.

    Next, a small bug:
    The $Dwnload variable is defined on line 122, but is then redefined on lines 565 (in get_binaries()) and 1106 (in custom_login()). These redefinitions should probably be removed.

    Finally, I was able to get the script to run as root by setting Dwnload=”/tmp” on line 122, then removing the check for root user (lines 1346 – 1367), and the above two redefinitions (lines 565 and 1106). This has allowed me to run the script as root on remote machines using automation tools in non-interactive mode.

  8. Great tool. It is not 100% working in Ubuntu 24.04. After some time, you can no longer connect (you snap back to the rdp login) and need to reboot the computer. Restarting the service does not help and neither is the issue related to the user already logged.

    Have other people experienced this?

  9. @Stijn,
    Thank you for visiting our blog and providing great feedback. We have tested and played around with the script and so far we have not encountered this specific issue. The team behind xrdp software has released recently the version 0.10 of the xrdp. We have started testing last week with this version specifically and we have not really encountered an issue. On a physical laptop, we have spotted a small issue that will be resolved in the next release but not related to your issue…

    Can you provide some more information about your setup …So, you are using UBuntu 24.04 and you have performed an standard installation or a custom isntallation, if you type xrdp -v, which version is shown on your screen ?
    can you double check that the gnome remote desktop and sharing are not enabled on your Ubuntu machine ?

    Thank you for the feedback and your support.. .we will monitor this specific issue
    Till next time
    See ya

  10. @Pete,

    Thank you for visiting our blog and providing some feedback.

    First point, yes you are right, we should cleanup a little bit the code. So we will take into account your comment and specify a single $Dwnload variable/Constant in the script.
    Second Point, Can you tell us which tools you are speaking about ? Ansible or similar. We could potentially add a switch that will not perform the check for the root account but so far not a lot of people had the need to do that
    We will think about this and we might adapt the script in the future for that

    Thank for the feedback
    Till next time

  11. @Stijn,

    Thank you for visiting our blog and sharing your findings and issues. We have not encounter this issue so far. We will need to look into this one. Ubuntu 24.04 is still quite new and xrdp also has released some new version recently. we will need to look into this one since the problem could be either gnome desktop or the xrdp software latest release

    Checking the output you provided, this could be an issue with mesa drivers… are you using AMD graphic card ?

    Till next time
    See ya

Leave a Reply