XRDP- Custom xRDP Install on Ubuntu 16.04.2 and accessing Unity Desktop Interface

 

Hello World,  

 

IMPORTANT UPDATE INFORMATION 

PLEASE BEFORE PERFORMING THE INSTALLATION WITH THE SCRIPT PROVIDED HERE, CHECK THIS LINK FIRST AS A SMALL BUG HAS BEEN DETECTED 

XRDP – Small bug in Ubuntu 16.04.3 breaks custom XRDP install – Missing fontutil.h file

 

Today, this post will tackle again the custom installation of xRDP on Ubuntu 16.04.2 and have access to the Unity Desktop Interface.  A previous post has been published earlier this year (see here).  Based on the feedback and comments received from the community, we feel that an update is necessary to this previous post.  Indeed, some readers have provided great feedback and detected small issues with the custom installation process and we really want to thank all of you for that.  Based on your feedback, we can provide better information and drive us to publish again posts and articles on this blog.

The previous post about the custom installation has been updated and should be working fine.  However, to make sure that everybody is aware of the changes and updates, we are publishing this post which should be considered the latest valid instructions guide to install xRDP on Ubuntu 16.04.2.

 

 

Background Information

As you probably know, Ubuntu 16.04 is the latest LTS release that would ship with the Unity Desktop Interface.  The change from Unity to Gnome will have an important impact and we are expecting that a lot of people would stick to Unity in the coming years before switching to the Gnome Desktop interface in order to train and educate users to the new desktop environment. This is why we are still providing information about xRDP and Unity Desktop….

Ubuntu 16.04 still ships an older version of xrdp (0.6.x.x) which does not provide all the new features available in the latest version of xRDP 0.9.2. which includes new backend rdp server and drive redirection capabilities.  To take advantage of all these new features, a custom installation of xRDP is needed.  This is exactly what we will be describing here.  As in the past, we will provide a nice little script that would compile the sources into your system and make it straight forward to you… 

So, let’s go ! 

The Custom Installation Script – Version 1.9

Overview

The version 1.9 script has not changed dramatically. However, it does take into account the changes that have been introduced in the latest release of xRDP (which is 0.9.2).  The changes are quite small but in order to provide the best experience we feel that this update is needed. 

Assumptions

Before running this script, be aware of the following assumptions

  • We have tested the script on Ubuntu 16.04 Update 2 (and not on any other Ubuntu Flavors!!!)
  • No additional desktop interface has been installed. Unity Desktop will be the default interface in the remote sessions
  • We have performed the test on a Virtual Machine running on Hyper-V Server
  • This script should be run only on Ubuntu 16.04.2 (so far) as we have not tested it on higher version. 
  • This script configure the .xsession file for a single user. (a new post configuring multiple users is coming…)

Prerequisites

We assume that you have internet connection on the Ubuntu machine.  The internet connection is needed to download the latest version xrdp package.  If you are not connected to internet, you can still manually download the xrdp package and modify the install-xrdp.sh script accordingly

The script version 1.9

Important Note :

If you copy/paste the script, you might encounter some issues because font formatting might be not maintained during the copy/paste operation. Please ensure that format is  accurate before launching the script. A downloadable version of the script is available at the bottom of the post

Version 1.9 does not introduces major changes.  This version of the script check that xrdp is compiled first and then you can compile the xorgxrdp.  Some of the lines have been removed because the xRDP 0.9.2 is providing already the correct configuration to the Ubuntu systems. The script will also populate automatically the .xsession file for a single user which is needed in order to access the Unity Desktop Indicator panel.  The script will also create the polkit file in order to avoid prompt when connecting through remote desktop protocols.  This script would also make available the Drives Redirection and Clipboard features.   

We have updated the script to version 1.9 to make it clear that this is the latest currently available version that works…. 

Disclaimer : As usual, use this at your own risk !! 

################################################################
# Script_Name : install-xrdp-1.9.sh
# Description : Perform an automated custom installation of xrdp
# on ubuntu 16.04.2
# Date : July 2017
# written by : Griffon
# Web Site :http://www.c-nergy.be - http://www.c-nergy.be/blog
# Version : 1.9
# Disclaimer : Script provided AS IS. Use it at your own risk....
##################################################################
 
##################################################################
#Step 1 - Install prereqs for compilation
##################################################################
 
echo "Installing prereqs for compiling xrdp..."
echo "----------------------------------------"
sudo apt-get -y install libx11-dev libxfixes-dev libssl-dev libpam0g-dev libtool libjpeg-dev flex bison gettext autoconf libxml-parser-perl libfuse-dev xsltproc libxrandr-dev python-libxml2 nasm xserver-xorg-dev fuse git

##################################################################
#Step 2 - Obtain xrdp packages 
##################################################################

## --Go to your Download folder
echo "Moving to the ~/Download folders..."
echo "-----------------------------------"
cd ~/Downloads

## -- Download the xrdp latest files
echo "Ready to start the download of xrdp package"
echo "-------------------------------------------"
git clone https://github.com/neutrinolabs/xrdp.git

## -- compiling xrdp packages
echo "Installing and compiling xrdp..."
echo "--------------------------------"
cd ~/Downloads/xrdp
sudo ./bootstrap
sudo ./configure --enable-fuse --enable-jpeg 
sudo make
sudo make install

##################################################################
#Step 3 - Download and compiling xorgxrdp packages
################################################################## 

cd ~/Downloads
git clone https://github.com/neutrinolabs/xorgxrdp.git

cd ~/Downloads/xorgxrdp 
sudo ./bootstrap 
sudo ./configure 
sudo make
sudo make install

##################################################################
#Step 4 - Configure systemd
##################################################################

## -- Issue systemctl command to reflect change and enable the service
sudo systemctl daemon-reload
sudo systemctl enable xrdp.service
sudo systemctl enable xrdp-sesman.service

##################################################################
#Step 5 - Populate .xsession file for currently logged on user 
##################################################################

cat >~/.xsession << EOF

/usr/lib/gnome-session/gnome-session-binary --session=ubuntu &
/usr/lib/x86_64-linux-gnu/unity/unity-panel-service &
/usr/lib/unity-settings-daemon/unity-settings-daemon &

for indicator in /usr/lib/x86_64-linux-gnu/indicator-*; 
do
basename='basename \${indicator}' 
dirname='dirname \${indicator}' 
service=\${dirname}/\${basename}/\${basename}-service 
\${service} &
done
unity
EOF

##################################################################
#Step 6 - Configure Polkit to avoid popup in Xrdp Session
##################################################################
 
cat >/etc/polkit-1/localauthority.conf.d/02-allow-colord.conf <<EOF

polkit.addRule(function(action, subject) {
if ((action.id == “org.freedesktop.color-manager.create-device” ||
action.id == “org.freedesktop.color-manager.create-profile” ||
action.id == “org.freedesktop.color-manager.delete-device” ||
action.id == “org.freedesktop.color-manager.delete-profile” ||
action.id == “org.freedesktop.color-manager.modify-device” ||
action.id == “org.freedesktop.color-manager.modify-profile”) &&
subject.isInGroup(“{group}”)) {
return polkit.Result.YES;
}
});
EOF

##################################################################
#Step 7 - Restart Computer 
##################################################################

echo "Restart the Computer"
echo "----------------------------"
sudo shutdown -r now

 

 

How to use the script

Set Execute Right on the script

Download the install-xrdp-1.9.sh script to your system.  To have it running, the script has to be marked as executable.  To mark a script/file as executable, the following actions needs to be performed 

Right-click on the file, go to properties, then select permissions and tick the box allow executable….

xrdp_custom

Click on Picture for better resolution 

or from the command line, issue the following command

chmod +x  ~/Downloads/install-xrdp-1.9.sh  

 

Note : Adjust the path where the install-xrdp-1.9.sh script to reflect your environment

Execute the script

To execute the script, ensure that internet connection is available (so you can download the necessary packages needed for the installation) and simply open a Terminal console.  In the Terminal console, Browse to the location where the script has been stored and then issue the following command 

sudo ./install-xrdp-1.9.sh  

You might be prompted for a password. Provide the password and proceed with the installation.

Wait for completion of the script.  The machine will reboot automatically when done.

Test your xRDP Infrastructure

At this stage, if everything is working as expected, you should be able to perform a remote desktop session to your Linux machine.  In the xrdp login page (the green background), ensure that Xorg option is selected, provide your user name and password, and you should be able to access your Ubuntu machine.  

U1704_xrdp_3

Click on picture for better resolution

Normally, in the xRDP login page, the keyboard should match the one you are using on your normal computer.  This was not the case in the past and has been fixed with the introduction of the xorgrdp server (it seems).  However, note that within the remote session, the keyboard layout might not match if you are using multiple ones.  This can be easily fixed through the indicator language bar within the xrdp session. Select the proper keyboard layout and you should be good to go….

U1704_xrdp_8

Click on picture for better resolution

The user that has executedthe script will be able to remote desktop into Ubuntu and the Unity Desktop will be launched automatically.  In Ubuntu 16.04.2, you can have the same user logged into the console and to the remote session and this scenario would work.  In later version of Ubuntu, it seems that the behavior has changed…(we will investigate a little bit further).  The user will be able to reconnect to an existing session as well and the user will be able to use the clipboard and drives redirection features.. 

Issues detected 

As in the past, the issues detected are related to performance and the logout functionality.  

The performance are acceptable but they are not great.   We are working mainly over  LAN infrastructure and we can perform our work..

The logout issue seems to be still there.  If a user decide to logout from the xrdp session, the user can click on the logout button (on the indicator panel) and after some time the session will be closed.  However, next time the user would try to connect, xrdp would fail.  The overcome this situation, we are still using the workaround provided in our previous post which consist of executing the following command

ps -ef h | grep xorgxrdp | grep `whoami` | tr -s " " | cut -d " " -f2 | xargs kill -9

 

Download the Script 

Please download the script :  install-xrdp-1.9.zip

Bonus 

To demonstrate that the script is working, we are also providing a quick and dirty video demo where we perform the custom installation. after the installation, a remote desktop connection can be performed and the Unity Desktop is launched automatically… 

 

Final Notes

In this post, we have spend some time in updating the previous post and checked the script provided is working and functional.  We have slight modified the install-xrdp.sh script in order to take into account feedback and comments from our readers.  We think that this update was necessary in order to show that we really take into account the comments provided to us and in order to provide an improved solution. 

The custom installation script provided here ensure that you can quickly and easily install the xRDP package and have it working against the Unity Desktop Interface. Ubuntu 16.04.2 provides the smoother xRDP experience so far when combined to the Unity Desktop.  This script could be useful for people that would stick to Unity Desktop interface and still having LTS release.. We have and will continue to provide information about xRDP and Unity Desktop for the moment as we think that some people might stick to it in the future releases as well.  Apparently, it would be possible to have Ubuntu 18.04 running the Unity Desktop as well… 

 

 

Till next time

See ya

 

 

 

 

59 thoughts on “XRDP- Custom xRDP Install on Ubuntu 16.04.2 and accessing Unity Desktop Interface

  1. Griffon

    FYI ubuntu has a bug that prevents building XORXRDP.

    I filed a bug

    bugs.launchpad.net/ubuntu/+source/libxfont/+bug/1707691

    Canonical’s devs have fixed it but the fix so far requires people to enable the “proposed” repository.

    This bug afects ubuntu 16.04 upto 17.10 I believe. If you don’t notce the failure during “make” you will just encounter a blank screen during an attempt at a session.

    Brian

  2. @Hummerbliss,

    Thank you for the info. We have been notified of the problem and we are currently working on publishing needed information to overcome this situation..
    I’m really pleased to see that people are looking into the problem and sharing their findings…(this is exactly the goal of this blog :-))

    Till next time
    See ya

  3. @renbuar,

    yes, you can either manually copy the fontutil.h file into the correct location and proceed with compilation or you can add proposed repository from Ubuntu..
    These are two workarounds that can be used to fix the problem… we will provide more info in a few details about the issue and the workarounds

    Till next time
    See ya

  4. @Paulo,

    yes we are aware of the issue and the workaround. our workaround would have been to get your hands on fontutil.h and proceed with compilation.. A better option might be to use the proposed repository as this one update the necessary packages needed for the xorgxrdp compilation process

    thank for the feedback and the visit
    till next time
    See ya

Leave a Reply