[FreeNX-kNX] nxcl and nxlaunch -> attempt to make them work

Wilhelm Tell wilhelmtell80 at gmx.de
Tue May 13 09:46:42 UTC 2008


Hi!

I can't use the NoMachine NXclient, so I have to use another implementation and I came across the nxcl part of this project.

First I installed the freenx nxserver. This worked right from the start and I can use NX with the NXclient from NoMachine with no problems at all.

But as I said, I can't use NoMachine's NXclient.

I'm using SVN rev 543 (head) from svn://svn.berlios.de/freenx/trunk to build the lib and programs and the 3.2 versions of nxcomp, nxssh and nxproxy from NoMachine.

I build the software in this order:
nxcomp. nxssh, nxproxy, nxcl, nxlaunch

Things hardly ever work for me on first attempt ...

The first problem was the ssh keyfile. Apparently ssh does not like keyfiles with 644 permissions, but that's exactly what this line
this->f.open (this->theFileName.c_str(), ios::in|ios::out|ios::trunc);
does in void notQTemporaryFile::open (void) ( see file freenx-client/nxcl/lib/notQt.cpp )
As I have no idea about setting filepermissions in C++ I worked around this by NOT creating the filename at runtime doing this:

--- freenx-client/nxcl/lib/notQt.cpp.org	2008-05-11 11:44:48.000000000 +0200
+++ freenx-client/nxcl/lib/notQt.cpp	2008-05-11 11:45:25.000000000 +0200
@@ -355,7 +355,7 @@
 notQTemporaryFile::open (void)
 {
     stringstream fn;
-    fn << "/tmp/notQt" << time(NULL);
+    fn << "/tmp/notQtkey";
     this->theFileName = fn.str();
     this->f.open (this->theFileName.c_str(), ios::in|ios::out|ios::trunc);
 }

This does not solve the immediate problem but now I can launch nxlaunch like this: touch /tmp/notQtkey; chmod 600 /tmp/notQtkey; nxlaunch
I admit, programs should bow to the will of the user, not the other way round, but for now this shall be my solution.

There were many more problems and I don't remeber in which order I identified and solved them. However this is what I came up with:

1. sessionData.terminate is uninitialized and even though g_malloc0 is used my computer seemes to think sessionData.terminate is set to true right from the start. Once I traced a not working nxlaunch back to that problem the fix was easy:

--- freenx-client/nxcl/nxcl/nxcl.cpp.org	2008-05-11 00:01:24.000000000 +0200
+++ freenx-client/nxcl/nxcl/nxcl.cpp	2008-05-11 00:08:03.000000000 +0200
@@ -434,6 +434,7 @@
 	this->sessionData.fullscreen = false; // If true, session.geometry
 					  // is ignored
 	this->sessionData.virtualDesktop = false;
+	this->sessionData.terminate = false;
 
 	return;
 }

2. There is a boolean variable NXSession::sessionDataSet which by name and use indicates that it should be set to true when sessionData has been set. However this only happens when connecting to an existing session. I figured the method NXSession::setSessionData is a good place to fix that:

--- freenx-client/nxcl/lib/nxsession.cpp.org
+++ freenx-client/nxcl/lib/nxsession.cpp

@@ -469,6 +473,7 @@
 void NXSession::setSessionData (NXSessionData *sd)
 {
     this->sessionData = sd;
+    sessionDataSet = true;
 }
 
 int NXSession::parseResponse(string message)

After this nxlaunch and qtnx work equally well for me. They both start nxproxy and the time out. It would seem a whole lot of things are involved in this and I can't explain why I did what I did but eventually I got a little further.
nxlaunch only works properly when I start it a Xnest session. It does not work when I simply run nxlaunch. First I create the Xnest session

Xnest :1234 -audit 0 -ac -geometry 800x600 &

Then I start nxlaunch

touch /tmp/notQtkey; chmod 600 /tmp/notQtkey; DISPLAY=:1234 nxlaunch

This way nxlaunch works so much more like I expect from reading the source. The status bar works (it doesn't when running on display :0 ) and the (end of the) terminal outout looks like this:

NXLAUNCH> Server says "Connection"
NXLAUNCH> receiveSession() returned 2
NXLAUNCH> Received session
nxssh-stdout->
NX> 1000 NXNODE - Version 1.5.0-70 OS (GPL)

nxssh-stdout->
NX> 700 Session id: appletree-1000-0F864C6277EBD7FF682DA8891759FA51
NX> 705 Session display: 1000
NX> 703 Session type: unix-application
NX> 701 Proxy cookie: bf342eeea37e40dd4fc7e6b19a4e9ffe
NX> 702 Proxy IP: 127.0.0.1
NX> 706 Agent cookie: bf342eeea37e40dd4fc7e6b19a4e9ffe
NX> 704 Session cache: unix-application
NX> 707 SSL tunneling: 1
NX> 1009 Session status: starting
NX> 710 Session status: running
NX> 1002 Commit
NX> 105 
nxssh<-stdin-
bye

nxssh-stderr->
/usr/bin/nxserver: line 1203:  9444 Terminated              sleep $AGENT_STARTUP_TIMEOUT

nxssh-stdout->
bye

nxssh-stderr->
Bye
NX> 999 Bye

NX_COMMFD=9(NXCL)> Info:  'Got a session ID' d700
(NXCL)> Info:  'Got a proxy IP' d702
(NXCL)> Info:  'Got an agent cookie' d706
(NXCL)> Info:  'All data will be SSL tunnelled' d702
(NXCL)> Info:  'Session status is "running"' d710
(NXCL)> Info:  'Starting NX session' d1000007
(NXCL)> Info:  '/home/bill/programs/bin/nxproxy process started' d1000001

... which reads very promising to me, but I wouldn't be writing this to the ML, if it had worked :-)

As far as I can tell nxproxy dies shortly (not to say "right") after starting. ps shows [nxproxy] <defunct>.

The directory ~/.nx/F-C-[...]/ contains depressingly few information

authority:
(empty)

clients:
_XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
_XSERVTransOpen: transport open failed for inet6/appletree:1000
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6

errors:
(empty)

options:
cache=8M,images=24M,pack=nopack,link=wan,nodelay=1,type=unix-desktop,cleanup=0,accept=127.0.0.1,cookie=bf342eeea37e40dd4fc7e6b19a4e9ffe,id=appletree-1000-0F864C6277EBD7FF682DA8891759FA51,samba=0,media=0:1000

stats:
(empty)

session:

NXAGENT - Version 3.1.0

Copyright (C) 2001, 2007 NoMachine.
See http://www.nomachine.com/ for more information.

Info: Agent running with pid '9674'.
Session: Starting session at 'Tue May 13 11:16:09 2008'.
Info: Proxy running in server mode with pid '9674'.
Info: Waiting for connection from '127.0.0.1' on port '5000'.
Info: Accepted connection from '127.0.0.1'.
Info: Aborting the procedure due to signal '1'.
Error: Aborting session with 'Unable to open display 'nx/nx,options=/home/vnc/.nx/C-appletree-1000-0F864C6277EBD7FF682DA8891759FA51/options:1000''.
Session: Aborting session at 'Tue May 13 11:17:09 2008'.
Session: Session aborted at 'Tue May 13 11:17:09 2008'.
XIO:  fatal IO error 104 (Connection reset by peer) on X server ":1000.0"
      after 0 requests (0 known processed) with 0 events remaining.
xterm Xt error: Can't open display: :1000

and for completeness
pids/applications:
9694

scripts/authority:
remove localhost:1000
remove :1000
exit

Why does xterm throw the error? I once read in a logfile that unix-gnome is unknown to the server, so i switched to unix-desktop and picked xterm as my custom command. I did this with nxlauncher and this is sort of a success because this setting is obviously transmitted to the server because the NoMachine client will do exactly that: not launch gnome-session anymore but give me a simple xterm.

That's it. That's the result of a few hours of work. I hope somebody can tell how to fix this because my next steps would be to help the server along to provide more output, which means fiddeling with the build process and source of the server and I really would like to avoid that.

Bill


-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger



More information about the FreeNX-kNX mailing list