XRDP- HowTo Custom install on Ubuntu 16.04.x with Unity Interface (install-xrdp-1.9.2.sh)

  The script hereafter is outdated and has been replaced by a newer version.  Please Check the Download page for latest version.

 

Hello World, 

Ubuntu 18.04 is on its way and we are already looking and preparing some posts about xRDP and this exciting to come LTS Ubuntu Release.   However, Ubuntu 16.04 is also an LTS release and some people might be still using it for the coming years as well.  The problem with Ubuntu 16.04 is that the xrdp package that ship by default is an outdated package (version 0.6.1) compared to the version available on the xRDP web site (version 0.9.5).     This outdated package provides limited Remote desktop capabilities as it’s not providing Drive Redirection nor Clipboard support.  

To overcome this situation, one approach consist of perform an custom installation from sources binaries.    To provide easy installation and automation on Ubuntu systems, a little script has been developed that can be used to perform a custom installation of xRDP.  The script exists for some time now and has been updated with the different Ubuntu versions or features that would be made available with time.  

Because Ubuntu 16.04 is an LTS release, we have decided to update the install-xrdp.sh script and check that this is still working with the recently Unity Update made available by Canonical. Minor changes have been made. It’s more about cleanup of the code and removal of unnecessary code. 

So, let’s move on ! 

The Custom Installation Script – Version 1.9.2

Overview

The version 1.9.2 script has been updated and tested on the latest Ubuntu 16.04 version (16.04.4).  The updates are mainly cosmetic. 

  • We have updated the code used to detect the Ubuntu version (version 1.9.1 had an invalid code but has been fixed since then…:-) ).
  • We have updated the code to check if Unity Desktop is in used or not
  • We have updated the polkit section.  A specific group (i.e. users) has been used
  • This script configure the system to allow  multipe users by default (no need to create for each user a .xsession file)
  • Cleanup a little bit the code and add some additional checks as needed
  • We have changed the section where the fontutil.h file was created because of a small bug in Ubuntu 16.04.3. Apparently, the bug has been fixed (*)

(*) When Ubuntu 16.04.3 was released initially, a bug was identified which was preventing the installation of a custom xRDP package.  These bugs have been fixed and there is not need anymore to recreate the fontutil.h file on the system.   You can find more information about these changes in behavior and bugs in the following posts 

As this bug has been fixed, there is no need to create the file through the script but the script still check if needed or not to recreate the file 

Assumptions

Before running this script, be aware of the following assumptions

  • We have tested the script on Ubuntu 16.04 Update 3 and Update 4. 
  • The script should be working on Ubuntu 16.04 (whatever the Update version) 
  • 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 and Virtual box 
  • This script configure the .xsession file for  multipe users.

 

Click on Picture for Better Resolution

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.2

A downloadable version of the script is available at bottom of the post….. 

################################################################
# Script_Name : install-xrdp-1.9.2.sh
# Description : Perform an automated custom installation of xrdp
# on ubuntu 16.04.4
# Date : March 2018
# written by : Griffon
# Web Site :http://www.c-nergy.be - http://www.c-nergy.be/blog
# Version : 1.9.2
# Disclaimer : Script provided AS IS. Use it at your own risk....
##################################################################

#----------------------------------------------------------------# 
# Step 0 - Try to Detect Ubuntu Version and Unity.... 
#----------------------------------------------------------------#
clear
#Checking Ubuntu Version
echo
/bin/echo -e "\e[1;32m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m" 
/bin/echo -e "\e[1;32m Dectecting Ubuntu Version and Desktop in use...\e[0m"
/bin/echo -e "\e[1;32m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m"

version=$(lsb_release -d | awk -F":" '/Description/ {print $2}')

if [[ $version=*"Ubuntu 16.04"* ]]; then 
echo
/bin/echo -e "\e[1;33m Ubuntu Version :$version\e[0m"
else 
/bin/echo -e "\e[1;31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m" 
/bin/echo -e "\e[1;31mYour system is not running Ubuntu 16.04 Edition.\e[0m" 
/bin/echo -e "\e[1;31mThe script has been tested only on Ubuntu 16.04.x...\e[0m" 
/bin/echo -e "\e[1;31mThe script is exiting...\e[0m" 
/bin/echo -e "\e[1;31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m" 
echo
exit 
fi

#Checking if Unity Desktop in Use

if [ "$XDG_CURRENT_DESKTOP"="Unity" ] 
then 
/bin/echo -e "\e[1;33m Desktop interface Detected....: $XDG_CURRENT_DESKTOP\e[0m" 
echo 
else 
/bin/echo -e "\e[1;31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m" 
/bin/echo -e "\e[1;31mYour system is not running Unity Desktop Interface.\e[0m" 
/bin/echo -e "\e[1;31mThe script has been written to enable Unity Desktop in remote session...\e[0m" 
/bin/echo -e "\e[1;31mThe script is exiting...\e[0m"
/bin/echo -e "\e[1;31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m"
exit 
fi

#---------------------------------------------------#
# Step 1 - Download XRDP Binaries... 
#---------------------------------------------------#

/bin/echo -e "\e[1;32m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m" 
/bin/echo -e "\e[1;32m Downloading xRDP binaries and tools...\e[0m"
/bin/echo -e "\e[1;32m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m" 
echo
/bin/echo -e "\e[1;33m Installing Git....Proceeding \e[0m"
echo 
sudo apt-get -y install git
echo
cd ~/Downloads

## -- Download the xrdp latest files
echo
/bin/echo -e "\e[1;33m Preparing download xrdp package...Proceeding\e[0m"
echo
git clone https://github.com/neutrinolabs/xrdp.git
echo
/bin/echo -e "\e[1;33m Preparing download xorgxrdp package...Proceeding\e[0m"
echo
git clone https://github.com/neutrinolabs/xorgxrdp.git


#---------------------------------------------------#
# Step 2 - Install Prereqs... 
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;33m Installing Prereqs....Proceeding\e[0m" 
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 pkg-config

#---------------------------------------------------#
# Step 3 - Check if Fontutil.h file exists... 
#---------------------------------------------------#

#checking if file exists...
echo
/bin/echo -e "\e[1;33m Checking fontutil.h file....Proceeding\e[0m" 
echo

file="/usr/include/X11/fonts/fontutil.h"

if [ -f "$file" ]
then
echo 
/bin/echo -e "\e[1;37m Fontutil.h exist...Moving Next step \e[0m"
echo
else
echo
/bin/echo -e "\e[1;37m Fontutil.h will be created by script...Proceeding \e[0m"

echo
cat >/usr/include/X11/fonts/fontutil.h <<EOF
#ifndef _FONTUTIL_H_
#define _FONTUTIL_H_

#include <X11/fonts/FSproto.h>

extern int FontCouldBeTerminal(FontInfoPtr);
extern int CheckFSFormat(fsBitmapFormat, fsBitmapFormatMask, int *, int *,
 int *, int *, int *);
extern void FontComputeInfoAccelerators(FontInfoPtr);

extern void GetGlyphs ( FontPtr font, unsigned long count,
 unsigned char *chars, FontEncoding fontEncoding,
 unsigned long *glyphcount, CharInfoPtr *glyphs );
extern void QueryGlyphExtents ( FontPtr pFont, CharInfoPtr *charinfo,
 unsigned long count, ExtentInfoRec *info );
extern Bool QueryTextExtents ( FontPtr pFont, unsigned long count,
 unsigned char *chars, ExtentInfoRec *info );
extern Bool ParseGlyphCachingMode ( char *str );
extern void InitGlyphCaching ( void );
extern void SetGlyphCachingMode ( int newmode );
extern int add_range ( fsRange *newrange, int *nranges, fsRange **range,
 Bool charset_subset );

#endif /* _FONTUTIL_H_ */
EOF
 
fi

#---------------------------------------------------#
# Step 4 - compiling... 
#---------------------------------------------------#
# -- Compiling xrdp package first

echo
/bin/echo -e "\e[1;32m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m" 
/bin/echo -e "\e[1;32mXRDP Compilation about to start !... \e[0m"
/bin/echo -e "\e[1;32m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m"
echo

cd ~/Downloads/xrdp
sudo ./bootstrap
sudo ./configure --enable-fuse --enable-jpeg 
sudo make

#-- check if no error during compilation

if [ $? -eq 0 ]
then 
echo
/bin/echo -e "\e[1;37m-----------------------------------\e[0m"
/bin/echo -e "\e[1;37mMake Operation Successful ! \e[0m"
/bin/echo -e "\e[1;37m-----------------------------------\e[0m"
echo
else 
echo
/bin/echo -e "\e[1;31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m"
/bin/echo -e "\e[1;31mError while executing make.\e[0m"
/bin/echo -e "\e[1;31mThe script is exiting...\e[0m"
/bin/echo -e "\e[1;31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m"
echo
exit
fi
sudo make install

# -- Compiling xorgxrdp package first

echo
/bin/echo -e "\e[1;32m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m" 
/bin/echo -e "\e[1;32mxorgxrdp Compilation about to start !... \e[0m"
/bin/echo -e "\e[1;32m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m"
echo
cd ~/Downloads/xorgxrdp 
sudo ./bootstrap 
sudo ./configure 
sudo make

# check if no error during compilation 
if [ $? -eq 0 ]
then 
echo
/bin/echo -e "\e[1;37m-----------------------------------\e[0m"
/bin/echo -e "\e[1;37mMake Operation Successful ! \e[0m"
/bin/echo -e "\e[1;37m-----------------------------------\e[0m"
echo
else 
/bin/echo -e "\e[1;31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m"
/bin/echo -e "\e[1;31mError while executing make.\e[0m"
/bin/echo -e "\e[1;31mThe script is exiting...\e[0m"
/bin/echo -e "\e[1;31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m"
echo
exit
fi
sudo make install

#---------------------------------------------------#
# Step 5 - create policies exceptions .... 
#---------------------------------------------------#

echo
/bin/echo -e "\e[1;33m Creating Polkit file...Proceeding\e[0m" 
echo

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(“{users}”)) {
return polkit.Result.YES;
}
});
EOF

#---------------------------------------------------#
# Step 6 - configure Xwrapper file .... 
#---------------------------------------------------#

echo
/bin/echo -e "\e[1;33m Configuring Xwrapper(optional)...Proceeding\e[0m" 
echo

sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config

#---------------------------------------------------#
# Step 7 - Populate the .xsession file multi-users # 
#---------------------------------------------------#

echo
/bin/echo -e "\e[1;33m Configuring startwm.sh for multi-users login...Proceeding\e[0m" 
echo

sudo sed -i.bak "/# auth /a cat >~/.xsession << EOF\n#Unity Xrdp multi-users \n/usr/lib/gnome-session/gnome-session-binary --session=ubuntu &\n/usr/lib/x86_64-linux-gnu/unity/unity-panel-service &\n/usr/lib/unity-settings-daemon/unity-settings-daemon &\nfor indicator in /usr/lib/x86_64-linux-gnu/indicator-*;\ndo\nbasename='basename \\\\\${indicator}'\ndirname='dirname \\\\\${indicator}'\nservice=\\\\\${dirname}/\\\\\${basename}/\\\\\${basename}-service\n\\\\\${service} &\ndone\nunity\nEOF" /etc/xrdp/startwm.sh

#---------------------------------------------------#
# Step 8 - create services .... 
#---------------------------------------------------# 
echo
/bin/echo -e "\e[1;33m Creating xRDP Services...Proceeding\e[0m" 
echo

sudo systemctl daemon-reload
sudo systemctl enable xrdp.service
sudo systemctl enable xrdp-sesman.service
sudo systemctl start xrdp

#---------------------------------------------------#
# Step 9 - install additional packages .... 
#---------------------------------------------------#

echo
/bin/echo -e "\e[1;33m Installing xserver-xorg-core pacakges...Proceeding\e[0m" 
echo
sudo apt-get -y install xserver-xorg-core

echo
/bin/echo -e "\e[1;33m checking Virtualization Platform...Proceeding\e[0m" 
echo

vmversion=$(sudo dmidecode -s system-product-name)
echo $vmversion
if [ "$vmversion" = "VirtualBox" ]
then 
 sudo apt-get -y install xserver-xorg-input-all
else
 echo "no additional package needed" 
fi
 
/bin/echo -e "\e[1;32m----------------------------------------------------------\e[0m"
/bin/echo -e "\e[1;32mInstallation Completed\e[0m"
/bin/echo -e "\e[1;32mPlease test your xRDP configuration....\e[0m"
/bin/echo -e "\e[1;32mCheck c-nergy.be website for latest version of the script\e[0m"
/bin/echo -e "\e[1;32mwritten by Griffon - March 2018 - Version 1.9.2\e[0m"
/bin/echo -e "\e[1;32m----------------------------------------------------------\e[0m"
echo

How to Use the Script

Set Execute Right on the script

As before, you first need to download the install-xrdp-1.9.2.sh script to your system. Then you  have to mark it as executable so the system can run this script. To do this, simply right-click on the file, go to properties, then select permissions tab and tick the box allow executable….

Click on Picture for better resolution 

or from the command line, issue the following command

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

Note : Adjust the path where the install-xrdp-1.9.2.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 

./install-xrdp-1.9.2.sh  

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

Click on Picture for better resolution 

Wait for completion of the script.  The machine will not reboot automatically when done so you can review the actions performed by the script….

Click on Picture for better resolution 

Test your xRDP Infrastructure

It’s time to check if XRDP is working as expected !  Open your remote desktop client, insert the name or ip address of the remote Ubuntu machine and try to connect.  If the xRDP service is started, you will see the usual xRDP Login screen with the green background.

Click on picture for better resolution

Type in your user account and password and after some time, you should have access to your Unity Desktop interface through the Remote Desktop client. 

Click on picture for better resolution

In Ubuntu 16.04.x, 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…  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 

No new real issues detected in this version so far.   

Logout options

In this version, you can click on the logout option and this should be normally work out of the box. We have tried two three times and it seems to works (even do it’s a little bit slow).  If you have issues with logout actions, as in our previous posts, you can try to use the following command line (or make a custom shortcut that users can they use to logout in one step)

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

Applications

We have checked that standard applications could be used through the remote desktop session.  Firefox starts up and we can browse internet, we have started up software center and we can install software. so far, all in all, we are able to perform some works through the remote desktop solution 

Performance 

We are not sure if it’s because we have really small virtual machines (only 2GB of RAM) but performance are not that great.  There can be long latency between the moment you have clicked a button and the action that should start after clicking.  We think that performance should be acceptable and people should be able to work if the remote machine has the necessary resources to run Unity Desktop Interface. 

Virtualization Platform 

On VirtualBox, after installing the xserver-xorg-core packages, we have noticed that it was not possible to login back into the Ubuntu machine directly (not through remote desktop session). This seems to be caused by the fact that keyboard and mouse drivers are removed during the install process (do not know how do).  So, to overcome this limitation, the script check for the virtualization platform (virtualbox or others) and add an additional xserver-xorg package so it’s still possible to login locally on the ubuntu machine.   The problem does not exist on Hyper-v…  

The script is taking care of this so the user does not need to perform any additional actions to overcome this possible limitation….

 

Download the Script 

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

 

Bonus : A Quick Demo…. 

 

51 thoughts on “XRDP- HowTo Custom install on Ubuntu 16.04.x with Unity Interface (install-xrdp-1.9.2.sh)

  1. One minor headsup – I’ve ran the script in ~ and there are a few things you might want to add:

    apt install build-essentials pkg-config

    also, the script at one point changes directory to ~/Downloads/xrdp, but the folder was downloaded to ~/xrdp. I’ve manually changed the shell script and it works fine

  2. @Kit Ng

    we have added the pkg-config in the script but we will not add the build-essentials as do not want to generate deb packages….
    We will check the script again but If i go through, we are using cd ~/Downloads before downloading the xrdp package so the correct location should be ~/Downloads

    Thank you for the feedback and the positive comments…We will double check some of the things again..
    Till next time
    See ya

  3. The Script works fine.

    On a new standard Ubuntu installation there is no ~/Downloads for root only for the users.
    So maybe you ran the script as root ?

    For me the script works when when i run it as a user with sudo but fails as root because of not existing ~/Downloads
    See ya

  4. Thank you for this script! I’ve used it twice – also the 1.9 version.
    One question: after I have executed the script, xrdp –version is still reporting 0.9.4
    xrdp –version

    xrdp: A Remote Desktop Protocol server.
    Copyright (C) Jay Sorg 2004-2014
    See http://www.xrdp.org for more information.
    Version 0.9.4

    Shouldn’t that be 0.9.5?

    Thanks!

  5. Found a minor issue when starting to compile, it couldn’t checkout the submodule due to a permission error. Some folders ended up being owned by root inside the xrdp folder.

  6. @Gabe;

    We didn’t encounter this issue… we will check this and come back with an update
    thank you for your feedback and your visit
    till next time
    See ya

  7. @Peter,

    Indeed, the version of xrdp should show 0.9.5. We will check that the script is getting the latest binaries from xrdp web site and come back with an update if needed
    Thank yo for the feedback and for visiting our blog
    till next time
    See ya

  8. @Someguy,

    have you read the instructions correctly ? the script should be started as a normal user and during the execution of the script, you will be prompted for sudo password. this should be working as demonstrated on the video
    Thank you for the feedback and the visit
    Till next time
    See ya

  9. I just tried the script on a fresh installation of Ubuntu 16.04.4 LTS, and it works without a problem. And the clipboard function works as well. Thanks so much for this!

  10. @Goran,
    Thank you for your feedback and visiting our blog… We happy to see that the work and effort we put on the script can be useful and that’s working for you…
    Till next time
    See ya

  11. After running this script, my system has refused to accept input from the local keyboard and mouse. Any immediate thoughts on how to fix this?

  12. @Jim,

    You have to re-install the following package sudo apt-get -y install xserver-xorg-input-all
    to re-install it, you have either to use SSH or xrdp if enabled and working or you have to boot your server in repair mode and perform the installation of the package…
    This is a known issue….and has been described in the issue detected Virtualization platform

    Hope this help
    Till next time
    See ya

  13. Ah. The text made it sound like the script checked for that. Thanks for the response!

  14. A couple of things… thanks for the script….

    I’ve got a bug on a fresh install of 16.04.4, the “if” at the top where its checking for the version number isn’t working. I just “else-s” out.

    When I check:
    username@hostname:~$ lsb_release -d
    Description: Ubuntu 16.04.4 LTS
    version=$(lsb_release -d | awk -F”:” ‘/Description/ {print $2}’)
    echo $version
    Ubuntu 16.04.4 LTS

    Also we are currently using smbd/winbind on these machines to allow users to logon to them using their AD IDs. I found when they had an account on the box prior to running the scripts it worked great. Any new user who didn’t have an account, didn’t work. Solution. Copy the .xsession file to /etc/skel so that any “new” user will have that file to drawn the desktop.

  15. @SteelRat,

    The script checks for the string Ubuntu 16.04 only. So, this script should be working for any version of Ubuntu 16.04 version (i.e. Ubuntu 16.04.3 or 16.04.4 version)
    We will check that the Ubuntu version check is working and fix it if necessary

    Thank for the feedback and visiting our blog
    Till next time
    See ya

  16. I’m not seeing window decorations or the unity menu at the top of the desktop. Any ideas?

    Also, I have some users who would rather have xfce4. Attempted to override by placing the xfce4-session in their home dir .xsession. It didn’t work. How do we accomplish that?

    Thanks

  17. Wow! A little draconian to *force* only unity, don’t you think? I found my fix. The /etc/xrdp/startwm.sh overwrites everyone’s .xsession everytime the window manager starts…

    We commented this out. Still, very good tut.

  18. @Sprocket12,

    if you read the title of the post, we are assuming that your will run the script on Ubuntu 16.04.x where Unity is the default Desktop interface…Now indeed if you want to use different interface, you can per user customize the ~/.xsession file. This was the technique used with the previous script version.. but again,as people working in corporate infrastructure, they tend to use a unique Desktop interface and usually it’s Unity for Ubuntu 16.04
    Thank for the visit and the feedback
    Till next time
    See ya

  19. @sprocket12,

    double check the content of .xsession for the user. Some people reported already this issue but we are not able to replicate this….as we are working exclusively with virtual infrastructure, we never had this issue since we populating the .xsession file with additional commands to be executed at login

    For the users with different desktop, you need to change the /etc/xrdp/startwm.sh file and modify the ~/.xsession file for these users then

    Till next time
    See ya

  20. Thank you!
    Works great!
    Had my own recipe for Centos7 that I tried to use…
    Your script saved the day.
    /Peo, IT-dep Halmstad University

  21. Hi,

    I’m trying to run this script on Ubuntu 16.04.4 and I get this error message:

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Dectecting Ubuntu Version and Desktop in use…
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ./install-xrdp-1.9.2.sh: 26: ./install-xrdp-1.9.2.sh: [[: not found
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Your system is not running Ubuntu 16.04 Edition.
    The script has been tested only on Ubuntu 16.04.x…
    The script is exiting…
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Is that what is expected to happen?

    I have been trying for some time now to get xrdp up and running on my system and nothing has worked to day. My latest attempt involved version 1.9 of the script, before that I followed the easy instructions on your blog. The closest I have gotten so far is an exit message of “login failed for display 0”. Nothing seems to work.

    Regards,
    Paul.

  22. @Peo Manson,

    thank you for visiting our blog and sharing your experience…nice to hear that a post can be useful time to time 🙂
    Till next time
    See ya

  23. @Paul;
    No, this is not a normal behavior…Normally, the script should detect the version 16.04 using wildcart approach but it’ does not seem to work on your system
    are you sure your system is running bash or sh ? Error is usually generated when using sh shell…
    What do you see when you type /bin/bash –version (-> it should output bash and not shell)
    Can you try the following…
    from command line type /bin/bash ./test.sh and see if it works

    if not working, comment the line exit in the check Ubuntu version section and the script should go through
    Hope this help

    Till next time
    See ya

  24. Have installed custom script, works like a charm only….not when I install the Nvidia drivers. I need these drivers to run cuda (cuda needs the nvidia drivers installed) in order to do datascience research. I also need to be able to remotely connect to the machine.
    1) If I uninstall the Nvidia drivers, everything works again.
    2) Its perfectly ok, not to use the Nvidia when accessing Xrdp, as long as I can access the nvidia from the command prompt
    I’ve read a lot on the internet about this problem in particular GLX not being able to use openGL this way.
    I’m ok with that.

    – Could you give me a setup / solution in which the graphical drivers (nvidia) are not invoked when accessing xrdp, while I have the Nvidia drivers installed?
    – Obviously, best solution is when the nvidia GPU would be used, but this seems out of reach.

    Best I found so far: https://github.com/neutrinolabs/xrdp/issues/721

    Much appreciated upfront,

    Kindest regards
    Roland Zoet

  25. @ReZoet,

    Sorry for the delays in our responses we have been working quite a lot lately…We are happy that you have found a solution for your issues. Thank you for sharing your findings with this blog so info can be spread

    Till next time
    See ya

  26. Hello Griffon,

    First of, thanks for this excellent articles suite on xRDP. I was using the older version with Mate but needed the copy/paste ability.

    Looks like I’m the unlucky one though as I got every single issues you reported on. All fixed. But one remains. It is possibly similar to sprocket12’s one. I can go thru the xRDP logon. But once in, I only get the desktop part. No upper window bar and no docking panel on the left.

    The xRDP connection also takes over the console desktop.

    That makes it pretty hard to do anything at this point. At least, copy/paste works though. I tried reinstalling the whole kit but that didn’t work.

    Any ideas on how to get the docking panel and upper bar back would be appreciated.

    G.

  27. @Guy,

    can you provide a screenshot of your desktop in xRDP ? When remote login into your ubuntu, on the desktop with no dock bar and no upper windows, can you right click on the desktop, and select run terminal
    In the terminal, can you type unity. If this loads your Desktop interface correctly, this means that something is wrong in the .xsession file

    Hope this help
    Till next time
    See ya

  28. Hi Paul,
    I also encountered the issue with:

    ./install-xrdp-1.9.2.sh: 26: ./install-xrdp-1.9.2.sh: [[: not found
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Your system is not running Ubuntu 16.04 Edition.

    Just insert the following line as the first line of the install-xrdp-1.9.2.sh
    #!/bin/bash

    ABJ

  29. Hi Griffon,

    Here is the screen shot. A menu bar magically appears now, it was not there before. However, the normal top bar is not there nor the docking panel.
    https://www.dropbox.com/s/xalqpu9c03b4hwb/xRDPInitial.PNG?dl=0

    A reconnection didn’t show any improvements.

    Another thing to note, the top bar (the one with the X to close and minimize/maximize buttons) of any window is absent.

    When I ran “unity” from the xRDP session, it disconnected the session. I went to the console to see what had happened there. Same as before, top bar and docking had disappeared. So just for fun I ran “unity” from a terminal window on the console. It started a loop of “error spawning command line…” and eventually froze with several of this window showing up: https://www.dropbox.com/s/uafu2rl7xuuhcyd/SystemError.PNG?dl=0 and while looping, you could see the docking panel appearing and disappearing.

    I went back to the still open xRDP session and, low and behold, the top bar and the docking panel were there. The other windows top bars (with the closing X) were there too. The icons on the right of the top bar (system/keyboard/screen) are the same but bring the proper options when clicked.

    Here is the content of the .xSession file:
    ————————————-
    #Unity Xrdp multi-users
    /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
    ————————————-
    I checked the folders referenced in the for loop. There is 9 of them, each with an executable binary in it.

    So, running “unity” from the console session fixes the xRDP one but freezes the console one.

  30. @ABJ;

    This can fix the issue as long as the /bin/bash is pointing to the correct executable. Some software replace the bash engine with another one and simply create a symlink for this..So, even placing this line might not guarantee that the script will run for sure…

    Till next time
    See ya

  31. @Guy,
    Juss a Guess/idea… The problem seems to be related to the .xsession file…. This was the case in some previous versions of Ubuntu that the .xsession file trick was not working….. So To test and validate this intuition….

    So delete the content of the .xsession file and comment the section about unity desktop in the /etc/xrdp/startwm.sh file
    Reboot your machine and try to connect remotely….what you should see is a purple background with no bar no Docs…If you right-click on the desktop, select Open Terminal and type exec unity, is the Unity desktop loading accordingly ?

    Is the Ubuntu machine a virtual machine or physical machine, are you using NVIDIA drivers ?

    Till next time
    See ya

  32. Works great! Except I’m having intermittent issues with the ALT keys — e.g., ALT-TAB to switch applications, ALT+F4 to close an application; ALT+SPACE to bring up the menu of the application I’m in. I’ve double-checked that the keyboard shortcuts for those tasks are indeed set to those keys in system settings. Has anybody seen anything like this?

  33. @Justin,

    We have seen this issues in the past or similar issues with keyboards (see http://c-nergy.be/blog/?p=3858) but since then we have seen less and less issues related to that…. Plus you mentioning that the issue is intermittent…
    We would need to perform some additional testings to see if this happens in a recurring manner and see if this can be fixed….
    If anybody has seen that or solved this issue; feel free to post a comment 🙂

    till next time
    See ya

  34. Using Ubuntu 16.04.5 on an HP desktop, I had to use the #!/bin/bash and the sudo apt-get -y install xserver-xorg-input-all workarounds, but they did what they were supposed to.

    Remaining issue:
    I can’t install packages from RDP session or from Console. When I try to install Google Chrome, I don’t see the dialog asking for credentials. Instead, Software Install shows the installation starting, but the thin progress bar suddenly disappears right at the point where it should tell me it needs more permission, and the button again says Install. The dialog asking for permission never appears anywhere that I can find it.

    I don’t yet know about any other actions that would normally prompt for elevating permission.

  35. @Alec,

    You could try to disable the policy kit completely first on your system and see if you can perform the installation. If this is working as expected, you could re-enable the policy kit and locate the policy kit file that might be blocking the installation of the software. In this file, you should be able to set configuration parameters to allow installation within remote session.
    You could possibly work some useful information in this post (http://c-nergy.be/blog/?p=12073)

    Hope this help
    Till next time
    See ya

  36. Using Ubuntu 16.04.5 on an HP desktop. The final step of the script (Installing xserver-xorg-core pacakges) made the system not bootable anymore.
    I solved the issue, installing “xserver-xorg-dev-hwe-16.04” instead of “xserver-xorg-dev” during the Prereqs phase (step 2) as suggested on xrdp website.

  37. @Dario,
    thank for the visit and the comments…till noz, we never had to add the -hwe* package to have this working…but it’s a long time since we have checked the script on Ubuntu 16.04…If needed, we will update it and provide the latest version.

    Till next time
    See ya

  38. Ran this on script on Ubuntu 16.04.6 LTS and thought I had bricked my VM on Hyper-V (Windows 10). Console screen via Hyper-V manager was left with blinking cursor right after the fsck piece of the boot.

    Prior to running this script, I had installed xorg from APT and RDP was working fine, just didn’t have clipboard functionality.

    Turns out the VM was running fine, and I’m able to RDP / SSH into it after this script reboot, but the only way I currently can see the console is if I go back to text only, disabling the X at boot:

    https://askubuntu.com/questions/16371/how-do-i-disable-x-at-boot-time-so-that-the-system-boots-in-text-mode

    When I try to startx from the Hyper-V VM’s console:

    Fatal server error:
    (EE) no screens found(EE)

    “/var/log/Xorg.0.log” has the following:

    [ 24.218] (EE) Failed to load module “fbdev” (module does not exist, 0)
    [ 24.218] (II) LoadModule: “vesa”
    [ 24.218] (WW) Warning, couldn’t open module vesa
    [ 24.218] (II) UnloadModule: “vesa”
    [ 24.218] (II) Unloading vesa
    [ 24.218] (EE) Failed to load module “vesa” (module does not exist, 0)
    [ 24.218] (EE) Failed to load module “fbdev” (module does not exist, 0)
    [ 24.218] (II) LoadModule: “vesa”
    [ 24.218] (WW) Warning, couldn’t open module vesa
    [ 24.218] (II) UnloadModule: “vesa”
    [ 24.218] (II) Unloading vesa
    [ 24.218] (EE) Failed to load module “vesa” (module does not exist, 0)
    [ 24.218] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
    [ 24.218] (WW) Falling back to old probe method for modesetting
    [ 24.218] (EE) open /dev/dri/card0: No such file or directory
    [ 24.218] (EE) No devices detected.
    [ 24.218] (EE)
    Fatal server error:
    [ 24.218] (EE) no screens found(EE)
    [ 24.218] (EE)

    No big deal to me, since RDP / SSH is working. Just didn’t have an easy way to find out what IP address the VM was getting without reverting back to text on boot.

  39. @R;
    Ok thank you for sharing this info…
    It seems that the error might be due to the xorg software that has not bee installed correctly or some files/packages missing… (based on the failed to load vesa). You might want to try to re-install xorg and dependencies to see if this fix your issue.. Take a backup/snapshot before doing anything, so if something fails, you have a backup
    Hope this help
    Till next time
    See ya

  40. Thanks. After running the script I can login using xrdp but can’t login physically. My login screen on my desktop freezes and can’t accept any keyboard or mouse inputs.

  41. @Jake,

    This seems to be a known issue… This version of the script is a little bit out-dated (and we working on updating it) but the fact that you cannot use keyboard and mouse sounds like some packages have been removed during xrdp install
    Try to re-install this package sudo apt-get -y install xserver-xorg-input-all
    Reboot your system and check if keyboard mouse is back

  42. Hi Griffon,
    Thanks for your excellent work for remote desktop!
    I’ve been using your scripts to connect remote desktop from Windows to ubuntu16.04 for a period of time. It works in most cases, however, recently I installed on a new machine. Once I log in via remote desktop tool of windows, it crashed. I tried to check what happened during installing and I found it report this:

    Configuring Xwrapper(optional)…Proceeding
    sed: can’t read: /etc/X11/Xwrapper.config: No such file or directory

    I have no idea if the ubuntu 16.04.6 version or nvidia 430.40 (GTX1050Ti) causes this. Thanks again!

  43. @Arthur77Wang,

    First, I would check if the file /etc/X11/Xwrapper.config exists on your system.. If I remember, the file is not there and not used on Ubuntu 16.04.x so this should not be the problem
    I would then check /var/logs/xrdp.log and /var/logs/xrdp-sesman.log to see if there is any hints/clue that could help us tracking down the issue
    I would also check the ~/.xession-errors file to see if there are something logged there as well

    When you say xrdp is crashing, what do you mean ? can you be more specific ? Can you connect to xrDP, do you get to the xrdp login screen, can you pass your credentials, do you see a black screen or disconnected immediately….?

    Waiting for your feedback
    Till next time
    See ya

  44. Hi Griffon,
    Thanks for your response!
    When I mentioned ‘crashed’ I meant a lasting black screen and nothing would happen then. I’d dropped into the login panel of xrdp and it seemed that the login authority had been approved. And I tried to adjust order of installations of xrdp, nvidia driver and ‘apt-get update & upgrade’, but still not worked. Here are some hints as you advised me to inspect:

    In ‘.xsession-errors’:
    openConnection: connect: No such file or directory
    cannot connect to brltty at :0
    ……

    In ‘/var/log/xrdp.log’:

    [20190807-09:49:24] [INFO ] xrdp_wm_log_msg: sesman connect ok
    [20190807-09:49:24] [DEBUG] xrdp_wm_log_msg: sending login info to session mana…
    [20190807-09:49:24] [DEBUG] return value from xrdp_mm_connect 0
    [20190807-09:49:24] [INFO ] xrdp_wm_log_msg: login successful for display 10
    [20190807-09:49:24] [DEBUG] xrdp_wm_log_msg: started connecting
    [20190807-09:49:24] [INFO ] lib_mod_log_peer: xrdp_pid=2163 connected to X11rdp…
    [20190807-09:49:24] [DEBUG] xrdp_wm_log_msg: connected ok

    In ‘/var/log/xrdp-sesman.log’:

    [20190807-08:46:40] [DEBUG] libscp initialized
    [20190807-08:46:40] [DEBUG] Testing if xrdp-sesman can listen on 127.0.0.1 port…
    [20190807-08:46:40] [DEBUG] Closed socket 1 (AF_INET 127.0.0.1:3350)
    [20190807-08:46:40] [INFO ] starting xrdp-sesman with pid 5068
    [20190807-08:46:40] [INFO ] listening to port 3350 on 127.0.0.1
    [20190807-09:13:57] [INFO ] A connection received from 127.0.0.1 port 33978
    [20190807-09:13:57] [INFO ] ++ created session (access granted): username …
    [20190807-09:13:57] [INFO ] starting Xorg session…
    [20190807-09:13:57] [DEBUG] Closed socket 9 (AF_INET 0.0.0.0:5910)
    [20190807-09:13:57] [DEBUG] Closed socket 9 (AF_INET 0.0.0.0:6010)
    [20190807-09:13:57] [DEBUG] Closed socket 9 (AF_INET 0.0.0.0:6210)
    [20190807-09:13:57] [DEBUG] Closed socket 8 (AF_INET 127.0.0.1:3350)
    [20190807-09:13:57] [INFO ] calling auth_start_session from pid 7514
    [20190807-09:13:57] [DEBUG] Closed socket 7 (AF_INET 127.0.0.1:3350)
    [20190807-09:13:57] [DEBUG] Closed socket 8 (AF_INET 127.0.0.1:3350)
    [20190807-09:13:57] [INFO ] Xorg :10 -auth .Xauthority -config xrdp/xorg.conf -…
    [20190807-09:13:57] [CORE ] waiting for window manager (pid 7520) to exit
    [20190807-09:22:02] [INFO ] shutting down sesman 1
    [20190807-09:22:02] [WARN ] receiving SIGHUP 1
    [20190807-09:22:02] [CORE ] window manager (pid 7520) did exit, cleaning up ses…
    [20190807-09:22:02] [INFO ] calling auth_stop_session and auth_end from pid 7514
    [20190807-09:22:02] [DEBUG] cleanup_sockets:
    [20190807-09:22:02] [DEBUG] cleanup_sockets: deleting /tmp/.xrdp/xrdp_chansrv_a…
    [20190807-09:22:02] [DEBUG] cleanup_sockets: deleting /tmp/.xrdp/xrdp_chansrv_a…
    [20190807-09:22:02] [DEBUG] cleanup_sockets: deleting /tmp/.xrdp/xrdpapi_10
    [20190807-09:22:02] [INFO ] ++ terminated session: username …, display …
    [20190807-09:22:02] [INFO ] shutting down sesman 1
    [20190807-09:22:02] [INFO ] shutting down sesman 1
    [20190807-09:22:02] [DEBUG] Closed socket 7 (AF_INET 127.0.0.1:3350)

    Wish all above could be useful. It seems that sesman was terminated everytime?…. Another clue is that xrdp works if I only install it without installing nvidia driver.
    Thanks again!
    Best wishes

  45. Hi Griffon,
    I’ve struggled for several hours on the issue. Finally it worked when I chose 410.48 version nvidia driver to install (Tried a lot of versions, 430.40, 410.78, 410.93, etc.). This version of driver is working well along with xrdp. I guess there might be some subtle changes of displaying in newer version of nvidia linux driver which caused this problem.
    Your scripts have saved tons of time for me in using remote desktop! Thanks a lot.
    Best wishes

  46. @Arthur77Wang,

    Well done 🙂 ! I was looking into the issue when you message popped up…. This is good to know as I was not finding any real useful info…
    Thanks for the visit and the feedback provided and for sharing your findings….

    Till next time
    See ya

  47. Hi,

    Just tested this script and ran into some issue detecting Ubuntu 16.04.6 LTS. Removed the check script and it works fine. There’s some syntax error on line 27/28 (the if statement).

    Also, what modifications are required when getting this to work with XFCE4? I can make out what’s just required to make the custom build of xrdp from source to get the latest xrdp version installed (need as firewall has issue with the Ubuntu repo version). Do I just do that and then change .xession and /etc/xrdp/startwm.sh to xfce4-session? Not as straightforward it seems after I had a look at those files.

    The reason for switching to XFCE4 is due to performance issues with Unity. I see a black box around the cursor and the keyboard arrow keys (up, down,left,right) doesn’t work. I have a test VM so I can test recommendations if you have any,.

    Kind regards,
    Francis

  48. @Francis;

    The script is possibly out dated and you should always check for the latest version of the script (see https://www.c-nergy.be/products.html to get a list of the version of the scripts)
    You should try the latest version of the script (xrdp-installer-1.1.sh) which replace all previous version of the script…

    If you want to use xfce instead of Unity, you would need to perform the following

    step 0 – install xfce
    sudo apt-get update
    sudo apt-get install xfce4

    Step 1 – Run the script as described in the HowTo Guide

    Step 2 – Update the /etc/startwm.sh file
    You will need remove the lines added in the startwm.sh config file
    Anything after the line of text #Unity Xrdp multi-users should be removed

    Step 4 – tell xrdp that you want to use xfce session
    echo xfce4-session >~/.xsession (-> this is for one user only…The user that will have the file located in his profile)

    If you need to have the file created automatically for any users that would use xrdp,
    update the /etc/startwm.sh file and add at the bottom the following line
    echo xfce4-session >~/.xsession

    Final comment : if xfce is not good enough for you, you can then try with mate desktop (and the process would be similar to the one explained above 🙂

    Reboot and give it a try

    Hope this help
    Till next time
    See ya

  49. After run install-xrdp-1.9.2.sh, the local machine(ThinkPad E450) cannot login after reboot, prompt low-graphics mode, the mouse and keyboard can not use.

    Step1. sudo apt-get -y install xserver-xorg-input-all
    Result: Still prompt low-graphics mode after reboot

    Step2. sudo cp /etc/X11/xorg.conf.failsafe /etc/X11/xorg.conf
    Result: Still prompt low-graphics mode after reboot

    Step3: sudo apt-get install –reinstall unity-greeter
    sudo dpkg-reconfigure lightdm
    Result: After reboot, System is OK and the login screen is back.

Leave a Reply