Blank screen on re-connect remote desktop: WSL + Ubuntu + xfce4 + xrdp
Environment
Microsoft Windows [Version 10.0.19041.388]
Your Distribution version: Ubuntu 20.04.1 LTS (Focal Fossa)
WSL2: Linux version 4.19.104-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Feb 19 06:37:35 UTC 2020
Steps to reproduce
- Install WSL + Ubuntu + xfce4 + xrdp
- Connect via Windows Remote Desktop (success!)
- Close Remote Desktop
- Connect via Windows Remote Desktop (black, blank screen)
Manual work-around
The following might give some indication toward the cause.
- After experiencing the black, blank screen
- Close Remote Desktop connection
- Stop xrdp *hangs for several seconds
$ sudo service xrdp stop *Stopping Remote Desktop Protocol server - Re-start xrdp
$ sudo /etc/init.d/xrdp start * Starting Remote Desktop Protocol server - Check xrdp status
$ service xrdp status * xrdp-sesman is running * xrdp is running - Re-connect to remote desktop (works again, but what a pain!)
Expected behavior
Re-connecting to the Ubuntu instance through remote desktop always displays the OS.
Actual behavior
Black screen when re-connecting to the Ubuntu instance through remote desktop.
After a tip, re-connecting works properly when using the "Log Out" menu option vs. simply closing the RDP window. Is this required?
This is a good question for Ubuntu, xfce4, xrdp or other forums related to those third-party products. There is a MSFT RDP client Q&A forum here. n.b. If you use the Windows FreeRDP client, and the problem does turn out to be with the client (it might, but probably not), then you've got the option to send a PR that fixes it. Also reddit, serverfault.
Often it is best to frame the question in those forums as running on a headless Linux box (or VM) without systemd and no DRM, rather than 'WSL'.
GUI apps on WSL is on the way, subscribe #938.
I think you'll find that whether the screen is black depends on whether its been idle for 10 minutes or more, and this is caused by the Xfce power manager. Go into the Xfce power manager and turn off, max out and disable all display and system time outs.
I notice that anything that activates the lock screen, xflock4 also hangs xrdp. By default this includes ctrl-alt-del (activatede by ctrl-alt-end in rdp) and ctrl-alt-L, as seen in keyboard config in xfce4.
Yep that was that! Thanks!! I turned everything to "never" in Power Management.
I think you'll find that whether the screen is black depends on whether its been idle for 10 minutes or more, and this is caused by the Xfce power manager. Go into the Xfce power manager and turn off, max out and disable all display and system time outs.
@xpusostomos Thanks a lot for this solution. This issue was annoying me in the past week, now it's resolved. Such a nice trick, wow!
After a lot of search I found this solution that worked for me (thanks to Luis Pereira https://askubuntu.com/a/1324767)
nano /etc/xrdp/startwm.sh Add in the very top:
unset DBUS_SESSION_BUS_ADDRESS unset XDG_RUNTIME_DIR then:
sudo systemctl restart xrdp
@ANMahmood Thank you for your comment!! I have same issue so, I even tried reset my wsl2 environment!!!!! Your comment is very very helpful!!!!
@ANMahmood you save my day, thanks
After a lot of search I found this solution that worked for me (thanks to Luis Pereira https://askubuntu.com/a/1324767)
nano /etc/xrdp/startwm.sh Add in the very top:
unset DBUS_SESSION_BUS_ADDRESS unset XDG_RUNTIME_DIR then:
sudo systemctl restart xrdp
29/10/2023 - Can confirm with Windows 11 WSL2 Ubuntu 22.04.06, this solution worked
After a lot of search I found this solution that worked for me (thanks to Luis Pereira https://askubuntu.com/a/1324767)
nano /etc/xrdp/startwm.sh Add in the very top:
unset DBUS_SESSION_BUS_ADDRESS unset XDG_RUNTIME_DIR then:
sudo systemctl restart xrdp
Thanks. Finally solve this problem..
@ANMahmood Thank you very very much indeed, I was about to bang my head against the wall :D. But I would like to understand why this code works. What does this code do?
After a lot of search I found this solution that worked for me (thanks to Luis Pereira https://askubuntu.com/a/1324767)
nano /etc/xrdp/startwm.sh Add in the very top:
unset DBUS_SESSION_BUS_ADDRESS unset XDG_RUNTIME_DIR then:
sudo systemctl restart xrdp
Thx Bro You save my time... <3
@ANMahmood thank you for the solution. It help me a lot. I got w11 and wsl2 and it resolved the error.