33

I'm trying to get the Remote Desktop feature working on Ubuntu (Desktop) 22.04, but I can't seem to connect to my Ubuntu desktop from a Windows (10) PC. I'm using these instructions:

I've enabled Remote Desktop in the (Ubuntu) Sharing Settings, however when I run the Remote Desktop client (i.e. the standard mstsc.exe client) on Windows and connect to the IP address of the Ubuntu server, I get this login dialog:

XRDP Login

The Session dropdown has 4 options:

  • Xorg
  • Xvnc
  • vnc-any
  • neutrinordp-any

Selecting Xorg and some login credentials causes the window to close. If I leave the credentials blank I get an Ok dialog with this message:

Connecting to sesman ip 127.0.0.1 port 3350
sesman connect ok
sending login info to session manager, please wait...
login failed for display 0

If I click Ok the it takes me back to the login dialog.

If I select Xvnc and some credentials then I get a blank green screen.

I get similar behaviour if I disable Remote Desktop in the Sharing settings.

I tried the same thing with a second Ubuntu 22.04 host and get the same thing.

jon hanson
  • 443
  • 1
  • 6
  • 10

9 Answers9

31

You have to be logged out of your account on Ubuntu desktop. Else RDP on Windows will keep quitting.

You need to export the following environment variables:

export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME

Either do sudo nano .xsessionrc or sudo nano /etc/xrdp/startwm.sh and place the above two lines at the very start and reboot your PC.

AJM
  • 205
someTechno
  • 426
  • 4
  • 4
6

(I'll update it with more information after I gain a greater understanding)

This seemed to be the problem on my fresh Ubuntu 22.04 installation.

Cause

In ~/.xsession-errors:

# Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Failed to execute child process “dbus-launch” (No such file or directory)
dbus-update-activation-environment: error: unable to connect to D-Bus: /usr/bin/dbus-launch terminated abnormally without any error message
dbus-update-activation-environment: error: unable to connect to D-Bus: /usr/bin/dbus-launch terminated abnormally without any error message

Solution

sudo apt install dbus-x11
dbus-launch

Credits: https://c-nergy.be/blog/?p=16698

I didn't need this on Ubuntu 20

5

The before response works for me: Disabling Enhanced session in hyper-v. You can do it by going to the view menu at the top of the hyper-v window of this virtual machine and deselecting the Enhanced session. The login screen appears and you can log in.

2

this problem can be solved by disabling Enhanced session in hyper-v. hope it helps someone

  • 4
    A working solution has been provided. You need to provide more details about how to disable that feature, and indicate the precise results. Are you saying that you can login to an active session on xrdp in this way? I didn't think the protocol allowed for that. – pbhj Jul 28 '22 at 10:55
1

After encountering a blank screen issue while using XRDP on Ubuntu, I spent some time troubleshooting and managed to find a straightforward solution. Here are the steps to resolve the problem:

  1. Install XRDP: Run the following commands on your Ubuntu machine to install XRDP:

    sudo apt install xrdp
    sudo systemctl enable --now xrdp
    
  2. Allow Port 3389: Open the firewall to allow traffic on port 3389 (XRDP default port):

    sudo ufw allow from any to any port 3389 proto tcp
    
  3. Modify startwm.sh: Edit the XRDP startwm.sh script:

    sudo vi /etc/xrdp/startwm.sh
    

    Inside the script, add the following line:

    export $(dbus-launch)
    

    Ensure that the line is added before the following lines:

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

    Save the changes and exit the editor.

  4. Restart XRDP: Restart the XRDP service to apply the changes:

    sudo systemctl restart xrdp
    

Following these steps should resolve the blank screen issue encountered Remote Desktop from Windows onto Ubuntu.

Antony
  • 11
1

Actually, for me, the problem was an existing blocking connection:

So stop the xrdp service:

sudo systemctl stop xrdp

then list all the xorg display servers:

ps -aux | grep xorg

kill all the existing xorg severs from their pid:

kill (pid from ps command)

then start the xrdp service again:

systemctl start xrdp
1

For Ubuntu 24.04.2 LTS, this answer finally worked for me...

Edit the following:

sudo nano /etc/xrdp/startwm.sh

Then add the following at the top of the file:

unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR

Restart xrdp:

sudo systemctl restart xrdp

Interestingly, another answer mentioned adding export $(dbus-launch) to this same file. After restarting the machine, this allowed me to remote in... but a lot of applications were broken and giving dbus related errors (the background was also just blue). I removed the line and restarted again.

Solution 3 on this website is where I got my solution, and I have absolutely no idea why it worked.

**After implementing this solution: there were no more black screens on login, my desktop background was no longer blue, and applications worked as normal.

  • This worked indeed to connect via Windows Remote Desktop and my WSL with Ubuntu 24.04, thank u very much, lost a few hours trying to implement this :) – Carlos Delgado Aug 15 '25 at 15:51
0

Create a separate user for your Ubuntu host, this fixed my issue. When I tried using the account I created during the installation of Ubuntu to log into the remote desktop, I got a black screen every time. Once I created a separate user, I was then able to remote desktop on to my Ubuntu systems desktop.

-1

Maybe it's related to your nvidia drivers, please try:

  • add your user to groups: tty, render, gdm, input
  • change permissions to chmod ug+x /usr/lib/xorg/Xorg
  • add below lines to /etc/xrdp/sesman.ini [Xorg] section:
param=-configdir
param=/
kowal
  • 1
  • 1