XRDP – How To Remote Connect to Unity Desktop on Ubuntu 16.04

Hello World,

Today, we will show you how you can use the xRDP software package and make a remote desktop connection into the Unity Desktop Environment. Yes ! You read it correctly, with this procedure, you will be able to access your Unity Desktop through Remote Desktop ! No need to install alternate Desktop such as xfce, Mate, LXDE,….

You still do not believe it ! Have a quick look at our previous post, we have demonstrated that it was possible to connect to the Unity Desktop using the xRDP Software solution.    Today, we will provide you the recipe we have used in order to make it happening…

Tons of people have been asking us if this was possible..Some time ago, we provided a dirty workaround (see this post : XRDP – How to connect to console or how to connect to Unity Desktop). Today, we are providing not a workaround but a viable solution to have users connect to their Unity Desktop

Before you are getting too excited, you have to know that the solution do have some limitations but the solution seems to be workable.  We will try to provide some tips to overcome the limitation we have detected….

Disclaimer : 

We didn’t perform extensive testing yet so you might find out that something does not work as expected.  We will not be liable for any errors,omissions,problems,damages…arising from using this information. All the information is provided AS-IS. Use this procedure at your own risk !  

Bring xRDP & Unity to the next Level

Assumptions

When we have performed our installation & testing, we have been using the following infrastructure

  • We have performed a Fresh installation of the Ubuntu 16.04.1 LTS Released
  • We have performed the installation on a Virtual Machine running on Hyper-V Server and Virtualbox

We are assuming that

  • Your Ubuntu 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 necessary packages from this blog and copy them to your Ubuntu machine
  • You have your Ubuntu machine installed,configured and have the latest patches installed…
  • Your Ubuntu computer is running 16.04.1

Note : This process might be working with Ubuntu 14.04 and later but we did not test it…

Installation Process 

Step 1 – Download TigerVNC Server package

In this installation process, this is really the tricky part.  We need to install the tigervnc software solution but there is no Ubuntu packages available for Ubuntu 16.04.  If you look on the official TigerVNC repository, you will see that there is no deb packages for Ubuntu 16.04.

You will need to either compile Tigervnc package on your own or find an existing debian package that can be used with Ubuntu 16.04.

Our Tigervnc deb package available for download 

For your convenience, we are providing you a Tigervnc debian package that we have been using for our test.  You can try to use this package but we cannot guarantee that this package would work for you. We will also not provide any support if the package is not working for you.  You can give it a try and see if it works….(use it at you own risk !)

Box-download-48Download Tigervnc Deb Package (for Ubuntu 16.04.1 – 64 bit)

 

Step 2 – Install the TigerVNC Server package

1 –  Open a Terminal console and move to your Download folders (or location where you have saved the packaged downloaded above)

cd Downloads

Click on picture for better Resolution

2 – In the terminal console, type the following

sudo dpkg -i tigervncserver_1.6.80-4_amd64.deb

You might see some warning and errors messages. Ignore these messages for the moment…

Click on picture for better Resolution

3 – To ensure that all the dependencies are installed, issue the following command in the Terminal console

sudo apt-get install -f

Click on picture for better Resolution

Step 3 -Install the xrdp package

1 –  Open a Terminal console and issue the following command

sudo apt-get install xrdp -y

You might be asked to provide a password (because you are using sudo command)

Click on picture for better Resolution

Step 5 – Configure the xrdp settings 

You need to specify which desktop to start while connected through xRDP session.  To perform this action, you would need to create and populate either the .xsession file (per user) or the /etc/startwm.sh (all users) with the proper configuration information (as described below)

1 –  Open a Terminal console and issue the following command (if you have only one user on your system)

echo unity>~/.xsession

or

sudo sed -i.bak '/fi/a #xrdp multi-users \n unity \n' /etc/xrdp/startwm.sh

Step 6 – Configure the xrdp keyboard Settings 

Note :  You need to perform this action on the local Ubuntu machine (and not through the xrdp connection !!)

By default, the xRDP login screen will use an en-us keyboard layout. You remote session will also be using the en-us keyboard layout.  If you are using a different keyboard layout than the english one, you need to perform the following actions in order to update the configuration of the xrdp software.

In my case, I’m using a Belgian French keyboard, so I had to tell xrdp to use the belgian french keyboard as well.  To do that, you need to perform the following actions :

1 : You go to the /etc/xrdp directory

2 : you issue the command setxkbmap -layout <%your layout%> to define which keyboard map/layout to use

Click on Picutre for better Resolution 

3 : create a copy of the km-0409.ini file into the same directory. It seems that this is the default file used by xrdp to define the keyboard layout. You will need to use sudo in order to be able to write into the directory

4 : Check that you have a backup of your file by typing the dir or ls command

5 : update the file by issuing the following command sudo xrdp-genkeymap km-0409.ini

Click on Picutre for better Resolution 

You can achieve the same results using the following command line script. In your terminal console; simply copy/paste this text and it will try to find out automatically your keyboard layout

# 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

Step 7 – Reconnect to the Same Session

Since Ubuntu 14.10, a new xrdp package has been made available in the Ubuntu repository. This package fixes a long time issue related to the fact that users could not reconnect to the same session.  If you are using the package xrdp 0.6.1-1 or later, you do not need to perform any customization, you will reconnect automatically to the same session.

Test your Setup & Connect to Unity 

To test your configuration, simply start your remote desktop client from a Windows machine, type in the hostname or ip address of the Ubuntu computer to connect to and try to connect.  If everything is working as expected, you should see first the xrdp login box

Click on picture for better Resolution

And then after providing the credentials, you should see your Unity Desktop inside the xRDP Session….. (isn’t it cool :-))

Click on picture for better Resolution

 

Detected Issues (so far…)

Missing Mouse cursor 

The first time you connect to Unity through xRDP, you might see that the mouse cursor is not visible or missing. The workaround is to right-click on the desktop and click on open Terminal option. As soon as you perform this action, you will see the big cross mouse cursor

Missing indicator panel 

If you look on the right top of your desktop while connected through xRDP, you will notice that there is no indicator icons over there.  At the moment, we didn’t find a way to bring this one back in the xRDP Session.

To fix this issue, you have to modify your .xsession file. the .xsession file should look like the following

Credits for the code below :

/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

 

Logout option not available or not working 

Because the indicator is not available, you cannot select the logout option.  In Ubuntu 16.04, via the Dash, you can look for the logout icon. If you click on it, you will not be logged out.  If you try the command line, issuing the gnome-session-quit –logout, this will not working either.

Workaround :

you either disconnect from the xrdp session and your session will be still running on the ubuntu machine.  You can try to use the command line pkill -u <your user name>. This will kill the xRDP Session but will also kill you connection on the ubuntu machine if you were locally logged on.

You could also use the following command line.  This should kill your xrdp session only

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

Performance Issues

Some people complains that the performance were not that great. So far we didn’t investigate this. As more people would use the Unity Desktop, you might be able to have some hints and see where the performance lies…

 

Final Notes 

Voila ! We did it ! At this stage, you should be able to access your Unity Desktop through xRDP package.  You can now perform a remote desktop connection to your Ubuntu computer and enjoy the same interface as the one you are using when logged on locally on the system.

To achieve this results, the only thing that needed is to replace the aging vnc server software (vnc4server,x11vnc,…) with a more recent vnc server solution.  By simply changing the backend vnc server component of the xRDP solution, it is now possible to connect to your Unity Desktop….(This is so cool….:-) )

I hope that you will enjoy your new remote experience and you will provide us some feedback about this totally new experience…

Till next time

See ya

76 thoughts on “XRDP – How To Remote Connect to Unity Desktop on Ubuntu 16.04

  1. @Harmish,

    We never used the i3 interface…so would be difficult to know what could be wrong….
    Maybe someone else have idea ??

    till next time
    See ya

  2. I am an Ubuntu newby. I followed your tutorial to the letter. I can get to the XRDP logon and get logged on, but I get a black screen after logon.

    Thoughts?

  3. @Griffon

    I figured it out. I had to disable the “Terminal bell” in the gnome-terminal (which I was using).

  4. @Harmish,

    Thank man for the feedback.. We never used the I3 interface but we love the fact that other people contribute so we can gather info and build an extensive knowledge base..
    Thank you for sharing your experience and your findings…

    Till next time
    See ya

  5. @Nick Gage,

    Sorry for the delay in the reply, we are working abroad lately just back to normal business 🙂
    As there was some changes in the xrdp package and Ubuntu lately, you will need first to check
    1. which version of xrdp you are running (Xrdp 0.6.x or xrdp 0.9.x)
    2. When you reach the black screen, can you right-click on desktop and do you see a menu where you can select the option new terminal
    3. .xsession or startwn.sh contains the correct info and that no Typo in it
    4. can you try to perform a vnc connection (no xrdp), do you have a black screen… (if yes, you might need to first fixt the vnc connection configuration)

    waiting for feedback,

    Till next time
    See ya

  6. i have success connect the ubuntu system in virtualbox,but there is black screen…

  7. @Day,

    This can be due to Tigervnc or the fact that the .xsession or startwm.sh is not populated correctly..
    Can your have a look at your logs and have a look for any possible errors that would provide some hints…
    You could also try the following recipe and see if this is working for you (see http://c-nergy.be/blog/?p=10513)

    Hope this help
    Till next time
    See ya

  8. I followed your instruction but when I logged in, I get a blank screen and then the connection is terminated.
    My xrdp is 0.6.x.

  9. Hi..thank you very much for the tutorial,
    I tried it on Ubuntu 16.04.1 and it is working well,
    but the problem is when i installed nvidia driver, it only shows blank screen,
    I successfully logged in but after that only blank screen.
    However, if i change the environment to mate it is no problem.
    Any idea?

  10. On Ubuntu 16.04-2, after following the instructions in this tutorial I was not able to get the unity desktop to work. After considerable hacking I discovered that the X session was being started by running (/usr/bin/)Xvnc which is a soft link to /etc/alternatives/Xvnc which was another soft link to /usr/bin/Xvnc4. When I changed the last link to /usr/bin/Xtigervnc everything began working as expected.

  11. @ScottyG,

    Thank you for sharing this information…this can be useful to other readers… by the way, we have published an article about ubuntu 16.04.2 in order to have xrdp working….(chek this post http://c-nergy.be/blog/?p=10513)

    thank for the visit and the feedback

    till next time
    see ya

  12. Hello,

    the connection lo displays the following messages:
    connecting to sesman ip 127.0.0.1 port 3350
    sesman connect ok
    sending login info to session manager, please wait…
    xrdp_mm_process_login_response: login successful for displa
    start connecting
    connecting to 127.0.0.1 5910
    tcp connected
    security level is 2 (1 = none, 2 = standard)
    password ok
    sending share flag
    receiving server init
    error – problem connecting

    … and it stops. I press OK button and it returns to the login screen.
    Can you help?

  13. I found the solution: it is the one provided by ScottyG.
    Also after fixing the soft link, it is required to start the rdp service before testing (duh!)…

  14. @Richard,

    This post should be considered outdated…We have published a more recent post that describe how to perform a custom installation (see http://c-nergy.be/blog/?p=10752). Ubuntu 16.04 still ships with an old xrdp package (0.6.xx).
    Custom installation will install xrdp 0.9.xx which ships with a new backend rdp server component which makes unnecessary any vnc server software. For Ubuntu 16.10 and later; the xrdp pacakge version 0.9.x is shipped by default and again no need to have vnc server software installed either…

    Hope this help
    Till next time
    See ya

  15. @Gavin;

    Thank you for the feedback and for the visit on this web site…. Always good to see that some of our published info works for others 🙂
    Till next time
    See ya

  16. Thanks! This solved my problem of RDP’ing from a Windows machine into my Ubuntu box.

    The only difference in my setup is I’m using x11vnc rather than tigervnc – because I had already setup x11vnc for connecting from a Mac OS machine and that works well for me. x11vnc also seems to work well when I’m connected from Windows using xRDP.

  17. @Adriano,

    We always happy that our info can be useful, used and re-used as needed by users…
    thank you for the feedback and the visit
    Till next time
    see ya

  18. @Wearysky,

    Thank you for the info…. pleas also note that tigervnc package is available in Ubuntu repository in UBuntu 18.04
    Till next time
    See ya

  19. Excellent job – have got the connection working but am unable to see the mouse on the desktop. I have tried right clicking but nothing appears. Any ideas?

  20. @Paul,

    No clue so far..but I have to say you refer to an “old” post..
    My first recommendation would be try to use the custom install script and see if this fix your issues (http://c-nergy.be/blog/?p=11719)
    If this is not an option, you have to check your settings on both client and remote session for mouse pointers…
    Can you open change the mouse pointer style to see if this makes it visible yes or no ? Are you using exotic config (multi monitor /HDPI/…..)
    Never had the situation and have no test lab near me at the moment

    Hope this help
    Till next time
    See ya

  21. Hello there,

    Please note that the post you are referring is from 2016. Note also that more recent posts about xrdp and ubuntu can be found in this blog under the section Linux > Xrdp.
    Finally, please note that we have been working on a script that can help automate the installation of xRDP on top of Ubuntu 16.04. You might want to have a look at this link (http://c-nergy.be/blog/?p=12562) in order to find which version of the script could work for you

    Thank for your visit and your feedback

    Till next time
    See ya

Leave a Reply