1

I have upgraded by PC to Ubuntu 20.04 (from 16.04, with an intermediate step to 18.04). Now I am no longer able to connect to it via x2go. On the client, I see is stuck at "connecting" until it runs into timeout ("The remote proxy closed the connection while negotiating the session. [...]"). On the server, I can see that the x2goagent is actually started and waiting for an incoming connection, which seems to never happen. I have already tried purging all x2go-related packages from the machine and deleting all x2go-related configuration files, then reinstalling the x2goserver package with no luck.

Here is the output from x2goclient --debug until it is stuck at "connecting":

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.

This is the output after the timeout:

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 <o.shneyder@phoca-gmbh.de>\nCopyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de>\nCopyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de>\nCopyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>\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 &quot;X2GODATABEGIN:cdc02d73-ae8a-461a-960c-5ef546074b82&quot;; export PATH=&quot;/usr/local/bin:/usr/bin:/bin&quot;;export TERM=&quot;dumb&quot;; x2gocmdexitmessage mhier-50-1605199275_stRxterm_dp24; echo &quot;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 &quot;X2GODATABEGIN:cdc02d73-ae8a-461a-960c-5ef546074b82&quot;; export PATH=&quot;/usr/local/bin:/usr/bin:/bin&quot;;export TERM=&quot;dumb&quot;; x2gocmdexitmessage mhier-50-1605199275_stRxterm_dp24; echo &quot;X2GODATAEND:cdc02d73-ae8a-461a-960c-5ef546074b82&quot;;'"

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).

This is the content of the 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 <o.shneyder@phoca-gmbh.de> Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> 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'.

Note: I have already tried using the latest version from ppa:x2go/ppa, but the issue is the same as for the latest stable release.

I have also verified that I am able to connect to the x2goagent port through ssh port forwarding and netcat - in that case I am seeing some reaction in the session.log. Also the issue is independent from which client I am connecting, even connecting from the same machine does not work.

2 Answers2

2

Premable

Before I go off on one about this, I have to say that when it works x2go is actually really quite good. It's fast and supports multiple monitors well.

RVM

I have had a similar problem and done a bit of digging to try to work out what the problem is.

In my case what would happen was that I'd start up the client and try to connect to the server. After a minute I'd briefly see the PANIC message in the client and then nothing. No way to see the error message unless you start x2go client with --debug from the command line.

Really, really not helpful.

In my personal situation it was rvm that highlighted the issues. Others have seen the same:

Root Cause

The clue to it all can be found in this message from a number of years ago: https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1091#10

The key part of it is the statement:

Newer X2Go Client versions started calling bash as a login shell, which implies executing scripts like ~/.profile, ~/.bash_profile, ~/.bashrc and the like. If you have anything in there that outputs to stderr, X2Go Client will abort the connection.

I have some major issues with this:

  1. Firstly, there's no explanation why a login shell is used.
  2. The same applies to why .profile, .bash_profile and .bashrc are called. This can cause PATH problems as any terminals opened in an x2go session will effectively have .profile (et al) called multiple times.
  3. It makes no sense for the client to fail if something outputs to stderr.

This seems to be borne out of laziness, some obscure reasoning and a failure to implement proper error handling on the part of x2go developers.

Correct Solution

This is a problem created by the x2go developers and they should be the ones to fix it. So they need to look at the following:

  • Drop the calls to user login scripts
  • Fix the error handling mechanisms and provide meaningful error messages
  • Don't fail the entire process unnecessarily - namely ignore stderr output

In the Real World

I don't expect any of the above proposals to actually happen so in reality you need to go to some lengths to workaround these dumb issues. So:

  • Make sure your login scripts don't have any errors in them
  • Make sure your login scripts (.bash_profile, .profile, .bashrc) don't output to stderr.

One way to do this is to append 2>/dev/null all over the place in these scripts.

So for those of you using rvm change:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

to:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 2>/dev/null  # Load RVM into a shell session *as a function*

I hope this helps someone. This obscure issue has wasted far too much of my time and nobody else should suffer as a result.

0

I had the same problem on Windows 10, adding '127.0.0.1 localhost' entry in hosts and clearing %USERDIR%/.ssh/config file helped to get it working.