20

I installed Ubuntu 20.04 and then installed xrdp. Whenever i tried to connect, either from another Ubuntu 20.04 box using either xfreerdp or krdc, or from a Mac, a black screen would show up, and then immediately disconnect. i made sure i did not have any other sessions on the server going on at the same time.

After a while, i gave up and tried the script at: https://www.c-nergy.be/products.html it didn't make a difference

this is the only output from /var/log/xrdp.log

[20200529-18:17:16] [INFO ] Socket 12: AF_INET6 connection received from ::ffff:192.168.0.216 port 45006 
[20200529-18:17:16] [DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.0.199 port 3389) 
[20200529-18:17:16] [DEBUG] Closed socket 11 (AF_INET6 :: port 3389) 
[20200529-18:17:16] [INFO ] Using default X.509 certificate: /etc/xrdp/cert.pem 
[20200529-18:17:16] [INFO ] Using default X.509 key file: /etc/xrdp/key.pem 
[20200529-18:17:16] [DEBUG] TLSv1.3 enabled 
[20200529-18:17:16] [DEBUG] TLSv1.2 enabled 
[20200529-18:17:16] [DEBUG] Security layer: requested 3, selected 1 
[20200529-18:17:16] [INFO ] connected client computer name: coruscant 
[20200529-18:17:16] [INFO ] adding channel item name cliprdr chan_id 1004 flags 0xc0a00000 
[20200529-18:17:16] [INFO ] TLS connection established from ::ffff:192.168.0.216 port 45006: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 
[20200529-18:17:16] [DEBUG] xrdp_00000506_wm_login_mode_event_00000001 
[20200529-18:17:16] [INFO ] Loading keymap file /etc/xrdp/km-00000409.ini 
[20200529-18:17:16] [WARN ] local keymap file for 0x00000409 found and doesn't match built in keymap, using local keymap file 
[20200529-18:17:17] [DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.0.199 port 3389) 
[20200529-18:17:17] [DEBUG] xrdp_mm_module_cleanup

thank you very much

1
  • int the past this has worked for me after a few updates to os this too has failed May 23, 2021 at 20:10

8 Answers 8

21

I was able to solve this issue by logging out of the desktop session for the machine before trying RDP.

6
  • 4
    This is true, but interesting. Why it is so?
    – FedKad
    Jul 2, 2020 at 15:43
  • 3
    Fine, but that didn't work for me. I have never seen xrdp work on ubuntu, or for that matter, on any linux. Black screen always.
    – user289334
    Oct 4, 2020 at 16:14
  • @user289334 I'm sorry my solution didn't work for you. I would try asking a question that has additional detail to your unique problem and hopefully someone can help you. Oct 5, 2020 at 17:20
  • @user289334 For me, ubuntu-desktop worked fine. The only problem with it was it was so very slow and decided to move to a lighter environment. And I got an error in Xubuntu Core. Nov 18, 2020 at 14:20
  • 1
    I have the same. Even more interesting is that once I am logged through RDP I can't start a desktop session on the machine itself until I log out from the RDP session...
    – Cabu
    Jan 4, 2021 at 13:33
7

I'd faced the same issue in my local server Ubuntu 20.04 (Installed xubuntu-desktop) and I had fixed it by executing the following command.

# echo "startxfce4" > ~/.Xsession
# chmod +x ~/.xsession
# sudo systemctl restart xrdp.service

If you get a Warning Message [Authentication is required to create a color managed device] while connecting to the Ubuntu server through Xrdp, you need to execute the following commands to ignore it:

# cd /usr/share/polkit-1/actions/

# vi org.freedesktop.color.policy

Modify <allow_any> settings from auth_admin to yes.

<defaults> 
      <allow_any>yes</allow_any>
      <allow_inactive>no</allow_inactive>
      <allow_active>yes</allow_active>
</defaults>

# reboot 
4
  • The only solution that has worked for my after 3 hours looking for one. Thanks a lot man
    – vicase98
    Feb 6, 2021 at 14:03
  • 2
    RDP connection exits and will not connect at all after doing this.
    – phpguru
    Mar 22, 2021 at 4:54
  • Well, this worked! Thanks! Jul 13, 2021 at 8:38
  • Line two needs to have a capital X
    – LeanMan
    Jan 18 at 19:04
5

After many tries and some fixes I was able to rdp but:

  1. Password was requested way to many times
  2. Side bar didn't fill up the whole screen

So I found this xRDP installation script that works perfectly! Credits to Griffon!!

Just download, unzip and run:

wget https://www.c-nergy.be/downloads/xrdp-installer-1.2.2.zip
unzip xrdp-installer-1.2.2.zip 
bash xrdp-installer-1.2.2.sh
2
  • This is great! (Best to visit the website and download the latest version.) It fixes a bunch of problems like the Terminal background colour, and it even has the option of a prettier login dialog. There are still problems, though. I had to turn off screen lock. Jun 22, 2021 at 1:22
  • Couple issues: 1) Installer version is old. Perhaps link to c-nergy.be/products.html 2) Prob'ly better to just refer people to the site because the instructions to download a zip and run the contained script is highly suspicious. It made me think this was a malware post. I eventually stumbled upon Griffon's answer through Google searching.
    – Peter L
    Jan 23 at 18:44
5

It seems to be possible to allow multiple sessions so that you don't have to logout or end up in the blackscreen. Worked on my 20.04 LTS just by adding two lines into the startwm.sh.

nano /etc/xrdp/startwm.sh

Add in the very top:

unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR

then:

sudo systemctl restart xrdp

Credits to Peter Bennett @catch22cats, thanks!

3
  • Worked for me on a fresh 20.04 LTS install today. Thanks! (Also: sudo systemctl restart xrdp) Ah, but the script by Griffon linked to by Luis Pereira is even better. It fixes this problem and others, and even sorts out the Terminal background colours, and has the option of a prettier login dialog. Jun 21, 2021 at 12:57
  • Worked for me also with a systemctl restart. Does anyone know if I can log out of other sessions?
    – Ryan w
    Jul 19, 2021 at 18:29
  • Likewise, worked great for me... it gives certificate errors after on the connecting PC, but compared to being stuck unable to get out of the blank screen on the Linux machine, I'll take it, thanks :) Dec 15, 2021 at 8:05
4

1. Remove previously installed xrdp:

$ sudo systemctl disable xrdp
$ sudo systemctl stop xrdp

$ sudo apt purge xrdp
$ sudo apt purge xserver-xorg-core
$ sudo apt purge xserver-xorg-input-all
$ sudo apt purge xorgxrdp

2. Re-install xrdp & required packages:

$ sudo apt install xrdp
$ sudo apt install xserver-xorg-core
$ sudo apt install xserver-xorg-input-all
$ sudo apt install xorgxrdp

You also need to grant access to the /etc/ssl/private/ssl-cert-snakeoil.key file for xrdp user. It is available to members of the ssl-cert group by default.

$ sudo adduser xrdp ssl-cert           # add xrdp into ssl-cert group
$ sudo systemctl start xrdp            # start xrdp service
$ systemctl is-active xrdp             # check xrdp state
...
active
$ sudo systemctl enable xrdp           # start xrdp on system start

3. Reboot system:

$ sudo reboot

4. Firewall configuration:

You need to open access on port 3389.

$ sudo ufw allow 3389

It is more secure to open it only for your IP address or network. For example:

$ sudo ufw allow from 10.5.5.0/24 to any port 3389

The best practice is to use an SSH tunnel to connect to the remote desktop and make xRDP listen only for local connections.

5. Setup your RDP-client

Please note that in some cases the user who will connect to xRDP must log out before doing so!

  • Connect to your server using any RDP client.
  • Enter the user credentials of your Ubuntu computer.
  • Now you can see the remote desktop initial screen.

Related commands:

$ sudo systemctl status xrdp           # display current xrdp status

$ sudo systemctl start xrdp            # start xrdp service
$ sudo systemctl stop xrdp             # stop xrdp service
$ sudo systemctl restart xrdp          # restart xrdp service

$ sudo systemctl enable xrdp           # enable xrdp on system start
$ sudo systemctl disable xrdp          # disable xrdp on system start
2
0

This is a big problem to many useres. I found out an error on my systems. I am using 2 Odroid C2 computers. I had the same issues. I installed from scratch and everything was ok. Then i did something not related to Remotedesktop and after that i could not log anymore. The last time i had the system working fine and i changed the IP adress from xxx.xxx.xxx.094 to xxx.xxx.xxx.096 I could not log in via Remotedesktop. I had the second system running good, so i startet to compare files in my case the /etc/xrdp/startwm.sh had a complete different content. It looked like it was copied over with a different text. Unfortunetly i got not further in it. I restored this file and now it is working fine again. There are so many tips for this problem, so just check that file.

1
  • and we are all wanting to know what it should like like since you have given us the task of 'checkin' it May 23, 2021 at 19:50
0

Install Xrdp Server again.

root@ubuntu:~# apt -y install xrdp tigervnc-standalone-server

Start Xrdp Server.

root@ubuntu:~# systemctl enable xrdp

Connect from other clients.

1
  • This does not add anything new, and has far less detail than the answer above. Feb 22, 2021 at 9:03
-3

Try to install xrdp package by using sudo instead of root user. This works perfectly fine & tested on MAC (Microsoft Remote Desktop) & Window 10.

Link: https://linuxconfig.org/ubuntu-20-04-remote-desktop-access-from-windows-10

1
  • 2
    Why do you think OP installed any way other than using sudo apt install xrdp?
    – Zanna
    Nov 19, 2020 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.