XRDP Fails to Start MATE Session on Ubuntu MATE 22.04: How to Fix

Abstract: Fix XRDP black screen on Ubuntu MATE 22.04 by editing startwm.sh to explicitly launch mate-session-manager.

Created: 2026-08-31 by
XRDP fails to start the MATE session on Ubuntu 22.04 because the default configuration attempts to launch a new Xsession that conflicts with the existing desktop environment or lacks the correct session manager binaries. The most reliable fix involves editing the xrdp-startwm.sh script to explicitly invoke the MATE session manager, ensuring the remote connection mirrors the local desktop experience without crashing or dropping back to a black screen.

Understanding the Root Cause

When you install XRDP on Ubuntu MATE, it typically comes with a generic startup script located at /etc/xrdp/startwm.sh. This script is designed to be distribution-agnostic, meaning it tries to detect and start a standard X11 session. However, Ubuntu MATE uses the mate-session-manager rather than the generic startxfce4 or startlxde commands often found in default configurations. If the script does not find a compatible session starter, it may exit silently, leaving you with a disconnected session or a black screen after authentication. Additionally, if another user is already logged into the physical console, XRDP might try to share that session, leading to resource conflicts. Understanding this separation between the display manager (LightDM) and the session manager (MATE) is crucial for troubleshooting. You are essentially telling XRDP which graphical shell to load once the TCP connection is established.

Step-by-Step Fix: Editing the Startup Script

The primary solution requires modifying the XRDP initialization file to point directly to the MATE session binary. Follow these steps carefully to ensure the changes persist across reboots.
  1. Backup the original configuration: Before making any changes, create a backup of the current startup script. This allows you to revert if something goes wrong. Open your terminal and run:
    sudo cp /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.bak
  2. Edit the startup script: Use a text editor with root privileges to modify the file. We recommend using nano for its simplicity:
    sudo nano /etc/xrdp/startwm.sh
  3. Locate the session launch section: Scroll to the bottom of the file. You will likely see lines attempting to source /etc/X11/Xsession or calling startxfce4. These are the lines causing the conflict.
  4. Replace with MATE specific commands: Comment out the existing session launching lines by adding a # at the beginning of each line. Then, add the following two lines at the very end of the file:
    unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    exec mate-session-manager
    This ensures that no conflicting session managers are inherited from the parent process and forces the start of the MATE desktop environment specifically.
  5. Save and exit: If using nano, press Ctrl+O then Enter to save, followed by Ctrl+X to exit.
After saving the file, you must restart the XRDP service for the changes to take effect. Run the following command:
sudo systemctl restart xrdp
You can now attempt to connect again using your RDP client. If you were previously connected, disconnect and reconnect. The session should now load the full MATE interface.

Handling Multiple Sessions and Port Conflicts

Sometimes, the issue is not just about which session manager is called, but how XRDP handles multiple simultaneous connections. By default, XRDP listens on port 3389. If you have multiple users trying to connect, or if a previous session did not terminate cleanly, you might encounter "Connection Refused" errors or black screens even after fixing the script. To address this, you can configure XRDP to allow multiple sessions by editing the xrdp.ini file. However, a simpler immediate fix is to ensure that the local display manager is not interfering. If you are logging in via SSH and then starting XRDP, ensure that no other instance of mate-session-manager is running unexpectedly. You can check for zombie processes with:
ps aux | grep mate-session
If you see multiple instances, kill them before restarting the service. For a more robust setup involving security, consider setting up an X11 SSH Tunnel for Remote Desktop Access as described in our guide on securing remote connections. This adds an extra layer of encryption over the RDP protocol.

Verifying the Installation and Permissions

Ensure that the XRDP service is enabled to start on boot. Run:
sudo systemctl enable xrdp
Also, verify that the user account you are connecting with has permission to access the X server. In some cases, especially with newer versions of Ubuntu, the xrdp-sesman service needs to be restarted alongside the main daemon to clear cached session data.
sudo systemctl restart xrdp-sesman
If you still experience issues, check the system logs for specific error messages related to MATE components. Look at /var/log/xrdp-sesman.log for clues regarding why the session manager failed to initialize. This log will tell you if a specific MATE plugin is crashing during startup. For those experiencing lag after successfully connecting, refer to our article on eliminating lag when connecting to Ubuntu Server via xRDP with Remmina to optimize performance settings.

Frequently Asked Questions

Why do I get a black screen after entering my password?

A black screen usually indicates that the session manager started but failed to render the desktop environment. This is often caused by missing dependencies in the startwm.sh script. Ensure you have added exec mate-session-manager to the end of the script and removed conflicting entries like startxfce4.

Can I use XRDP with other desktop environments on Ubuntu?

Yes, but you must change the command in startwm.sh to match your specific desktop environment. For GNOME, use gnome-session; for KDE, use startplasma-x11; and for XFCE, use startxfce4. Each environment has its own session manager binary that XRDP needs to call explicitly.

Does XRDP work with Wayland on Ubuntu 22.04?

No, XRDP is designed for X11. Ubuntu 22.04 defaults to Wayland for GNOME, but MATE typically uses X11. If you switch your system to Wayland, XRDP will fail to connect. You must ensure your system is booting into the Xorg session, which is usually the fallback option in the login screen if Wayland is unavailable or disabled.

How do I fix "Connection Refused" errors on port 3389?

This error often means the firewall is blocking the port or the service is not running. First, check if XRDP is active with systemctl status xrdp. Then, ensure your UFW firewall allows incoming traffic on port 3389 by running sudo ufw allow 3389/tcp. Restarting the service after opening the port often resolves the issue.

Is it safe to run XRDP on a production server?

While XRDP is functional, it is generally recommended to use SSH for secure command-line access and reserve XRDP for administrative tasks requiring a GUI. Always restrict XRDP access to trusted IP addresses using firewall rules. For enhanced security, tunneling XRDP over SSH is a best practice to encrypt the remote desktop traffic.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More