我已经将 PC 升级到 Ubuntu 20.04(从 16.04,中间步骤升级到 18.04)。现在我无法再通过 x2go 连接到它。在客户端上,我看到它停留在“正在连接”状态,直到它超时(“远程代理在协商会话时关闭了连接。[...]”)。在服务器上,我可以看到 x2goagent 实际上已启动并等待传入连接,这似乎永远不会发生。我已经尝试从机器中清除所有与 x2go 相关的软件包并删除所有与 x2go 相关的配置文件,然后重新安装 x2goserver 软件包,但没有成功。
以下是 x2goclient --debug 的输出,直到它停留在“连接”状态:
x2go-INFO-1> "Starting X2Go Client 4.1.2.2..."
x2go-WARNING-1> English language requested, not loading translator.
x2go-WARNING-1> English language requested, not loading translator.
x2go-DEBUG-../src/onmainwindow.cpp:1246> Removing apps from tray
x2go-DEBUG-../src/onmainwindow.cpp:1214> Plugging apps in tray.
x2go-INFO-3> "Started X2Go Client."
x2go-DEBUG-../src/onmainwindow.cpp:575> "$HOME=/home/mhier"
x2go-DEBUG-../src/onmainwindow.cpp:2266> Reading 2 sessions from config file.
x2go-DEBUG-../src/sessionbutton.cpp:361> Creating QPixmap with session icon: ":/img/icons/128x128/x2gosession.png".
x2go-DEBUG-../src/sessionbutton.cpp:361> Creating QPixmap with session icon: ":/img/icons/128x128/x2gosession.png".
x2go-DEBUG-../src/onmainwindow.cpp:13290> libssh not initialized yet. Initializing.
x2go-DEBUG-../src/onmainwindow.cpp:2752> Creating QPixmap with session icon: '":/img/icons/128x128/x2gosession.png"'.
x2go-DEBUG-../src/onmainwindow.cpp:2819> Starting session via Smart Card, SSH Agent or Kerberos token.
x2go-DEBUG-../src/onmainwindow.cpp:1246> Removing apps from tray
x2go-INFO-8> "Starting connection to server: mskmhier.desy.de:22"
x2go-DEBUG-../src/onmainwindow.cpp:2853> Starting new ssh connection to server:"mskmhier.desy.de":"22" krbLogin: false
x2go-DEBUG-../src/sshmasterconnection.cpp:168> SshMasterConnection, host "mskmhier.desy.de"; port 22; user "mhier"; useproxy false; proxyserver ""; proxyport 22
x2go-DEBUG-../src/sshmasterconnection.cpp:248> Starting SSH connection without Kerberos authentication.
x2go-DEBUG-../src/sshmasterconnection.cpp:250> SshMasterConnection, instance SshMasterConnection(0x5564bbe7e000) created.
x2go-DEBUG-../src/sshmasterconnection.cpp:495> SshMasterConnection, instance SshMasterConnection(0x5564bbe7e000) entering thread.
x2go-DEBUG-../src/sshmasterconnection.cpp:797> Session port before config file parse: 22
x2go-DEBUG-../src/sshmasterconnection.cpp:807> Session port after config file parse: 22
x2go-DEBUG-../src/sshmasterconnection.cpp:870> Session port before config file parse (part 2): 22
x2go-DEBUG-../src/sshmasterconnection.cpp:880> Session port after config file parse (part 2): 22
x2go-DEBUG-../src/sshmasterconnection.cpp:904> cserverAuth
x2go-DEBUG-../src/sshmasterconnection.cpp:943> state: 1
x2go-DEBUG-../src/sshmasterconnection.cpp:687> User authentication OK.
x2go-DEBUG-../src/sshmasterconnection.cpp:1708> LOGIN CHECK:"LOGIN OK\r\n"
x2go-DEBUG-../src/sshmasterconnection.cpp:1711> don't have interaction
x2go-DEBUG-../src/sshmasterconnection.cpp:1744> LOOP FINISHED
x2go-DEBUG-../src/sshmasterconnection.cpp:1748> No interaction needed, continue session
x2go-DEBUG-../src/sshmasterconnection.cpp:702> Login Check - OK
x2go-DEBUG-../src/onmainwindow.cpp:2947> SSH connection established.
x2go-DEBUG-../src/onmainwindow.cpp:3374> Continue normal X2Go session
x2go-DEBUG-../src/sshprocess.cpp:199> Executing remote command via SshProcess object 0: "x2golistsessions"
x2go-DEBUG-../src/sshprocess.cpp:213> this=SshProcess(0x5564bc30a720) Running masterCon->addChannelConnection(this, '"672c8690-d0c9-46be-a8a5-596c7847bdfa"', '"bash -l -c 'echo \"X2GODATABEGIN:672c8690-d0c9-46be-a8a5-596c7847bdfa\"; export PATH=\"/usr/local/bin:/usr/bin:/bin\";export TERM=\"dumb\"; x2golistsessions; echo \"X2GODATAEND:672c8690-d0c9-46be-a8a5-596c78"');
x2go-DEBUG-../src/sshmasterconnection.cpp:1810> Locking SSH channel connection MUTEX.
x2go-DEBUG-../src/sshmasterconnection.cpp:1812> Passing new channel connection object to channelConnections.
x2go-DEBUG-../src/sshmasterconnection.cpp:1814> Unlocking SSH channel connection MUTEX.
x2go-DEBUG-../src/sshmasterconnection.cpp:1977> Creating new channel.
x2go-DEBUG-../src/sshmasterconnection.cpp:1990> New channel:0x7f691800da30
x2go-DEBUG-../src/sshmasterconnection.cpp:2065> Executing remote: "bash -l -c 'echo \"X2GODATABEGIN:672c8690-d0c9-46be-a8a5-596c7847bdfa\"; export PATH=\"/usr/local/bin:/usr/bin:/bin\";export TERM=\"dumb\"; x2golistsessions; echo \"X2GODATAEND:672c8690-d0c9-46be-a8a5-596c7847bdfa\";'"
x2go-DEBUG-../src/sshmasterconnection.cpp:2082> New exec channel created.
x2go-DEBUG-../src/sshmasterconnection.cpp:2165> EOF on channel 0x7f691800da30; SshProcess object: 0
x2go-DEBUG-../src/sshmasterconnection.cpp:2222> EOF sent.
x2go-DEBUG-../src/sshmasterconnection.cpp:2224> Channel closed.
x2go-DEBUG-../src/sshprocess.cpp:532> SSH finished: raw output (stdout): "X2GODATABEGIN:672c8690-d0c9-46be-a8a5-596c7847bdfa\nX2GODATAEND:672c8690-d0c9-46be-a8a5-596c7847bdfa\n"
x2go-DEBUG-../src/sshprocess.cpp:543> SSH finished: true - "" (0).
x2go-DEBUG-../src/onmainwindow.cpp:3861> ""
x2go-DEBUG-../src/onmainwindow.cpp:1246> Removing apps from tray
x2go-DEBUG-../src/onmainwindow.cpp:4521> Executing remote command: "X2GODPI=110 X2GO_XINERAMA=no x2gostartagent 800x600 wan adaptive-9 unix-kde-depth_24 us auto 1 R xterm none"
x2go-DEBUG-../src/sshprocess.cpp:199> Executing remote command via SshProcess object 1: "X2GODPI=110 X2GO_XINERAMA=no x2gostartagent 800x600 wan adaptive-9 unix-kde-depth_24 us auto 1 R xterm none"
x2go-DEBUG-../src/sshprocess.cpp:213> this=SshProcess(0x5564bc3af680) Running masterCon->addChannelConnection(this, '"e126dadb-9107-4fa3-9476-a002ca38518e"', '"bash -l -c 'echo \"X2GODATABEGIN:e126dadb-9107-4fa3-9476-a002ca38518e\"; export PATH=\"/usr/local/bin:/usr/bin:/bin\";export TERM=\"dumb\"; X2GODPI=110 X2GO_XINERAMA=no x2gostartagent 800x600 wan adaptive-9"');
x2go-DEBUG-../src/sshmasterconnection.cpp:1810> Locking SSH channel connection MUTEX.
x2go-DEBUG-../src/sshmasterconnection.cpp:1812> Passing new channel connection object to channelConnections.
x2go-DEBUG-../src/sshmasterconnection.cpp:1814> Unlocking SSH channel connection MUTEX.
x2go-DEBUG-../src/sshmasterconnection.cpp:1977> Creating new channel.
x2go-DEBUG-../src/sshmasterconnection.cpp:1990> New channel:0x7f691800e050
x2go-DEBUG-../src/sshmasterconnection.cpp:2065> Executing remote: "bash -l -c 'echo \"X2GODATABEGIN:e126dadb-9107-4fa3-9476-a002ca38518e\"; export PATH=\"/usr/local/bin:/usr/bin:/bin\";export TERM=\"dumb\"; X2GODPI=110 X2GO_XINERAMA=no x2gostartagent 800x600 wan adaptive-9 unix-kde-depth_24 us auto 1 R xterm none; echo \"X2GODATAEND:e126dadb-9107-4fa3-9476-a002ca38518e\";'"
x2go-DEBUG-../src/sshmasterconnection.cpp:2082> New exec channel created.
这是超时后的输出:
x2go-DEBUG-../src/sshmasterconnection.cpp:2121> EOF on channel 0x7f691800e050; SshProcess object: 1
x2go-DEBUG-../src/sshmasterconnection.cpp:2222> EOF sent.
x2go-DEBUG-../src/sshmasterconnection.cpp:2224> Channel closed.
x2go-DEBUG-../src/sshprocess.cpp:532> SSH finished: raw output (stdout): "X2GODATABEGIN:e126dadb-9107-4fa3-9476-a002ca38518e\n50\ncb2fbd6169e3caf0420c47033c1c266d\n35854\nmhier-50-1605199275_stRxterm_dp24\n41512\n41513\n41514\nX2GODATAEND:e126dadb-9107-4fa3-9476-a002ca38518e\n"
x2go-DEBUG-../src/sshprocess.cpp:543> SSH finished: true - "50\ncb2fbd6169e3caf0420c47033c1c266d\n35854\nmhier-50-1605199275_stRxterm_dp24\n41512\n41513\n41514\n" (1).
x2go-DEBUG-../src/onmainwindow.cpp:5425> Agent output: "50\ncb2fbd6169e3caf0420c47033c1c266d\n35854\nmhier-50-1605199275_stRxterm_dp24\n41512\n41513\n41514\n"
x2go-DEBUG-../src/sshprocess.cpp:387> Starting tunnel via SshProcess object 2: "localhost":41512 -> "localhost":42512
RESUMING SESSION is KDRIVE: false
x2go-DEBUG-../src/onmainwindow.cpp:6142> "Starting NX proxy, command: nxproxy -S nx/nx,options=/home/mhier/.x2go/S-mhier-50-1605199275_stRxterm_dp24/options:50"
x2go-DEBUG-../src/sshprocess.cpp:157> Direct tunnel: waiting for connections on "localhost":42512
x2go-DEBUG-../src/onmainwindow.cpp:6618> Proxy wrote on stderr: "\nNXPROXY - Version 3.5.99.23\n\nCopyright (c) 2001, 2011 NoMachine (http://www.nomachine.com)\nCopyright (c) 2008-2014 Oleksandr Shneyder <[email protected]>\nCopyright (c) 2014-2016 Ulrich Sibiller <[email protected]>\nCopyright (c) 2014-2016 Mihai Moldovan <[email protected]>\nCopyright (c) 2011-2016 Mike Gabriel <[email protected]>\nCopyright (c) 2015-2016 Qindel Group (http://www.qindel.com)\n\nNXCOMP, NX protocol compression and NX extensions to this software\nare copyright of the aforementioned persons and companies.\n\nRedistribution and use of the present software is allowed according\nto terms specified in the file LICENSE.nxcomp which comes in the\nsource distribution.\n\nAll rights reserved.\n\nNOTE: This software has received contributions from various other\ncontributors, only the core maintainers and supporters are listed as\ncopyright holders. Please contact us, if you feel you should be listed\nas copyright holder, as well.\n\nNX protocol compression is derived from DXPC project.\n\nCopyright (c) 1995,1996 Brian Pane\nCopyright (c) 1996,1997 Zachary Vonler and Brian Pane\nCopyright (c) 1999 Kevin Vigor and Brian Pane\nCopyright (c) 2000,2003 Gian Filippo Pinzari and Brian Pane\n\nAll rights reserved.\n\nSee https://github.com/ArcticaProject/nx-libs for more information.\n\nInfo: Proxy running in server mode with pid '130209'.\nSession: Starting session at 'Thu Nov 12 17:42:15 2020'.\nInfo: Using errors file '/home/mhier/.x2go/S-mhier-50-1605199275_stRxterm_dp24/sessions'.\nInfo: Using stats file '/home/mhier/.x2go/S-50/stats'.\nLoop: WARNING! Overriding auxiliary X11 port with new value '1'.\nWarning: Overriding auxiliary X11 port with new value '1'.\nInfo: Using abstract X11 socket in kernel namespace for accessing DISPLAY=:0.\nInfo: Connecting to remote host 'localhost:42512'.\nInfo: Connected to remote proxy on FD#5.\n"
x2go-DEBUG-../src/sshprocess.cpp:109> New TCP connection.
x2go-DEBUG-../src/sshprocess.cpp:114> New socket: 27
x2go-DEBUG-../src/sshmasterconnection.cpp:1977> Creating new channel.
x2go-DEBUG-../src/sshmasterconnection.cpp:1990> New channel:0x7f691800f1b0
x2go-DEBUG-../src/sshmasterconnection.cpp:1994> Forwarding parameters: from remote ("localhost":41512) to local ("localhost":49576)
x2go-DEBUG-../src/sshmasterconnection.cpp:2028> Temporary session port after config file parse: 41512
x2go-DEBUG-../src/sshmasterconnection.cpp:2032> Temporary session host after config file parse: localhost
x2go-DEBUG-../src/sshmasterconnection.cpp:2055> "ssh_channel_open_forward failed": "Channel opening failure: channel 46 error (2) Connection refused"
x2go-DEBUG-../src/sshmasterconnection.cpp:2187> "ssh_channel_write failed": "Remote channel is closed"
x2go-DEBUG-../src/sshprocess.cpp:478> I/O error: "ssh_channel_open_forward failed."" - Channel opening failure: channel 46 error (2) Connection refused" (2).
x2go-DEBUG-../src/sshmasterconnection.cpp:2222> EOF sent.
x2go-DEBUG-../src/sshprocess.cpp:478> I/O error: "ssh_channel_write failed."" - Remote channel is closed" (2).
x2go-DEBUG-../src/sshmasterconnection.cpp:2224> Channel closed.
x2go-DEBUG-../src/onmainwindow.cpp:6618> Proxy wrote on stderr: "Loop: PANIC! The remote NX proxy closed the connection.\nError: The remote NX proxy closed the connection.\n"
x2go-DEBUG-../src/onmainwindow.cpp:6618> Proxy wrote on stderr: "Loop: PANIC! Failure negotiating the session in stage '7'.\nError: Failure negotiating the session in stage '7'.\nLoop: PANIC! Wrong version or invalid session authentication cookie.\nError: Wrong version or invalid session authentication cookie.\nSession: Terminating session at 'Thu Nov 12 17:42:16 2020'.\nSession: Session terminated at 'Thu Nov 12 17:42:16 2020'.\n"
x2go-DEBUG-../src/onmainwindow.cpp:6475> Deleting Proxy.
x2go-DEBUG-../src/onmainwindow.cpp:6520> Waiting for proxy to exit.
x2go-DEBUG-../src/onmainwindow.cpp:6544> Checking exit status.
x2go-DEBUG-../src/sshprocess.cpp:199> Executing remote command via SshProcess object 3: "x2gocmdexitmessage mhier-50-1605199275_stRxterm_dp24"
x2go-DEBUG-../src/sshprocess.cpp:213> this=SshProcess(0x5564bc394850) Running masterCon->addChannelConnection(this, '"cdc02d73-ae8a-461a-960c-5ef546074b82"', '"bash -l -c 'echo \"X2GODATABEGIN:cdc02d73-ae8a-461a-960c-5ef546074b82\"; export PATH=\"/usr/local/bin:/usr/bin:/bin\";export TERM=\"dumb\"; x2gocmdexitmessage mhier-50-1605199275_stRxterm_dp24; echo \"X2GODA"');
x2go-DEBUG-../src/sshmasterconnection.cpp:1810> Locking SSH channel connection MUTEX.
x2go-DEBUG-../src/sshmasterconnection.cpp:1812> Passing new channel connection object to channelConnections.
x2go-DEBUG-../src/sshmasterconnection.cpp:1814> Unlocking SSH channel connection MUTEX.
x2go-DEBUG-../src/onmainwindow.cpp:6601> Finished proxy.
x2go-DEBUG-../src/sshmasterconnection.cpp:1977> Creating new channel.
x2go-DEBUG-../src/sshmasterconnection.cpp:1990> New channel:0x7f691800cb10
x2go-DEBUG-../src/sshmasterconnection.cpp:2065> Executing remote: "bash -l -c 'echo \"X2GODATABEGIN:cdc02d73-ae8a-461a-960c-5ef546074b82\"; export PATH=\"/usr/local/bin:/usr/bin:/bin\";export TERM=\"dumb\"; x2gocmdexitmessage mhier-50-1605199275_stRxterm_dp24; echo \"X2GODATAEND:cdc02d73-ae8a-461a-960c-5ef546074b82\";'"
x2go-DEBUG-../src/sshmasterconnection.cpp:2071> "ssh_channel_open_session failed": "Received SSH_MSG_DISCONNECT: 2:ieof packet referred to nonexistent channel 0"
x2go-DEBUG-../src/sshprocess.cpp:478> I/O error: "ssh_channel_open_session failed."" - Received SSH_MSG_DISCONNECT: 2:ieof packet referred to nonexistent channel 0" (3).
这是session.log的内容:
running as X2Go Agent
NXAGENT - Version 3.5.99.23
Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com)
Copyright (c) 2008-2014 Oleksandr Shneyder <[email protected]>
Copyright (c) 2011-2016 Mike Gabriel <[email protected]>
Copyright (c) 2014-2016 Ulrich Sibiller <[email protected]>
Copyright (c) 2014-2016 Mihai Moldovan <[email protected]>
Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com)
See https://github.com/ArcticaProject/nx-libs for more information.
Info: Agent running with pid '35854'.
Session: Starting session at 'Thu Nov 12 17:41:15 2020'.
Info: Proxy running in client mode with pid '35854'.
Info: Using errors file '/tmp/.x2go-mhier/C-mhier-50-1605199275_stRxterm_dp24/session.log'.
Info: Using stats file '/tmp/.x2go-mhier/C-mhier-50-1605199275_stRxterm_dp24/C-mhier-50-1605199275_stRxterm_dp24/stats'.
Loop: WARNING! Unrecognized session type 'unix-kde-depth_24'. Assuming agent session.
Warning: Unrecognized session type 'unix-kde-depth_24'. Assuming agent session.
Info: Waiting for connection from 'localhost' on socket 'tcp:*:41512'.
Info: Aborting the procedure due to signal '1'.
Error: Aborting session with 'Unable to open display 'nx/nx,options=/tmp/.x2go-mhier/C-mhier-50-1605199275_stRxterm_dp24/options:50''.
Session: Aborting session at 'Thu Nov 12 17:42:15 2020'.
Session: Session aborted at 'Thu Nov 12 17:42:15 2020'.
注意:我已经尝试使用 ppa:x2go/ppa 的最新版本,但问题与最新稳定版本相同。
我还验证了我能够通过 ssh 端口转发和 netcat 连接到 x2goagent 端口 - 在这种情况下,我在 session.log 中看到了一些反应。此外,这个问题与我连接的客户端无关,即使从同一台机器连接也不起作用。
答案1
序言
在我开始讨论这个问题之前,我必须说,x2go 在工作时确实非常好用。它速度很快,并且很好地支持多台显示器。
右心室
我遇到过类似的问题,并进行了一些挖掘,试图找出问题所在。
就我的情况而言,我会启动客户端并尝试连接到服务器。一分钟后,我会在客户端中短暂看到 PANIC 消息,然后什么都没有。除非您从命令行使用 --debug 启动 x2go 客户端,否则无法看到错误消息。
真的,真的没有帮助。
就我个人而言,rvm 突出显示了问题。其他人也看到了同样的情况:
- https://johnnn.tech/q/after-update-to-ubuntu-20-04-problmes-with-x2go-login/
- https://lists.x2go.org/pipermail/x2go-user/2020-April/005962.html
根本原因
这一切的线索都可以在几年前的这条消息中找到:https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1091#10
其中关键部分是这样的声明:
较新的 X2Go 客户端版本开始将 bash 调用为登录 shell,这意味着执行 ~/.profile、~/.bash_profile、~/.bashrc 等脚本。如果其中有任何输出到 stderr 的内容,X2Go 客户端将中止连接。
我对此有几个主要疑问:
- 首先,没有解释为什么使用登录 shell。
- 调用 .profile、.bash_profile 和 .bashrc 的原因也一样。这可能会导致 PATH 问题,因为在 x2go 会话中打开的任何终端实际上都会多次调用 .profile(等等)。
- 如果某些内容输出到 stderr,那么客户端失败是没有意义的。
这似乎是由于 x2go 开发人员的懒惰、一些模糊的推理以及未能实施适当的错误处理造成的。
正确的解决方案
这是 x2go 开发人员造成的问题,他们应该解决这个问题。因此,他们需要考虑以下几点:
- 放弃对用户登录脚本的调用
- 修复错误处理机制并提供有意义的错误消息
- 不要不必要地让整个过程失败——即忽略 stderr 输出
在现实世界
我并不期望上述任何提议能够真正实现,因此实际上你需要竭尽全力来解决这些愚蠢的问题。因此:
- 确保您的登录脚本没有任何错误
- 确保您的登录脚本(.bash_profile、.profile、.bashrc)不会输出到 stderr。
一种方法是在这些脚本的各处附加 2>/dev/null。
因此,对于那些使用 rvm 更改的人来说:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
到:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 2>/dev/null # Load RVM into a shell session *as a function*
我希望这对某些人有帮助。这个不起眼的问题浪费了我太多时间,不应该让其他人受苦。
答案2
我在 Windows 10 上遇到了同样的问题,在主机中添加“127.0.0.1 localhost”条目并清除 %USERDIR%/.ssh/config 文件有助于使其正常工作。