几个月来,我一直在使用从 Windows 11 计算机到远程 Ubuntu 桌面(22.04)的远程桌面连接,没有任何问题。
由于这个远程 Ubuntu 桌面没有连接物理显示器,我安装了 xserver-xorg-video-dummy 包,并使用以下内容设置了 /etc/X11/xorg.conf:
Section "Monitor"
Identifier "Monitor0"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
# https://arachnoid.com/modelines/
# 1920x1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz
Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync
EndSection
Section "Device"
Identifier "Card0"
Driver "dummy"
VideoRam 256000
EndSection
Section "Screen"
DefaultDepth 24
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Depth 24
Modes "1920x1080_60.00"
EndSubSection
EndSection
突然,它停止工作了。当我尝试连接到 Ubuntu 桌面时,系统会要求我输入密码,我输入密码并按“确定”,远程桌面窗口会短暂打开,然后消失。发生这种情况时,/var/log/syslog 中会出现以下消息:
Mar 18 11:32:29 testcomputer gnome-remote-desktop-daemon[2736]: [11:32:29:978] [2736:3633] [WARN][com.winpr.negotiate] - AcceptSecurityContext status SEC_I_CONTINUE_NEEDED [0x00090312]
Mar 18 11:32:29 testcomputer gnome-remote-desktop-daemon[2736]: [11:32:29:981] [2736:3633] [WARN][com.winpr.negotiate] - AcceptSecurityContext status SEC_I_COMPLETE_NEEDED [0x00090313]
Mar 18 11:32:30 testcomputer gnome-remote-de[2736]: Failed to start remote desktop session: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Session creation inhibited
Mar 18 11:32:30 testcomputer gnome-remote-desktop-daemon[2736]: [11:32:29:008] [2736:2736] [ERROR][com.freerdp.core] - rdp_set_error_info:freerdp_set_last_error_ex ERRINFO_RPC_INITIATED_DISCONNECT [0x0001000 1]
仅供参考,当连接正常工作时,系统日志中的消息如下:
Mar 18 11:01:52 testcomputer gnome-remote-desktop-daemon[2736]: [11:01:52:363] [2736:3435] [WARN][com.winpr.negotiate] - AcceptSecurityContext status SEC_I_CONTINUE_NEEDED [0x00090312]
Mar 18 11:01:52 testcomputer gnome-remote-desktop-daemon[2736]: [11:01:52:365] [2736:3435] [WARN][com.winpr.negotiate] - AcceptSecurityContext status SEC_I_COMPLETE_NEEDED [0x00090313]
Mar 18 11:01:52 testcomputer gnome-remote-de[2736]: [RDP.RDPGFX] CapsAdvertise: Accepting capability set with version RDPGFX_CAPVERSION_106, Client cap flags: H264 (AVC444): true, H264 (AVC420): true
Mar 18 11:01:52 testcomputer gnome-remote-de[2736]: [RDP.CLIPRDR] Client capabilities: long format names, stream file clip, file clip no file paths, can lock clip data, huge file support
Mar 18 11:01:53 testcomputer gnome-shell[2782]: Window manager warning: Overwriting existing binding of keysym 34 with keysym 34 (keycode d).
Mar 18 11:01:53 testcomputer gnome-shell[2782]: Window manager warning: Overwriting existing binding of keysym 35 with keysym 35 (keycode e).
Mar 18 11:01:53 testcomputer gnome-shell[2782]: Window manager warning: Overwriting existing binding of keysym 31 with keysym 31 (keycode a).
Mar 18 11:01:53 testcomputer gnome-shell[2782]: Window manager warning: Overwriting existing binding of keysym 32 with keysym 32 (keycode b).
Mar 18 11:01:53 testcomputer gnome-shell[2782]: Window manager warning: Overwriting existing binding of keysym 33 with keysym 33 (keycode c).
Mar 18 11:01:53 testcomputer gnome-shell[2782]: Window manager warning: Overwriting existing binding of keysym 36 with keysym 36 (keycode f).
Mar 18 11:01:53 testcomputer gnome-shell[2782]: Window manager warning: Overwriting existing binding of keysym 38 with keysym 38 (keycode 11).
Mar 18 11:01:53 testcomputer gnome-shell[2782]: Window manager warning: Overwriting existing binding of keysym 37 with keysym 37 (keycode 10).
Mar 18 11:01:53 testcomputer gnome-shell[2782]: Window manager warning: Overwriting existing binding of keysym 39 with keysym 39 (keycode 12).
所以关键是要了解这是什么意思以及如何解决这个问题:
Mar 18 11:32:30 testcomputer gnome-remote-de[2736]: Failed to start remote desktop session: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Session creation inhibited
提示:如果我将物理显示器短暂连接到 Ubuntu 计算机,那么我可以再次连接到远程桌面。有趣的是,如果我断开物理显示器的连接,与“虚拟显示器”的远程连接仍可工作几分钟,然后突然又停止工作。
答案1
我找到了一个解决方案。
我执行了这个命令:
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/inactivity-sleep-mode-on-battery -n -t int -s 1
来源:https://bugs.launchpad.net/ubuntu/+source/xfce4-power-manager/+bug/1768038