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

 

 

 

 

71 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

  5. @idan,
    To remove xrdp installed by the script, you simply need to perform the following steps
    stop xrdp service (sudo systemctl stop xrdp)
    then remove all the files used by xrdp; locate and delete the following files or directories….
    /etc/xrdp
    /usr/local/sbin/xrdp
    /var/run/xrdp.pid
    /var/run/sesman.pid 

    I hope you have read the following posts as well
    XRDP – Small bug in Ubuntu 16.04.3 breaks custom XRDP install – Missing fontutil.h file
    xRDP – Other possible issues with xRDP on Ubuntu 16.04.3 – Part I
    xRDP – Other Possible issues with xRDP on Ubuntu 16.04.3 – Part II

    Normally all these issues should be fixed with the latest updates but you might still want to check this….

    Hope this help
    Till next time
    See ya

  6. Thank you very much! This post does help me a lot!
    But if the script is used in Chinese language environment , the ‘/Downloads’ in the script should be changed to ‘/下载’ . After that , it works perfectly.

  7. Hi Griffon,

    In first I would like to thank you for sharing your enthusiastic work and time to not give up and just use Windows 10 where remote gui is just enabling few ticks and dropping user in remote desktop permissions.
    Yes, I have licensed preinstalled win10 OEM just right now. But I wanted to give Linux one more chance after 7 years when I played around with many distributions and came to conclusion that my time is more valuable than spending days in command lines and to know commands by heart. How I came here? If you will type in google “xrdp ubuntu 16.04” you will came to page c-nergy.be/blog/?p=8952 what was my first approach to get working xrdp. Why Ubuntu 16.04.04? There is long term support and Ubuntu should be one of more user friendly and popular distributions. But why in the year 2018 there is not good performing cross platform(WindowsLinux) remote desktop gui available. Remote assistance and gui is a standard already past 5 years for end-user computers. I tried Teamviewer, failed install from their homepage where was Ubuntu package, what a joke. I tried VNC, slow graphical performance, literally just pressing button and waiting 10 sec to show new window. Then I came here to xrdp and it sound more promising solution. So yes coming back to install:
    1) Started here http://c-nergy.be/blog/?p=8952 from google search results. Everything went fine, good performance, easy install, Mate desktop is cool with little footprint on resources. But there are downsides for this tutorial, old xrdp version year 2014 ?! why Ubuntu is packing nowadays this old repository in fresh install I don’t have an answer. Not working from Android phones with remote desktop apps, ending with error. And also not forwarded local windows disks and no clipboard.
    2) Then started here http://c-nergy.be/blog/?p=10752 and 8952 must archive, this should be starting point because it installs latest xrdp from github. But yeah, as 7 years ago, command lines, making from sources, adding missing libraries and other geek tricks. Why that isn’t already included in Ubuntu I don’t have answer, at least in Ubuntu software portal. I didn’t started whole script, I just installed from ssh connection one component by another and adding missing libraries by end of results. Yes, you must open port 22(later you can close) if you are not standing locally behind Ubuntu box and install openssh before starting to play with installs, to not lose control of Ubuntu box After all efforts you must allow users anybode http://c-nergy.be/blog/?p=11043 because this infamous green screen after login. And then install one more missing component http://c-nergy.be/blog/?p=11061 because still green screen. And in the end I am finally with good remote desktop gui. And yes, still problems, I have second ssd disk what I cannt mount from gui but was ok from command line. Error was – Not authorized to perform operation(polkit authority not available and caller is not uid 0) And also not the best performance, eating up 50% of CPU when working with graphical windows, Mate desktop was better, most probably because there are animations in Unity. Would like to use Mate desktop. Clipboard is working that’s cool, and windows local drives are also forwarded.

  8. @Ivguy;

    Thank you for sharing you experience with xRDP and providing feedback on the information posted on this blog… As you have noticed, each version of xRDP (and Ubuntu) is improving and provide better results…..
    thank you for visiting our blog and we hope you will find more useful information for you…..

    Till next time
    See ya

  9. Hi!

    Tried this and I get that nice teal screen but when I try to log in it sits there doing nothing. After som time a popup appears saying:

    connection problem, giving up
    some problem

    In the xrdp.log I get this (sorry for the long text):

    [20180322-12:47:04] [DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 p
    ort 3350
    [20180322-12:47:05] [INFO ] xrdp_wm_log_msg: sesman connect ok
    [20180322-12:47:05] [DEBUG] xrdp_wm_log_msg: sending login info to session manag
    er, please wait…
    [20180322-12:47:05] [DEBUG] return value from xrdp_mm_connect 0
    [20180322-12:47:05] [INFO ] xrdp_wm_log_msg: login successful for display 10
    [20180322-12:47:05] [DEBUG] xrdp_wm_log_msg: started connecting
    [20180322-12:47:08] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:12] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:15] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:19] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:22] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:26] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:29] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:33] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:36] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:40] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:43] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:47] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:50] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:54] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:47:57] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:01] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:04] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:08] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:11] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:15] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:18] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:22] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:25] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:29] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:32] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:36] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:39] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:43] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:46] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:50] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:53] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:48:57] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:00] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:04] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:07] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:11] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:14] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:18] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:21] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:25] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:28] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:32] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:35] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:39] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:42] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:46] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:49] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:53] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:49:56] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:00] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:03] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:07] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:11] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:14] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:18] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:21] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:25] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:28] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:32] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:35] [DEBUG] xrdp_wm_log_msg: connection problem, giving up
    [20180322-12:50:35] [DEBUG] Closed socket 19 (AF_UNIX)
    [20180322-12:50:35] [DEBUG] xrdp_wm_log_msg: some problem
    [20180322-12:50:35] [DEBUG] xrdp_mm_module_cleanup
    [20180322-12:50:35] [DEBUG] Closed socket 18 (AF_INET 127.0.0.1:47148)

    Any hints what to check?

    /J

  10. Tried the new script.
    Still no luck though. This is what I get when debugging:
    xrdp-sessvc: waiting for X (pid 1637) and WM (pid 1636)
    xrdp-chansrv [1655706577]: main: app started pid 1638(0x00000666)
    xrdp-chansrv [1655706577]: main: DISPLAY env var set to :10.0
    xrdp-chansrv [1655706577]: main: using DISPLAY 10
    xrdp-chansrv [1655706578]: channel_thread_loop: thread start
    [20180326-16:22:09] [ERROR] X server for display 10 startup timeout
    [20180326-16:22:09] [ERROR] another Xserver is already active on display 10
    [20180326-16:22:09] [DEBUG] aborting connection…
    xrdp-sessvc: WM is dead (waitpid said 1636, errno is 0) exiting…
    xrdp-sessvc: stopping channel server

    Can’t see that there are any other Xserver active at all though so I’m not sure that message is entirely correct.

Leave a Reply