首页 > 解决方案 > 连接到 WSL/Ubuntu 20.04 LTS 时远程桌面连接崩溃

问题描述

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

我已经安装xrdp并使用.xfce4xubuntu-desktopsudo apt install <package-name>

sudo service xrdp status我还重新检查了,甚至使用and重新启动了 xrdp 服务sudo service xrdp restart。该服务似乎正在运行。

但是在尝试使用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.1as 和连接172.20.10.2,两者产生相同的结果。

我也尝试过编辑/etc/xrdp/startwm.sh我在互联网上看到的内容(注释掉最后两行并添加startxfce4)。它似乎没有任何区别。

PS 请不要推荐使用的解决方案XLaunchXMing或类似的本地 Xserver 应用程序。这些确实可以成功,但出于特定原因,我选择使用 RDP。

提前致谢。

标签: ubuntuwindows-subsystem-for-linuxrdpxfcexrdp

解决方案


添加到已接受的答案中,如果该行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


推荐阅读