How to Fix XRDP Ubuntu Black Screen After Login

Using XRDP to remotely access an Ubuntu machine is a powerful way to manage your Linux environment from anywhere. However, many users face a common and frustrating issue: the infamous black screen after login. After entering your credentials via Remote Desktop Protocol (RDP), instead of seeing your desktop, you’re greeted with a black void — and nothing more.

This article breaks down the common causes and solutions for the XRDP black screen issue on Ubuntu, helping you quickly get back to a functional remote desktop.

What Causes the XRDP Black Screen Issue?

Before diving into fixes, it helps to understand what causes the problem. The black screen typically appears due to:

  • Incompatible desktop environments (DE)

  • Missing or misconfigured .xsession file

  • Permissions issues

  • Conflicts with Wayland (used in newer versions of Ubuntu)

  • Incomplete XRDP or Xorg configurations

Now, let’s walk through the proven solutions.

Step-by-Step Fixes

1. Install a Compatible Desktop Environment

XRDP doesn’t play nicely with GNOME (Ubuntu's default DE in recent versions). A lightweight desktop environment like Xfce is more stable and widely used with XRDP.

🔧 To install Xfce:

bash
sudo apt update sudo apt install xfce4 xfce4-goodies -y

2. Configure XRDP to Use Xfce

Once installed, you need to tell XRDP to launch Xfce upon login.

🔧 Create or Edit .xsession:

bash
echo "startxfce4" > ~/.xsession

Make sure the file is readable:

bash
chmod +x ~/.xsession

Tip: Do this as the user who will be logging in via RDP.

3. Install and Configure XRDP

If you haven’t installed XRDP yet:

bash
sudo apt install xrdp -y

Ensure the XRDP service is running:

bash
sudo systemctl enable xrdp sudo systemctl start xrdp

You can check the status with:

bash
sudo systemctl status xrdp

4. Disable Wayland (Ubuntu 22.04+ Specific)

Wayland is a display server protocol that isn’t fully compatible with XRDP. To ensure smooth remote sessions, switch to Xorg.

🔧 Edit the GDM config file:

bash
sudo nano /etc/gdm3/custom.conf

Uncomment or add the line:

ini
WaylandEnable=false

Save and close the file (Ctrl + O, Enter, Ctrl + X), then reboot:

bash
sudo reboot

5. Grant Access to the XRDP Session

Sometimes, the session isn’t created properly due to missing privileges.

🔧 Add user to the ssl-cert group:

bash
sudo adduser xrdp ssl-cert

Restart XRDP afterward:

bash
sudo systemctl restart xrdp

6. Fix PolKit Permissions

PolKit can block access to system services. Create a policy to allow XRDP users.

🔧 Create a new policy file:

bash
sudo nano /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf

Paste this:

ini
[Allow Colord All Users] Identity=unix-user:* Action=org.freedesktop.color-manager.create-device ResultAny=no ResultInactive=no ResultActive=yes

This allows XRDP users to interact with colord and avoids permission-related crashes.

7. Check and Set Session File for XRDP

Ubuntu may not automatically know which session to start.

🔧 Create or modify /etc/xrdp/startwm.sh:

Before modifying, back up the file:

bash
sudo cp /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.bak

Then edit:

bash
sudo nano /etc/xrdp/startwm.sh

Comment out these lines (if present):

bash
# test -x /etc/X11/Xsession && exec /etc/X11/Xsession # exec /bin/sh /etc/X11/Xsession

And add:

bash
startxfce4

Save and restart XRDP:

bash
sudo systemctl restart xrdp

8. Verify File Ownership and Permissions

Incorrect file ownership can prevent proper session loading.

🔧 Ensure .xsession is owned by the correct user:

bash
ls -l ~/.xsession

If it’s not owned by you, fix it:

bash
sudo chown yourusername:yourusername ~/.xsession

9. Update and Reboot

Sometimes a quick update and reboot clears up lingering issues:

bash
sudo apt update && sudo apt upgrade -y sudo reboot

Bonus Tips for Troubleshooting

If it still doesn’t work:

  • Check logs for errors:

    bash
    tail -f /var/log/xrdp-sesman.log tail -f ~/.xsession-errors
  • Try a different user account. Sometimes, a corrupted home directory can cause issues.

  • Ensure you log out physically from the system before logging in via XRDP, to avoid session conflicts.

Security Tip

Don’t expose XRDP directly to the internet. Always use a VPN or SSH tunnel when accessing your system remotely.

Example SSH tunnel:

bash
ssh -L 3389:localhost:3389 youruser@yourserverip

Final Thoughts

The XRDP black screen on Ubuntu can be frustrating, but it's usually fixable with a few adjustments. Switching to a compatible desktop environment like Xfce, configuring your session properly, and ensuring XRDP uses Xorg (not Wayland) can resolve the majority of issues.

With these fixes in place, your remote Ubuntu desktop should be up and running, and that black screen will be a thing of the past.

Comments

Popular posts from this blog

How to Connect to a Linux Server from Windows Using MobaXterm

How to Allow Remote Desktop Connections on Windows 7

How to Secure a Windows VPS from Hackers: A Comprehensive Guide