连接到 WSL/Ubuntu 20.04 LTS 时远程桌面连接崩溃

Remote Desktop Connection crashing when connecting to WSL/Ubuntu 20.04 LTS

我正在尝试 运行 WSL 中 Ubuntu 20.04 的 XFCE 桌面环境(不是 WSL2,仅供参考。我的笔记本电脑不支持虚拟化)。

我使用 sudo apt install <package-name>.

安装了 xrdpxfce4xubuntu-desktop

我也重新检查了,甚至使用 sudo service xrdp statussudo service xrdp restart 重新启动了 xrdp 服务。该服务似乎 运行ning.

但是在尝试使用 Remote Desktop Connection(mstsc) 连接到远程桌面时,它建立了一个连接,似乎确认身份验证是正确的并且只是关闭(没有显示桌面)。

这是来自 xrdp.log

的日志
[20210409-13:25:26] [INFO ] connected client computer name: XXXXXXXXXXXXXX
[20210409-13:25:26] [INFO ] Non-TLS connection established from ::ffff:172.20.10.2 port 52251: encrypted with standard RDP security
[20210409-13:25:27] [DEBUG] xrdp_00002395_wm_login_mode_event_00000001
[20210409-13:25:27] [INFO ] Cannot find keymap file /etc/xrdp/km-00020409.ini
[20210409-13:25:27] [INFO ] Loading keymap file /etc/xrdp/km-00000409.ini
[20210409-13:25:27] [WARN ] local keymap file for 0x00020409 found and doesn't match built in keymap, using local keymap file
[20210409-13:25:33] [DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
[20210409-13:25:34] [INFO ] xrdp_wm_log_msg: sesman connect ok
[20210409-13:25:34] [DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait...
[20210409-13:25:34] [DEBUG] return value from xrdp_mm_connect 0
[20210409-13:25:34] [INFO ] xrdp_wm_log_msg: login successful for display 10
[20210409-13:25:34] [DEBUG] xrdp_wm_log_msg: started connecting
[20210409-13:25:38] [DEBUG] Closed socket 16 (AF_UNIX)
[20210409-13:25:38] [INFO ] lib_mod_log_peer: xrdp_pid=9109 connected to X11rdp_pid=9112 X11rdp_uid=1000 X11rdp_gid=1000 client_ip=::ffff:172.20.10.2 client_port=52251
[20210409-13:25:38] [DEBUG] xrdp_wm_log_msg: connected ok
[20210409-13:25:38] [DEBUG] xrdp_mm_connect_chansrv: chansrv connect successful
[20210409-13:25:38] [DEBUG] Closed socket 15 (AF_INET6 ::1 port 52252)
[20210409-13:25:41] [INFO ] The following channel is allowed: rdpdr (0)
[20210409-13:25:41] [INFO ] The following channel is allowed: rdpsnd (1)
[20210409-13:25:41] [INFO ] The following channel is allowed: cliprdr (2)
[20210409-13:25:41] [INFO ] The following channel is allowed: drdynvc (3)
[20210409-13:25:41] [DEBUG] The allow channel list now initialized for this session
[20210409-13:25:46] [DEBUG] Closed socket 17 (AF_UNIX)
[20210409-13:25:46] [DEBUG] Closed socket 11 (AF_INET6 ::ffff:172.20.10.2 port 3389)
[20210409-13:25:46] [DEBUG] xrdp_mm_module_cleanup
[20210409-13:25:46] [DEBUG] Closed socket 16 (AF_UNIX)

我试过使用 127.0.0.1172.20.10.2 进行连接,两者都产生相同的结果。

我也试过像在 Internet 上看到的那样编辑 /etc/xrdp/startwm.sh(注释掉最后两行并添加 startxfce4)。好像没什么区别。

P.S 请不要推荐使用 XLaunchXMing 或此类类似本地 Xserver 应用程序的解决方案。这些确实有效,但出于特定原因我选择使用 RDP。

提前致谢。

我通过取消注释命令解决了这个问题 #exec /bin/sh /etc/X11/Xsession 通过打开文件 sudo nano /etc/xrdp/startwm.sh

添加已接受的答案,如果行 test -x /etc/X11/Xsession && exec /etc/X11/Xsession 已取消注释但您的 RDP 连接崩溃,则注释现有行并添加新行 startxfce4。所以文件的最后几行 /etc/xrdp/startwm.sh 应该是:

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

startxfce4