xRDP – How to Install on Linux Mint – Part II

 

Hello World, 

In the previous post related to xRDP and Linux Mint, we have quickly described how to perform a basic installation of the xRDP software and how to configure it so you can use to remote connect to the Cinnamon Desktop interface.  However, the xrdp package that ship with Linux Mint 18.1 is not the most recent one.  Indeed, Linux Mint 18.1 is basically using the Ubuntu 16.04 repository for the packages to be used.

Since Ubuntu 16.10, the package repository has been updated and the newer version of xRDP package is available (version 0.9.0).  This new version of the package brings most requested features which are drive redirection and clipboard functionality.

In this post, we will provide you a simple way to perform the installation of xrdp 0.9.0 on a Linux Mint 18.1 machine.

Let’s go ! 

Custom Installation Script (version 1.7.1)

The xrdp package version 0.9.0 is available in the Ubuntu 16.10 repository. However, if you try to perform an installation using this xrdp package, this would not be working (out of the box) because you would probably lack needed dependencies.  To overcome this situation, we have updated our custom installation script and tuned it for Linux Mint.

Assumptions

Before running this script, be aware of the following assumptions

  • We have tested the script on Linux Mint 18.1 (and only this version)
  • No alternative desktop interface will be needed.  You will be connected to your Cinnamon (software redenring) Desktop after xrdp package is installed.
  • We have performed the test on a Virtual Machine running on Hyper-V Server and Virtualbox
  • Your virtual machine is connected to Internet (so you can download the necessary packages for the installation to occur). If you are not connected to internet, you can still manually download the xrdp package and modify the script accordingly

The script version 1.7.1

Below, you can see the script that can be used to install and configure xRDP package on the Linux Mint 18.1 systems.  We provide the script here so you can see what actions would be performed on your system

The script can be downloaded. A link has been made available at the end of this post  

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.

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

 

################################################################
# Script_Name : xrdp-install.sh
# Description : Perform an automated custom installation of xrdp
# on Linux Mint 18.1 when systemd is used
# Date : December 2016
# written by : Griffon
# Web Site :http://www.c-nergy.be - http://www.c-nergy.be/blog
# Version : 1.7.1
#
# 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 automake

#Install git 
echo "Installing git software..."
sudo apt-get -y install git 

##################################################################
#Step 2 - Obtain xrdp packages and xorgxrdp 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

#move to xorgxrdp folder and download needed packages
cd xrdp
git clone https://github.com/neutrinolabs/xorgxrdp.git

##################################################################
#Step 3 - Add/Remove Ubuntu xrdp packages (used to create startup service)
################################################################## 

echo "Add/Remove xrdp packages..."
echo "---------------------------"
sudo apt-get -y install xrdp
sudo apt-get -y remove xrdp

##################################################################
#Step 4 - compiling xrdp packages
################################################################## 

#Compile and make xrdp

echo "Installing and compiling xrdp..."
echo "--------------------------------"

# needed because libtool not found in Ubuntu 15.04 and later
# Need to use libtoolize

sudo sed -i.bak 's/which libtool/which libtoolize/g' bootstrap

sudo ./bootstrap
sudo ./configure --enable-fuse --enable-jpeg
sudo make
sudo make install

##################################################################
#Step 5 - compiling xorgxrdp packages
################################################################## 

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

##################################################################
#Step - Final Post Setup configuration
################################################################## 

echo "---------------------------"
echo "Post Setup Configuration..."
echo "---------------------------"

echo "Set Default xVnc-Sesman"
echo "-----------------------"

sudo sed -i.bak '/\[X11rdp\]/i [xrdp0]\nname=Sesman-Griffon \nlib=libxup.so \nusername=ask \npassword=ask \nip=127.0.0.1 \nport=-1 \ncode=20 \n' /etc/xrdp/xrdp.ini

echo "Symbolic links for xrdp"
echo "-----------------------"

sudo mv /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.backup
sudo ln -s /etc/X11/Xsession /etc/xrdp/startwm.sh
sudo mkdir /usr/share/doc/xrdp
sudo cp /etc/xrdp/rsakeys.ini /usr/share/doc/xrdp/rsakeys.ini

## Needed in order to have systemd working properly with xrdp
echo "-----------------------"
echo "Modify xrdp.service "
echo "-----------------------"

#Comment the EnvironmentFile - Ubuntu does not have sysconfig folder
sudo sed -i.bak 's/EnvironmentFile/#EnvironmentFile/g' /lib/systemd/system/xrdp.service

#Replace /sbin/xrdp with /sbin/local/xrdp as this is the correct location
sudo sed -i.bak 's/sbin\/xrdp/local\/sbin\/xrdp/g' /lib/systemd/system/xrdp.service
echo "-----------------------"
echo "Modify xrdp-sesman.service "
echo "-----------------------"

#Comment the EnvironmentFile - Ubuntu does not have sysconfig folder
sudo sed -i.bak 's/EnvironmentFile/#EnvironmentFile/g' /lib/systemd/system/xrdp-sesman.service

#Replace /sbin/xrdp with /sbin/local/xrdp as this is the correct location
sudo sed -i.bak 's/sbin\/xrdp/local\/sbin\/xrdp/g' /lib/systemd/system/xrdp-sesman.service

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

# Set keyboard layout in xrdp sessions
cd /etc/xrdp 
test=$(setxkbmap -query | awk -F":" '/layout/ {print $2}') 
echo "your current keyboard layout is.." $test
setxkbmap -layout $test
sudo cp /etc/xrdp/km-0409.ini /etc/xrdp/km-0409.ini.bak
sudo xrdp-genkeymap km-0409.ini

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


How to use this Script (version 1.7.1)

We will not repeat what has been already explained in our previous posts.  We provide here a quick explanation on how to use the script and run it. 

You first need to grab a copy of this script.  To avoid formatting issues, we have made the script available for download.  The download link is available at the end of this post.  

Then you have to mark the script as executable.  You can do this using the command line  by issuing the following command  chmod +x  ~/Downloads/xrdp-install-1-7.1.sh (adapt the path to reflect path location)

To execute the script, simply open your terminal console, navigate to the folder where the file is located and issue the following command

sudo ./xrdp-install-1-7.1.sh

As mentioned before,  we assume that you have internet connection and you will be able to download all the necessary packages needed to perform this configuration.

Note : The script will download the necessary files under the ~/Download folders.

Wait for completion of the script.  The machine will reboot automatically when done.  The operation can take up to 30 minutes to complete

Testing it ! 

At this stage, you can open your remote desktop client and make a connection to your Linux Mint 18.1 computer.  The xRDP login page will be presented to you and you should see as default choice the Sesman-Griffon option selected. Do not change this setting.

xrdp_Mint_10

Click on Picture for Better Resolution

Provide your credentials and Press OK

After some time, you should your cinnamon desktop interface displayed through the remote desktop connection 

xrdp_Mint_11

Click on Picture for Better Resolution

You are done 

Download Script

For your convenience, we are providing a downloadable version of the script. You can find it here

Final Notes

The 2 part post about Linux Mint 18.1 and xRDP is completed.  If you follow these simple instructions, you should be able to perform a remote desktop connection to your Cinnamon Desktop environment.  In the part I, we have been using the official Ubuntu package but which is also a little bit outdated. In Part II, we have been using the latest version of the xrdp package and provided an updated script that can automate and simplify the installation.

We prefer the custom installation because it uses the latest version of the xrdp package, does not rely on any vnc server software anymore and provide drive redirection as well 

Hope this info we will valuable for some of you 

Till next time 

See ya

 

 

21 thoughts on “xRDP – How to Install on Linux Mint – Part II

  1. Many thanks for your continued efforts with xrdp!
    I have been trying to get xrdp 0.9.0 working on my virtual machine with no success.
    Today I tried using your script too with the same results.
    I am at a loss on why my Linux Mint 18.1 refuses to play nicely with the latest xrdp with any xorgxrdp, x11rdp or vncserver.

    [20170124-17:28:38] [DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
    [20170124-17:28:39] [INFO ] xrdp_wm_log_msg: sesman connect ok
    [20170124-17:28:39] [DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait..
    .
    [20170124-17:28:39] [DEBUG] return value from xrdp_mm_connect 0
    [20170124-17:28:39] [INFO ] xrdp_wm_log_msg: login successful for display 11
    [20170124-17:28:39] [DEBUG] xrdp_wm_log_msg: started connecting
    [20170124-17:28:42] [DEBUG] Closed socket 19 (AF_UNIX)
    [20170124-17:28:46] [DEBUG] Closed socket 19 (AF_UNIX)

    Snip repeated messages

    [20170124-17:32:00] [DEBUG] Closed socket 19 (AF_UNIX)
    [20170124-17:32:03] [DEBUG] Closed socket 19 (AF_UNIX)
    [20170124-17:32:07] [DEBUG] Closed socket 19 (AF_UNIX)
    [20170124-17:32:10] [DEBUG] xrdp_wm_log_msg: connection problem, giving up
    [20170124-17:32:10] [DEBUG] Closed socket 19 (AF_UNIX)
    [20170124-17:32:10] [DEBUG] xrdp_wm_log_msg: some problem
    [20170124-17:32:10] [DEBUG] xrdp_mm_module_cleanup
    [20170124-17:32:10] [DEBUG] Closed socket 18 (AF_INET 127.0.0.1:50558)

    I am at a loss on what is causing it to fail (my VM virtual drive is restored to its original state from a snap shot after every failed install).

    Shooting in the dark here, but could this have anything to do with KVM and its networking as XEN users do not appear to encounter problems?


    # ifconfig
    enp2s1 Link encap:Ethernet HWaddr **:**:**:**:**:**
    inet addr:10.0.0.61 Bcast:10.0.0.255 Mask:255.255.255.0

  2. @DeadPan110,

    Interesting issue you are having there ? At the moment, Do not have an idea, I would need to check my installation and my logs files to see what’s happening…..

    I do not thing that the KVM hypervisor would cause the problem….If you have basic network connectivity to your Virtual machine (you can ping) and your firewall is allowing xRDP traffic, the xrdp functionality should be working just fine. My understanding is that you have run the script on different Virtual machines and it works. Right ? So, the script should be working fine. You could try to run part of the script from your command line and see if there any errors thrown at you…(missing dependencies,…) on the problematic machine

    Please confirm that you can have the xrdp solution working if you are using another hypervisor that kvm
    On kvm hypervisor, try to run the script, line by line in your command prompt to be sure that no errors are thrown at you
    Do no install any vnc server package and ensure that you select the correct sesman in the login
    Let’s check again the xrdp logs and compared them to logs on a working machine, is there any hints that could help us to find a solution for that

    Hope this help
    Keep me in the loop if you find something new… I will try to make some test about that….(when time permit)

    Till next time
    See ya

  3. I have it working!
    PEBKAC – I must remember to label my virtual machines and virtual drives better in the future (doh)!!
    I was using my Linux Mint (Mate) install and NOT my Linux Mint (Cinnamon) one.
    The performance seems really good with xorgxrdp – just what I was hoping (many thanks)!!
    One quick question:
    Is it possible to have sound working with xorgxrdp as I can remember doing it a long while back with X11rdp?
    Thanks again 🙂

  4. @Deadpan110,

    Good to hear that the post helped you and you finally were able to have xrdp working on a real Linux Mint OS 🙂
    xrdp latest version seems indeed to bring some improvements…..let’s keep an eye on it….

    Thank you for the feedback…

    Till next time
    See ya

  5. I have sound working!!!
    It had been a while since I have done this and for some reason I thought it was part of x11rdp but instead it is within xrdp/sesman/chansrv/pulse
    Using the instructions located at:
    https://github.com/neutrinolabs/xrdp/wiki/Audio-Output-Virtual-Channel-support-in-xrdp
    and:
    https://github.com/neutrinolabs/xrdp/blob/devel/sesman/chansrv/pulse/pulse-notes.ubuntu.txt
    I installed the module-xrdp-sink.so and module-xrdp-source.so into /usr/lib/pulse-8.0/modules directory (there is no lib64 as mentioned in the instructions) then edited /etc/pulse/default.pa
    After a quick reboot, sound was working on my local RDP client!

  6. @DeadPan110,

    Thank you very much for the useful input about xrdp and sound feature…. We will try (when time permits) try to wrap this up as well and mention your contribution….;-)
    I’m really please to see that xrdp is getting better and better with time
    Again thank you for the positive comments and input you are providing….

    Keep in touch
    Till Next Time
    See ya

  7. Thanks for the great effort.
    I literally spent more than a week to make X11rdp-O-Matic to work on Mint 18.1 mate with no success.
    Then I ran into your script and could make it work on Mint18.1 mate desktop environment with minor modifications.

    Basically I had to comment out the following two lines in your script

    sudo mv /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.backup
    sudo ln -s /etc/X11/Xsession /etc/xrdp/startwm.sh

    meaning, xrdp supplied startwm.sh should be remain untouched.

    Also had to create .xsession file in the user home directory with mate-session as its content.
    There maybe a way to make this change system wide. Unfortunetly, I don’t know how to do it. 8-(

    With these modifications, I could successfully installed xrdp+xorgxrdp on 3 headless (that’s why I desperately need xrdp support) Mint 18.1 mate desktop.

    Performance seems to be just a little bit slower than that of x11rdp. I can live with that.

    Cheers.

  8. @Sang Ju Park,

    Thank you for your visit and the feedback….You are totally right.. These lines below should have been commented (this came from previous version of the script and there is no need to perform this change anymore….)

    sudo mv /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.backup
    sudo ln -s /etc/X11/Xsession /etc/xrdp/startwm.sh

    If you want to use mate-desktop, you have two options indeed
    option 1 – You can to create for each user the ~/.xsession file and append the mate-session (cfr old post for more information that http://c-nergy.be/blog/?p=5382)
    Option 2 – you can modify the /etc/xrdp/startwm.sh and append at the bottom of the file the mate-session command so this setting would apply system wide (for more details, check the following post http://c-nergy.be/blog/?p=10165)

    As soon as I have a little bit of time, I will update the post and take into account your remarks

    Thank again

    Till next time
    See ya

  9. I have created a PPA with the latest version 0.9.1 of xrdp and xorgxrdp for Xenial and Mint 18 and 18.1

    To install the packages from the PPA do:

    sudo add-apt-repository ppa:hermlnx/xrdp
    sudo apt-get update
    sudo apt-get install xrdp xorgxrdp

  10. @herminx,

    Thank you for the info…and for the work provided. When time permits, we will test it and possibly update our post to mention your packages….
    This is really cool to see that people are sharing their work and knowledge….

    Till next time
    See ya

  11. Hi’

    Thanks for some great posts, with a lot of nice tips, when it comes to rdp and vnc 🙂

    @Sang Ju Park did send me a mail, and i finally find some time, to trying this out. Until now, i used TigerVNC combined with XRDP.

    I just tested the script on 18.1 with MATE-desktop and it looks like it fails with `cd xrdp/` – Cause i got two folders in Download: “xrdp” and “xorgxrdp”. Can’t say what is going wrong, but maybe the `cd ~/Downloads/xrdp/` will work out.

    I run through the script, typing all the lines (echo excluded of course…), and it WORKS – but i did also add mate-session to .xsession file in the home directory, cause i need the same setup as Sang using.

    I got some errors after running `sudo make` in step 4 (xrdp). But it looks like the xrp libs was installed just fine. Take a look at http://pastebin.com/HMi0rt9B – I just commented out the two lines, and removed “/” from the cd xrdp command (But i can’t tell any difference…)

    PROLEMS WITH KEYBOARD LAYOUT?
    As a sidenote for all other visitors trying to run the script within a SSH CLIENT connected to the target machine, the LAST LINES WON’T WORK, cause of setxkbmap won’t return the current used keyboard layout.

    Cant’ currently say anything about the performance, compared to the solution with TigerVNC. I will try looking into the performance-part – I did make full backup of the old VM in ESXi 🙂

  12. Sorry for the double-posts! You’re welcome to merge them @Griffon.

    As a tip – if you like me, don’t need any X running on the host machine, but only need it when connecting to the RDP-protocol. Here’s how to disable it (Tested just fine on Linux Mint 18.1)

    ## Disable X autostartup as host-machine (Linux Mint 18.1)
    `sudo nano /etc/default/grub`

    Find this line:
    `GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”`

    Change it to:
    `GRUB_CMDLINE_LINUX_DEFAULT=”text”`

    Update GRUB:
    `sudo update-grub`

    You ALSO need to tell systemd to not load the graphical login manager:
    “`
    sudo systemctl enable multi-user.target –force
    sudo systemctl set-default multi-user.target
    “`

    You will still be able to use X by typing `startx` after you logged in to your host machine.

  13. @Tobias,

    Thank you for the feedback and sharing info with us…
    Some comments from our side…..

    The cd xrdp/ was a typo and we have corrected it…

    The point of the post was to show that you would not need to install any additional desktop environment while using xrdp….
    If you use xrdp with tigervnc or the xrdp server compoment, no need to have MATE Desktop installed…. This is why in the
    script/post we do not modify .xsession file or startwm.sh file….. If you really want to use mate-desktop, then you can install it if you want to….

    The Keyboard layout issue => actually, this is a good point. We usually specify that this command needs to be run locally on the machine and not through xrdp or now ssh…..
    We will try to update the post and take into account these information

    Till next time
    See ya

  14. Question!

    XRDP works fine.

    Keyboard Language in XRDP-Session is German – OK
    System + Application Language in XRDP-Session is English ! – PROBLEM

    If I am logged in directly at the XRDP-Server (same User) all Applications+System are in German.
    The Location Settings Program in the XRDP-Session won’t start. (without message)

  15. @Thomas,

    Thank you for the information..I do not think I will have time to investigate this one..Based on the comments we have received, someone has made a xrdp 0.9 package available for Linux Mint. You might want to give it a try as well and see if this could fix your issues

    Till next time
    See ya

  16. Thank you for all your fine work and sharing. Installed both I and II. Got me farther than before. Can log in now but only see a blank blue screen. Appreciate any suggestions.

    Thanks again.

  17. @Fred,

    Ok, we have seen that time to time…can you have a look at the logs files and see if there is any hints over there….
    never really identified the root cause of such behavior…
    Please note also that the xrdp software has been updated quite heavily in the past few weeks/months so we might need to update our scripts and process to take that into account

    Hope this help
    Till next time
    See ya

  18. I tried the script above and it works on Mint Mate 18.1 but logout does not. It duplicates the icons on the panel and stays logged in. I tried the -once parameter but to no avail. Any ideas?

  19. @Edgar,

    When we did our tests, we didn’t encountered such issue.. The logout functionality seemed to work…XRDP software seems to have time to time difficulties to reproduce all functionalities of a Desktop Environment. The logout function seems not to work on gnome or unity as well….

    You could try to use this code and create a shortcut “logout” button and see if this is an acceptable workaround
    ps -ef h | grep Xvnc | grep `whoami` | tr -s ” ” | cut -d ” ” -f2 | xargs kill -9

    Hope this help
    Till next time
    See ya

Leave a Reply