xRDP – Custom Installation Script for Ubuntu 18.xx – version 2.4

Hello World, 

 !! Custom Script version fixing  issue in Ubuntu 18.04.2 !!

 

As you probably know by now, there is a small issue with xrdp packages and Ubuntu 18.04.2.  Ubuntu 18.04.2 ship with a new xserver-xorg-core-hwe-18.04 package which breaks the installation of the xRDP and more specifically the xorgxrdp package.  The xorgxrdp package does not get installed because of some missing dependencies.  In our previous posts, we have already explained the issues and how to overcome the situation.   For more information about this issue and possible solutions, please have a look at the following posts 

This post revisit the custom installation script (version 2.3) and introduce a small change.  The version 2.3 of the script would fix the issue by downgrading to xserver-xorg-core package and ensure that necessary package for input are installed back.  This was basically the quick and dirty fix

A better solution would be to compile xrdp and xorgxrdp packages using the proper xserver-xorg-core packages installed on the Ubuntu computer.   This post basically update the custom script to include the logic to detect which xserver-xorg-core package is installed which provide a cleaner and better approach.  

The script version has been set to 2.4 because this is really a minor change but still important enough to update the script version…  The next version of the custom installation script will be probably set to 3.0 because some important changes will be made….

So, let’s do this…. 

Note :  Please always check this page, to get the latest version of the script

Custom Install Script Updated

The script version 2.3 provides a quick and dirty workaround that restore the xRDP functionality on Ubuntu 18.04.2.  The quick solution basically consists of downgrading to the previous xserver-xorg-core package.   This is a working solution. However, we do not know what would be the impact of Ubuntu updates on the downgraded package.  Will it be removed and replaced again by the newer package ?  Downgrading packages also remove a bunch of packages that might be needed by the user…  To avoid such situation and to basically provide a more appropriate solution, we have slightly modified the custom installation script in order to compile xrdp and xorgxrdp packages against the proper package. 

The updated script simply introduce the logic to detect which xserver-xorg-core package is available on the system. Based on this, the script will compile the xrdp and xorgxrdp packages using the detected xserver-xorg-core package installed on the system. 

Pre-reqs and assumptions

We assume that you have internet connection available and that you are indeed running one of the following version of Ubuntu 

  • Ubuntu 18.04 (up to Ubuntu 18.04.2)
  • Ubuntu 18.10 

The Script version 2.4

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

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

#!/bin/bash
#####################################################################################################
# Script_Name : install-xrdp-2.4.sh
# Description : Perform a custom installation of xrdp
# on ubuntu 18.04 and later
# Date : April 2019
# written by : Griffon
# Web Site :http://www.c-nergy.be - http://www.c-nergy.be/blog
# Version : 2.4
# History : 2.4 - Proper fix for U18.04.2 when xserver-xorg-core-hwe-18.04
# changed code to detect which package in use and perform most appropriate compilation 
# : 2.3 - Quick Fix Ubuntu 18.04.2 issue when xserver-xorg-core-hwe-18.04 installed
# : 2.2 - Add Support for Ubuntu 18.10 and Yaru Theme
# : 2.1 - Add logic to enable sound redirection for U18.04
# - re-write code logic to include functions
# - Removed support for Ubuntu 17.10 as reached end of support
# : 2.0 - Initial Version for Ubuntu system with Gnome Desktop
# : 1.x - Script for Ubuntu 16.04 or later 
# Disclaimer : Script provided AS IS. Use it at your own risk....
####################################################################################################

#---------------------------------------------------#
# Detecting if Parameters passed to script .... 
#---------------------------------------------------#

while getopts g:s: option 
do 
case "${option}" 
in 
g) fixGDM=${OPTARG};; 
s) fixSound=${OPTARG};; 
esac 
done

#---------------------------------------------------#
# Script Version information Displayed              #
#---------------------------------------------------#

echo
/bin/echo -e "\e[1;36m !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m ! Custom XRDP Installation Script - Ver 2.4 !\e[0m"
/bin/echo -e "\e[1;36m ! Written by Griffon - April 2019 - www.c-nergy.be !\e[0m"
/bin/echo -e "\e[1;36m !-------------------------------------------------------------!\e[0m"
echo

#--------------------------------------------------------------------------#
# -----------------------Function Section - DO NOT MODIFY -----------------#
#--------------------------------------------------------------------------#

#---------------------------------------------------#
# Function 1 - Install Prereqs... 
#---------------------------------------------------#

install_prereqs() {

echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Installing PreReqs packages..Proceeding. ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo
/bin/echo -e "\e[1;33m |-| Detecting xserver-xorg-core package installed \e[0m"

xorgver=$(dpkg-query -W -f ='${Status}\n' xserver-xorg-core | awk {'print $3'})

if [[ "$xorgver" = *not-installed* ]];  
then
# - hwe 18.04 is installed
/bin/echo -e "\e[1;32m       |-| xorg package version: xserver-xorg-core-hwe-18.04 \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-hwe-18.04 fuse pkg-config git intltool xserver-xorg-core-hwe-18.04
else
/bin/echo -e "\e[1;32m       |-| xorg package version: xserver-xorg-core \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 git intltool xserver-xorg-core
fi
}

#---------------------------------------------------#
# Function 2 - Download XRDP Binaries... 
#---------------------------------------------------#
get_binaries() {

echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Download xRDP Binaries.......Proceeding. ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

cd ~/Downloads

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

}

#---------------------------------------------------#
# Function 3 - compiling xrdp... 
#---------------------------------------------------#

compile_source() {

# -- Compiling xrdp package first

echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Compile xRDP packages .......Proceeding. ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\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 
/bin/echo -e "\e[1;33m |-| Make Operation Completed successfully \e[0m"

else 
echo
echo
/bin/echo -e "\e[1;31m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;31m ! Error while Executing make !\e[0m"
/bin/echo -e "\e[1;31m ! The Script is exiting.... !\e[0m"
/bin/echo -e "\e[1;31m !---------------------------------------------!\e[0m"
exit
fi
sudo make install

echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Compile xorgxrdp packages....Proceeding. ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\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;33m |-| Make Operation Completed successfully \e[0m"
echo
else 
echo
/bin/echo -e "\e[1;31m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;31m ! Error while Executing make !\e[0m"
/bin/echo -e "\e[1;31m ! The Script is exiting.... !\e[0m"
/bin/echo -e "\e[1;31m !---------------------------------------------!\e[0m"
exit
fi
sudo make install

}

#---------------------------------------------------#
# Function 5 - create services .... 
#---------------------------------------------------#

enable_service() {
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Creating xRDP services.......Proceeding. ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

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

}

#---------------------------------------------------#
# Function 6 - Install Gnome Tweak Tool.... 
#---------------------------------------------------#

install_tweak() 
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Installing Gnome Tweak...Proceeding... ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo
sudo apt-get install gnome-tweak-tool -y
}

#--------------------------------------------------------------------#
# Fucntion 7 - Allow console Access ....(seems optional in u18.04)
#--------------------------------------------------------------------#

allow_console() 
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Granting Console Access...Proceeding... ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo
sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
}

#---------------------------------------------------#
# Function 8 - create policies exceptions .... 
#---------------------------------------------------#

create_polkit()
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Creating Polkit File...Proceeding... ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

sudo bash -c "cat >/etc/polkit-1/localauthority/50-local.d/45-allow.colord.pkla" <<EOF
[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF

}

#---------------------------------------------------#
# Function 9 - Fixing Theme and Extensions .... 
#---------------------------------------------------#

fix_theme()
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Fix Theme and extensions...Proceeding...    !\e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

#Check if script has already run.... 
if grep -xq "#fixGDM-by-Griffon" /etc/xrdp/startwm.sh; then
echo "Skip theme fixing as script has run at least once..."
else
#Set xRDP session Theme to Ambiance and Icon to Humanity if Ubuntu 18.04.x
if [[ "$version" = *"Ubuntu 18.04"* ]];
then
sudo sed -i.bak "4 a #fixGDM-by-Griffon\ngnome-shell-extension-tool -e ubuntu-appindicators@ubuntu.com\ngnome-shell-extension-tool -e ubuntu-dock@ubuntu.com\n\nif [ -f ~/.xrdp-fix-theme.txt ]; then\necho 'no action required'\nelse\ngsettings set org.gnome.desktop.interface gtk-theme 'Ambiance'\ngsettings set org.gnome.desktop.interface icon-theme 'Humanity'\necho 'check file for xrdp theme fix' >~/.xrdp-fix-theme.txt\nfi\n" /etc/xrdp/startwm.sh
#Set xRDP session Theme to Yaru and Icon to Suru if Ubuntu 18.10.x
elif [[ "$version" = *"Ubuntu 18.10"* ]];
then
sudo sed -i.bak "4 a #fixGDM-by-Griffon\ngnome-shell-extension-tool -e ubuntu-appindicators@ubuntu.com\ngnome-shell-extension-tool -e ubuntu-dock@ubuntu.com\n\nif [ -f ~/.xrdp-fix-theme.txt ]; then\necho 'no action required'\nelse\ngsettings set org.gnome.desktop.interface gtk-theme 'Yaru'\ngsettings set org.gnome.desktop.interface icon-theme 'Yaru'\necho 'check file for xrdp theme fix' >~/.xrdp-fix-theme.txt\nfi\n" /etc/xrdp/startwm.sh
else 
echo "Error Occured somewhere...Exiting..."
exit
fi

fi
echo
}


#---------------------------------------------------#
# Function 10 - Fixing GDM - As an Option .... 
#---------------------------------------------------#
fix_gdm()
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Fix for GDM Lock Screen color...            !\e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo
# Step 1 - Install prereqs for compilation later on
sudo apt-get -y install libglib2.0-dev-bin
sudo apt-get -y install libxml2-utils

# extract gresource info (from url...)
workdir=${HOME}/shell-theme
if [ ! -d ${workdir}/theme ]; then
mkdir -p ${workdir}/theme
mkdir -p ${workdir}/theme/icons

fi
gst=/usr/share/gnome-shell/gnome-shell-theme.gresource

for r in `gresource list $gst`; do
gresource extract $gst $r >$workdir/${r#\/org\/gnome\/shell/}
done

/bin/echo -e "\e[1;33m |-| Creating XML File... \e[0m"
# create the xml file 
bash -c "cat >${workdir}/theme/gnome-shell-theme.gresource.xml" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/shell/theme">
<file>calendar-arrow-left.svg</file>
<file>calendar-arrow-right.svg</file>
<file>calendar-today.svg</file>
<file>checkbox-focused.svg</file>
<file>checkbox-off-focused.svg</file>
<file>checkbox-off.svg</file>
<file>checkbox.svg</file>
<file>close-window.svg</file>
<file>corner-ripple-ltr.png</file>
<file>corner-ripple-rtl.png</file>
<file>dash-placeholder.svg</file>
<file>gnome-shell.css</file>
<file>gnome-shell-high-contrast.css</file>
<file>no-events.svg</file>
<file>no-notifications.svg</file>
<file>noise-texture.png</file>
<file>page-indicator-active.svg</file>
<file>page-indicator-inactive.svg</file>
<file>page-indicator-checked.svg</file>
<file>page-indicator-hover.svg</file>
<file>process-working.svg</file>
<file>toggle-off-us.svg</file>
<file>toggle-off-intl.svg</file>
<file>toggle-on-hc.svg</file>
<file>toggle-on-us.svg</file>
<file>toggle-on-intl.svg</file>
</gresource>
</gresources>
EOF
cd ${workdir}/theme
/bin/echo -e "\e[1;33m |-| Modify Css... \e[0m"
sed -i -e 's/background: #2e3436/background: #2c00e1/g' ~/shell-theme/theme/gnome-shell.css

##Delete the file noise-texture.png (grey one)
rm ${workdir}/theme/noise-texture.png

/bin/echo -e "\e[1;33m |-| Download Purple image file... \e[0m"
#Download the noise-texture.png with purple background 
wget http://www.c-nergy.be/downloads/noise-texture.png

/bin/echo -e "\e[1;33m |-| Compile Resource File... \e[0m"
#Compile file and copy to correct location....
cd ${workdir}/theme
glib-compile-resources gnome-shell-theme.gresource.xml

/bin/echo -e "\e[1;33m |-| Copy file to target location... \e[0m"

# make a backup of the file and copy the file....
sudo cp /usr/share/gnome-shell/gnome-shell-theme.gresource /usr/share/gnome-shell/gnome-shell-theme.gresource.bak
sudo cp ${workdir}/theme/gnome-shell-theme.gresource /usr/share/gnome-shell/gnome-shell-theme.gresource
echo
}

#---------------------------------------------------#
# Function 11 - Enable Sound Redirection .... 
#---------------------------------------------------#

enable_sound()
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Enabling Sound Redirection...               !\e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

# Step 1 - Install xrdp-pulseaudio-installer package
sudo apt-get install xrdp-pulseaudio-installer -y

# Step 2 - Enable Source Code Repository
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename' main restricted'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename' restricted universe main multiverse'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename'-updates restricted universe main multiverse'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename'-backports main restricted universe multiverse'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename'-security main restricted universe main multiverse'
sudo apt-get update

# Step 3 - Download pulseaudio source in /tmp directory
cd /tmp
sudo apt source pulseaudio

# Step 4 - Compile
pulsever=$(pulseaudio --version | awk '{print $2}')

cd /tmp/pulseaudio-$pulsever
sudo ./configure

# Step 5 - Create xrdp sound modules

cd /usr/src/xrdp-pulseaudio-installer
sudo make PULSE_DIR="/tmp/pulseaudio-$pulsever"

# Step 6 - copy files to correct location

sudo install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so
sudo install -t "/usr/lib/pulse-$pulsever/modules" -D -m 644 *.so
echo

}

#--------------------------------------------------------------------------#
# -----------------------END Function Section -----------------#
#--------------------------------------------------------------------------#


#--------------------------------------------------------------------------#
#------------ MAIN SCRIPT SECTION -------------------# 
#--------------------------------------------------------------------------#

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

version=$(lsb_release -sd) 
codename=$(lsb_release -sc)

echo
/bin/echo -e "\e[1;33m |-| Detecting Ubuntu version \e[0m"

if [[ "$version" = *"Ubuntu 18.04"* ]];
then
/bin/echo -e "\e[1;32m |-| Ubuntu Version : $version\e[0m"
echo
elif [[ "$version" = *"Ubuntu 18.10"* ]];
then
/bin/echo -e "\e[1;32m |-| Ubuntu Version : $version\e[0m"
echo
else
/bin/echo -e "\e[1;31m !------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;31m ! Your system is not running Ubuntu 18.04 Edition and later  !\e[0m"
/bin/echo -e "\e[1;31m ! The script has been tested only on Ubuntu 18.04 and later  !\e[0m"
/bin/echo -e "\e[1;31m ! The script is exiting...                                   !\e[0m" 
/bin/echo -e "\e[1;31m !------------------------------------------------------------!\e[0m"
echo
exit
fi


/bin/echo -e "\e[1;33m |-| Detecting Parameters \e[0m"


#Detect if argument passed
if [ "$fixSound" = "yes" ]; 
then 
/bin/echo -e "\e[1;32m |-| Sound Redirection Option...: [YES]\e[0m"
else
/bin/echo -e "\e[1;32m |-| Sound Redirection Option...: [NO]\e[0m"
fi

if [ "$fixGDM" = "yes" ]; 
then 
/bin/echo -e "\e[1;32m |-| gdm fix Option.............: [YES]\e[0m"
else
/bin/echo -e "\e[1;32m |-| gdm fix Option.............: [NO]\e[0m"
fi
echo

#---------------------------------------------------------#
# Step 1 - Executing the installation & config tasks .... #
#---------------------------------------------------------#

echo
/bin/echo -e "\e[1;36m !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m ! Installation Process starting....                           !\e[0m"
/bin/echo -e "\e[1;36m !-------------------------------------------------------------!\e[0m"
echo
/bin/echo -e "\e[1;33m |-| Proceed with installation..... \e[0m"
echo

install_prereqs
get_binaries
compile_source
enable_service
install_tweak
allow_console
create_polkit
fix_theme


if [ "$fixGDM" = "yes" ]; 
then 
fix_gdm
fi

if [ "$fixSound" = "yes" ]; 
then 
enable_sound
fi

#---------------------------------------------------#
# Step 2 - Credits .... 
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;36m !-----------------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m ! Installation Completed                                                !\e[0m"
/bin/echo -e "\e[1;36m ! Please test your xRDP configuration.A Reboot Might be required...     !\e[0m"
/bin/echo -e "\e[1;36m ! Written by Griffon - April 2019 - Ver 2.4 - Std-Xrdp-Install-2.4.sh   !\e[0m"
/bin/echo -e "\e[1;36m !-----------------------------------------------------------------------!\e[0m"
echo

How to Use the Script

The script usage has not changed since the previous version.  So, instead of repeating the same information, we will summarize the necessary actions and options that are available with this version of the script.

Step 1 – Set Execute Right on the script

Download the install-xrdp-2.4.sh script to your system.  You need to mark the script as executable . To do this, perform the following action in a terminal console

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

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

Step 2 – How to execute the script ? 

Like the previous version of the script, you can decide to execute the script with no parameters to perform a “standard installation” or pass some parameters to get more features implemented in your xrdp installation.  Before running it, ensure that internet connection is available (so you can download the necessary packages needed for the installation) 

Standard way

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 

 ./install-xrdp-2.4.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….

This installation mode will provide no fix for the GDM visual issue (see here) or  no sound redirection (see here).   At this stage, you will be able to perform a remote desktop connection and work against your Ubuntu machine. However, if at a later stage, you want to implement the additional features (GDM fix and Sound redirection), you could re-run the script and pass the parameters to enable the options selected.   The script will re-run and pass the new parameters and your system should be working with the additional features enabled. 

Advanced way

To enable additional features within your remote desktop session,  it’s possible to pass some parameters (in any orders) to the script.  The script support up to two parameters.  When running the script, a user can decide to enable fix for the GDM lock screen or enable sound redirection or enable both options.   The following paragraph explain which parameters can be used….

To implement the lock screen fix for GDM within the xrdp session, use this syntax

./install-xrdp-2.4.sh -g yes

As the script has been updated, when running, you should see the information displayed on your screen about your selected option and which version of Ubuntu you are running….

To implement the sound redirection fix  within the xrdp session, use this syntax

./install-xrdp-2.4.sh -s yes

To implement both  the sound redirection fix  and gdm lock screen fix within the xrdp session, use this syntax

./install-xrdp-2.4.sh -s yes -g yes 

When script execution is completed, the machine will not reboot so you can review the installation and detect possible elements that’s preventing the script execution.  At completion, it’s recommended to reboot the machine so the changes made to the system can be applied accordingly. 

Step 3 – Test your configuration 

After the script has run and after the reboot, first login locally on the machine and ensure that you can use keyboard and mouse. Then, logoff from the system and try to perform a remote connection.  If everything is ok, you should be able to access your desktop through remote desktop protocol 

Download the Script 

Please download the script :  install-xrdp-2.4.sh

Final Notes

This is it for this post !    We have provide the most up to date version of the custom installation script that can be used with Ubuntu 18.04.x and Ubuntu 18.10.  This version of the script should be used on any Ubuntu 18.xx version as it provides the cleanest way to perform a successful xrdp installation. This post has been published in a rush so if you have time to test it and provide feedback so we can update and fix any issues you might discover…. 

We are quite busy at work but we have already a lot of new things that are coming…Release of Ubuntu 19.04 will offer us the opportunity to release updated script with support of the latest version of Ubuntu Operating system…

So, time to prepare the new version of the script for Ubuntu 19.04…. 

That’s is for today 

Till next time 

 

18 thoughts on “xRDP – Custom Installation Script for Ubuntu 18.xx – version 2.4

  1. If you could add ceconnect to the “same” remote session to this script, it wold be awsome 🙂

  2. @Klopo,

    Euh, it’s already possible to reconnect to the same session out of the box… So, if you have performed a first remote connection and then disconnect from it. The next time you start again your connection you will go back where you left. If you had applications open, you will have them open when reconnecting…

    The only limitation is that you cannot connect locally on UBuntu and then take over this specific session in remote desktop. A specific user can connect to either local session or to remote session, not both at the same time

    Hope this clarify the process and provide enough information to answer your question
    Till next time
    See ya

  3. Hi Griffon,

    I have xrdp configured and working on my ubuntu. When I log in via the local network “LAN”, performance is great. but when I log in from outside (i.e. over the internet “WAN”), the performance degrades significantly, and becomes very choppy. My internet connection is good. I have 30Mbps of bandwidth to my server.

    I’m using Windows built-in Remote Desktop Client and Remmina to connect to my Ubuntu and I notice that if I change the color depth setting to connect to 16bit the performance is better on both clients, but is not the best experience because it still feels choppy. Do you know what can I do to have the best performance as possible when I try to connect via internet WAN?

    By the way. Thanks for the script works perfectly!

  4. Hello Griffon,
    thanks for all your effort to optimize the xRDP-installation script.
    Installation worked fine (with v2.4), but now I have an other issue: The client is thought to be used by a normal user (non-root-user): He/She should power-on the system (at the machine itself), insert a usb-flashdrive and than log-in via rdp to transfer data to the network. However, even though this non-root-user can perform the task when logged in directly (not remote), the very same user does not have the users’ rights to mount (or automount) the flashdrive over RDP – just as little as to shutdown or restart the system via RDP.
    Do you have an idea how to fix that? Or is that exactly one of the “drawback and limitations” you mention in your blog? Any idea would be appreciated.
    Thanks

  5. @Darwin,

    Seems to be a known issue. We have found some open issues about this topic….
    We will add in the next version of the script the option –rfxcodec when compiling the from source which should improve the performance. This might not fix the issue as it seems that some other people have the same behavior…
    You can also check that compression option has been enabled on the /etc/xrdp/xrd.ini file…

    Hope this help
    Till next time

  6. Hello Griffon,

    I check the xrdp.ini file on /etc/xrdp/xrdp.ini and I found enabled the following parameters:

    bitmap_cache=true
    bitmap_compression=true
    bulk_compression=true

    This is the only options that I have to enable?. Unfortunately the user experience was the same because it still feels choppy.

    Just to clarify. When you release the next script. What would happen with my installation? just run the new script and the new one take care of my previous installation or I have to uninstall first and then install the new one.

    Thanks again….

  7. @Darwin,

    Actually, that a really good question. What would happen when a new version of the script will be released. As the new version of the script is on its way, and because we have changed some part of the code, we would recommend to remove and re-install the xrdp (see this post for removing options – https://c-nergy.be/blog/?p=11454. The script is evolving and improving continuously. In the coming version of the script (probably to be seen when Ubuntu 20.04 will be out), new options will be available and we will try to include “an upgrade” process

    Till next time
    See ya

  8. This script has been a lifesaver! It’s kept my boss happy by providing him the “proper” Ubuntu environment!
    I have noticed the same “lagginess” that @Darwin has described. I’ve checked the xrdp.ini file and noted the same settings as Darwin did above. I appreciate you guys looking into this.
    Regards,
    Chris

  9. Error to launch the script :
    ./Install-xrdp-2.4.sh: ligne 124 : cd: /home/thalie/Downloads/xrdp: Aucun fichier ou dossier de ce type
    sudo: ./bootstrap : commande introuvable
    sudo: ./configure : commande introuvable
    make: *** Pas de cible spécifiée et aucun makefile n’a été trouvé. Arrêt.

    Error while Executing make !
    ! The Script is exiting….

  10. @Zant,

    Is your machine connected to internet ? you need to download the xrdp sources files first…this is why you need internet connectivity.
    Can you check that in your home directory that the xrdp folders is being created ?
    While the script is running, you should see on the screen information about downloading files ? do you see that ?

    Hope this help
    Till next time
    See ya

  11. @Chris,

    We will have a look indeed but this might be something we will not be able to fix and we might need to go back to xRDP team to see if any improvements could be made.
    We will start investigating and we will share our findings

    Thanks for the visit and positive feedback
    Till next time
    See ya

  12. Thanks for your work. I have succeeded at installing the script but the xdp-desktop was missing the docker. How to fix it?

  13. @Han,
    This can happen 1 out 1 million time that the docker is not showing up 🙂
    To fix it, you have to make your remote connection to your Ubuntu machine, then, you start the Gnome Tweaks utility > Go to Extension Node and ensure that the extensions for the docker are selected and enable…
    When this is done, you should be able to see the dock immediately (more info at this location https://c-nergy.be/blog/?p=12155)

    Hope this help
    Till next time
    See ya

  14. After Login with Session Xorg, show a black window then shutdown.
    where i need to configure?

  15. @Zane,
    Thank you for the feedback and the visit… we are happy to see that the collection of posts provided here was useful to you

    Till next time
    See ya

Leave a Reply