Error when installing and running XRDP (Remote Desktop) with Gnome Ubuntu: I encounter a Black Screen

23,616

Solution 1

I got the same problem and after many tries I solved it by:

1) Removing xrdp

$sudo apt-get remove xrdp

2) Reinstall xrdp

$sudo apt-get install xrdp

3) Very Important Add this lines after install:

$echo gnome-session > ~/.xsession

$chmod +x ~/.xsession

Solution 2

This worked perfectly for me in Ubutu 20.04.1 LTS

echo gnome-session > ~/.xsession
chmod +x ~/.xsession
sudo reboot

Solution 3

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             # display current xrdp service state
...
active
$ sudo systemctl enable xrdp           # start xrdp on system startup

3. Reboot system:

$ sudo reboot

4. Firewall configuration (optional):

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 startup
$ sudo systemctl disable xrdp          # disable xrdp on system startup

Solution 4

I have found an alternative solution:

apt-get install x2goserver

This will install x2go, which is opensource remote desktop (RDP) server for Linux with x2goclient available both for Linux and Windows.

But I personally use chrome remote desktop. As the install was straightforward and I have never had any driver/config/software issues with it so far.

Share:
23,616
Jalau
Author by

Jalau

Updated on March 26, 2021

Comments

  • Jalau
    Jalau about 3 years

    I'm trying to connect to a remote desktop (Gnome Ubuntu) using XRDP (Remote Desktop Protocol). However, when I connect with either Apache's Guacamole or Microsofts Remote Desktop, I encounter a black screen with a cursor.

    I can verify that my Ubuntu server is running healthily through logs as well as ssh'ing in and running a test (proxmox interface).

    Interestingly, when I use xfce4 instead of gnome, I am able to connect. However, I can't get the terminal to work properly for some reason. If I am logged into gnome using the proxmox interface I can see the terminal popping up in my gnome session when I start it in my xfce xrdp session.

    Possible issues:

    Possible issues may include my startup/installation script:

    # placeholder for script
    
  • sancho.s ReinstateMonicaCellio
    sancho.s ReinstateMonicaCellio over 3 years
    Is chmod +x ~/.xsession needed? Typically these files do not need x permission.
  • Shrimpy
    Shrimpy over 3 years
    This solution does not work on Ubutu 20.04.1 LTS. Ironically, RDP and VNC behave equally bad. Both return a black screen.
  • Gabriel Fair
    Gabriel Fair over 3 years
    Could someone explain what writing gnome-session to the .xsession file does? I want to understand what is happening before I try it.
  • CuriousLearner
    CuriousLearner about 3 years
    @GabrielFair That is something I would like to know too.
  • CuriousLearner
    CuriousLearner about 3 years
    @Shrimpy Yep, didn't work for me either. 20.04 LTS.
  • Yaakov Bressler
    Yaakov Bressler about 3 years
    I found this solution and accompanied explanations quite helpful. Thank you!
  • Matthias Hamann
    Matthias Hamann over 2 years
    Worked for me. In my .xsession was mate configured...
  • KUL
    KUL over 2 years
    Additionally, need to monitor what kind of environment you are in! Otherwise, the ~/ file will be at root after sudo su=)