Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

Black Screen Remote Desktop to Ubuntu from Windows with XRDP

October 4, 2023
in Blog, Ubuntu
0
ADVERTISEMENT

Table of Contents

We have noticed that a lot of people hit the same issue over and over again. When trying to connect via remote desktop protocol (rdp) to the Ubuntu machine, and after providing the credentials in the xRDP Login page, the user will only see a black screen displayed and the desktop interface is never loaded and displayed. This post will basically explain why this happens and how to reproduce the issue.

Black Screen when Remote Desktop to Ubuntu

Let’s assume that you have installed xRDP to enable Remote Desktop service on an Ubuntu machine. And you are still logged on into your Ubuntu machine system locally with your user account.

Now, you move to a Windows machine then connect to the Ubuntu using RDP.

If the credentials are correct, you will see your remote desktop session showing a black screen.

Remove Black Screen when Remote Desktop to Ubuntu

This situation will happen (or can happen) when the same user account is used concurrently locally and remotely. In other words, the problem is related to the fact that the same user account is already logged in locally and a remote connection is attempted at the same time.

To solve this issue, there is a simple fix. You need to ensure the account you are using to login via the remote desktop client is not currently logged on locally on the Ubuntu target machine. If this is the case, perform a logout operation.

Try again the remote desktop session and you will be able to perform your remote desktop connection and that your desktop interface will be loaded and made available for you.

Allow multiple sessions (local and remote) for the same user

If you don’t want to logout the current user, you can allow a user to login via xRDP even if the same user account is already logged on locally on the Ubuntu machine.

Method 1: Using dbus-launch approach

You will simply need to modify your /etc/xrdp/startwm.sh file and appending a one liner that will allow you to basically acquire the desktop while performing your remote connection even if you are already logged on locally. To implement this trick, simply open the /etc/xrdp/startwm.sh with your favorite text editor.

sudo nano /etc/xrdp/startwm.sh

At the below line before this line test -x /etc/X11/Xsession && exec /etc/X11/Xsession. Then save the file.

Note Tip: To save the file in nano editor, press > >
export $(dbus-launch)
#!/bin/sh
# xrdp X session start script (c) 2015, 2017 mirabilos
# published under The MirOS Licence

if test -r /etc/profile; then
        . /etc/profile
fi

...
export $(dbus-launch)
test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession

Restart the xrdp service to take the change goes into effect.

sudo systemctl restart xrdp

Method 2: unsetting DBUS_SESSION_BUS_ADRESS

This method is similar to the first one. You will also need to edit and modify the /etc/xrdp/startwm.sh file and add some additional commands to be executed when the remote session will be initiated.

At the below line before this line test -x /etc/X11/Xsession && exec /etc/X11/Xsession. Then save the file.

unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
#!/bin/sh
# xrdp X session start script (c) 2015, 2017 mirabilos
# published under The MirOS Licence

if test -r /etc/profile; then
        . /etc/profile
fi

...
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession

Now, you can give it a try.  Stay logged on locally on the machine and initiate your remote session.

Method 3:

Add the following line at the begin of the file /etc/xrdp/startwm.sh.

#Improved Look n Feel Method
cat <<EOF > ~/.xsessionrc
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
EOF
Note Tip: To save the file in nano editor, press > >

Not a reader? Watch this related video tutorial:

5/5 - (1 vote)
Previous Post

How to Enable Remote Desktop on Ubuntu Desktop

Next Post

How to Install a Desktop Environment on an Ubuntu Server

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory