Previous post install and configure xrdp on ubuntu 20.04 shows you how to install xrdp in Ubuntu 20.04.During the test I also noticed sometimes I got black screen. So this tutorial shows you how to troubleshoot this issue.

Check if you have DE like gnome or XFCE4 installed

In case you are using Ubuntu server but not Ubuntu desktop , if you don’t have a DE installed ,you can using below command to install Gnome or XFCE4.

  • To install XFCE4 for Ubuntu 20.04

sudo apt update;sudo apt install xfce4

OR

  • To install Gnome for Ubuntu 20.04

    sudo apt update
    sudo apt install tasksel
    sudo tasksel
      
    

    Then install ubuntu desktop or ubuntu minimal desktop using tasksel

    sudo tasksel
    

If the same user account has another session running

This should be most of the cases , if so you can logout that session then try again to double check.

I recommend you to create a new user account for xrdp use.

Not recommended but you can try to modify /etc/xrdp/startwm.sh as a workaround to run two gnome sessions in parallel for the same user.

sudo vi /etc/xrdp/startwm.sh
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR

For XFCE4 only

If you are using XFCE4 and the symptom is getting a black screen then RDP window exits immediately, check if you can get the issue fixed by :

echo xfce4-session >> ~/.xsession