Dec
09
2008

FreeNX failure in Fedora 9 + 10 default setup SOLVED

I’ve been having a bunch of problems with FreeNX since an upgrade in Fedora 8.  Since then I have not been able to get the default setup to work on fedora 9 or 10.  The problem is that the logs from FreeNX and Nomachine indicate several errors totally unrelated to the connection failure.

Here are the symptoms:

– SSH authentication successful

– DSA key passes fine

Nomachine log from Windows XP client:

NX> 203 NXSSH running with pid: 3308
NX> 285 Enabling check on switch command
NX> 285 Enabling skip of SSH config files
NX> 285 Setting the preferred NX options
NX> 200 Connected to address: 192.168.1.254 on port: 22
NX> 202 Authenticating user: nx
NX> 208 Using auth method: publickey
HELLO NXSERVER – Version 3.2.0-73 OS (GPL, using backend: 3.2.0)
NX> 105 hello NXCLIENT – Version 3.2.0
NX> 134 Accepted protocol: 3.2.0
NX> 105 SET SHELL_MODE SHELL
NX> 105 SET AUTH_MODE PASSWORD
NX> 105 login
NX> 101 User: mattnx
NX> 102 Password:
NX> 103 Welcome to: mattcom1 user: mattnx
NX> 105 listsession –user=”mattnx” –status=”suspended,running” –geometry=”1680x1050x32+render” –type=”unix-gnome”
NX> 127 Sessions list of user ‘mattnx’ for reconnect:

Display Type             Session ID                       Options  Depth Screen         Status      Session Name
——- —————- ——————————– ——– —– ————– ———– —————————–
NX> 148 Server capacity: not reached for user: mattnx
NX> 105 startsession  –link=”lan” –backingstore=”1″ –encryption=”1″ –cache=”16M” –images=”64M” –shmem=”1″ –shpix=”1″ –strict=”0″ –composite=”1″ –media=”0″ –session=”fedora10home” –type=”unix-gnome” –geometry=”1024×768″ –client=”winnt” –keyboard=”pc102/en_US” –screeninfo=”1024x768x32+render”
NX> 1000 NXNODE – Version 3.2.0-73 OS (GPL, using backend: 3.2.0)
NX> 700 Session id: mattcom1-1000-1C6F198B66C712B066D30A14269FD76E
NX> 705 Session display: 1000
NX> 703 Session type: unix-gnome
NX> 701 Proxy cookie: 39a5af5faf2df5a8425bb311f873d83f
NX> 702 Proxy IP: 127.0.0.1
NX> 706 Agent cookie: 39a5af5faf2df5a8425bb311f873d83f
NX> 704 Session cache: unix-gnome
NX> 707 SSL tunneling: 1
NX> 105 NX> 596 Session startup failed.
NX> 1004 Error: NX Agent exited with exit status 1. To troubleshoot set SESSION_LOG_CLEAN=0 in node.conf and investigate “/home/mattnx/.nx/F-C-mattcom1-1000-1C6F198B66C712B066D30A14269FD76E/session”. You might also want to try: ssh -X myserver; /usr/libexec/nx/nxnode –agent to test the basic functionality. Session log follows:
/usr/libexec/nx/nxserver: line 1531:  5052 Terminated              sleep $AGENT_STARTUP_TIMEOUT
NX> 1006 Session status: closed
Can’t open /var/lib/nxserver/db/running/sessionId{1C6F198B66C712B066D30A14269FD76E}: No such file or directory.
mv: cannot stat `/var/lib/nxserver/db/running/sessionId{1C6F198B66C712B066D30A14269FD76E}’: No such file or directory
NX> 1001 Bye.
/usr/libexec/nx/nxserver: line 562: kill: (4746) – No such process
NX> 280 Exiting on signal: 15

So every freenx forum under the sun advises you to run a couple commands to check your installation.  Let me point out that 90% of that advise is bullshit.  Doing a search for ‘$AGENT_STARTUP_TIMEOUT’ in google turns up many people concerned about this message.  The general advise for checking the server goes like this, “enable logging in the ‘/etc/nxserver/node.conf’, check output from ‘/usr/libexec/nx/nxagent’ command, check output from ‘/usr/libexec/nx/nxloadconfig –check’ command.”  Lets go through these one by one.

1.  Enable logging on the freenx server.

If you correctly installed your client DSA key you already probably know that the main configuration file for freenx is located in the ‘/etc/nxserver’ directory.  Freenx assumes the defaults unless you specifically edit the ‘node.conf.sample’ and save it as ‘node.conf’.

[root@mattcom1 nxserver]# ls /etc/nxserver/
client.id_dsa.key  node.conf~        server.id_dsa.pub.key  users.id_dsa.pub
node.conf          node.conf.sample  users.id_dsa

[root@mattcom1 nxserver]# nano node.conf.sample

#########################################################################
# Logging directives
#########################################################################
# This directives controls the verbosity of the server-wide log.
# 0: No Logging
# 1: Errors
# 2: Warnings
# 3: Important information
# 4: Server – Client communication
# 5: Information
# 6: Debugging information
# 7: stderror of some applications
NX_LOG_LEVEL=7
#
# By setting this to 0 the nxserver might be a bit faster, but passwords can be found in the log files.
NX_LOG_SECURE=1
#
# Before turning logging on, please make sure that NX_LOGFILE is
# writeable for the “nx” user
NX_LOGFILE=/var/log/nx/nxserver.log

Remember to make sure the ‘nx’ user has permissions to write logs to the specified directory.

3.  Testing nxagent

Freenx makes use of nxagent(a virtual xserver) that acts as a proxy for nx connections to open and manage remote X desktops.  Lets run the command and see if we get an error.

[root@mattcom1 nxserver]# nxagent
Error: Aborting session with ‘Server is already active for display 0
If this server is no longer running, remove /tmp/.X0-lock
and start again’.
Session: Aborting session at ‘Tue Dec  9 01:19:04 2008’.
Session: Session aborted at ‘Tue Dec  9 01:19:04 2008’.

This got me thinking.  After a lot of dead leads attempting to solve a bogus command $PATH issue, I thought maybe nx was just fine and this was xorg or xserver issue.  So I double checked and installed additional xorg fonts.  Then I had a brain storm.  What if I log out of X to run level 3(command prompt)?  So I logged out of my Linux nxserver and attempted to open a freenx session from my windows xp client(nomachine).  It worked…  I realized that it worked the whole time as long you’re not logged into X windows on the server.

I began scouring the Nomachine NX documentation.  After doing some research I noticed that under the nxagent documentation virtual xserver connections where by default opened on TCP port 1000.  So I thought it was entirely reasonable that the real xserver might be opening a session on the same port causing a conflict between xorg xserver and the nxagent.

This proved to be correct.  I changed a directive in the node.conf to fix the problem.  I changed ‘DISPLAY_BASE=1000’ to ‘DISPLAY_BASE=1001’.  Now I can login to remote NX sessions even if the server running FreeNX has it’s desktop running.

Freenx now works!





14 Comments »

  • scott

    Installing a server in the remote hinterlands of oregon, nx had trouble connecting.

    After inspecting a session file in /root/.nx it claimed that the port was in use by X11 and couldn’t be used by nx.

    this google search string led me here to the answer:

    ” nx uses the same port as x11, failure ”

    changed ‘DISPLAY_BASE=1000′ to ‘DISPLAY_BASE=1001′ worked perfectly

    Thanks

    Comment | March 21, 2009
  • mattb

    No problem, that one burned me for days, because of the dead ends.

    Comment | March 21, 2009
  • vldo

    I installed freenx on Fedora 11 and had similar problem. So i copied node.conf.sample to node.conf without changing anything and it started working (everything in node.conf is commented)

    Comment | May 12, 2009
  • Christian Gutierrez

    Hi i installed freenx on Fedora 10 x86_64, and i can’t connect a linux client, at the moment i don’t have a windows machine; have anyone probed the connection with a linux client?.

    Comment | May 19, 2009
  • I’ve used Mac, Windows, and Linux client. So far as I can tell they all work well, but the Mac client requires X Windows to be installed and the Linux client sometimes incorrectly maps the keys.

    Comment | May 19, 2009
  • Josh

    Wow thanks so much, i have been poring over the logs for this nx problem..i have two desktops one running KDE and the other running XFCE and the XFCE one has been having the problems…
    first the ~/.Xauthority was owned by root, and finally i found this page that described my error exactly and after setting the ‘DISPLAY_BASE=1001′ it worked!

    thanks

    Comment | January 3, 2010
  • mattb

    You’re most welcome, thank you for visiting!

    Comment | January 8, 2010
  • John

    Thanks for the info, much appreciated. I was writing to say that I could not get connections to work, regardless of what I tried. I then realised that I had left my various test clients set to use unencrypted connections and that was the problem. Change the base display port and leave traffic encrypted (and I’ve lost track of the other many changes made prior to doing that 🙁 ). Really didn’t expect this level of frustration given that I have had almost no issues with nx under Centos which I use heavily at work. That’s the linux world for you. Cheers.

    Comment | January 25, 2010
  • bill

    I’m having similar issues w/ Fedora 12 (on both the client and server).

    The end of the nxserver.log looks like:
    server_nxnode_echo: NX> 702 Proxy IP: 192.168.50.10
    server_nxnode_echo: NX> 706 Agent cookie: 2d117415220e087ba69098340160bb04
    server_nxnode_echo: NX> 704 Session cache: unix-gnome
    server_nxnode_echo: NX> 707 SSL tunneling: 1
    nxnode_reader: NX> 1009 Session status: starting
    NX> 1009 Session status: starting
    nxnode_reader: NX> 710 Session status: running
    NX> 710 Session status: running
    nxnode_reader: NX> 1002 Commit
    NX> 1002 Commit
    server_nxnode_echo: NX> 1009 Session status: starting
    nxnode_reader: NX> 1006 Session status: running
    NX> 1006 Session status: running
    server_nxnode_echo: NX> 710 Session status: running
    server_nxnode_echo: NX> 1002 Commit
    NX> 105 session_status 22D6D471CE1988CF4B6BFEC14B4347C7 Running
    bye
    Bye
    NX> 999 Bye
    server_nxnode_echo: NX> 1006 Session status: running

    The end of the qtnx output looks like:
    NX> 705 Session display: 1005
    NX> 703 Session type: unix-gnome
    NX> 701 Proxy cookie: 2d117415220e087ba69098340160bb04
    NX> 702 Proxy IP: 192.168.50.10
    NX> 706 Agent cookie: 2d117415220e087ba69098340160bb04
    NX> 704 Session cache: unix-gnome
    NX> 707 SSL tunneling: 1
    NX> 1009 Session status: starting
    NX> 710 Session status: running
    NX> 1002 Commit
    NX> 105
    stdin> bye
    stdout> bye
    stderr> /usr/libexec/nx/nxserver: line 1585: 14420 Terminated sleep $AGENT_STARTUP_TIMEOUT
    Bye
    NX> 999 Bye
    NX> 1006 Session status: running
    Starting NX proxy
    NX_COMMFD=23Process started
    stderr>
    Segmentation fault

    (seg fault after i get a gui pop up saying it can’t connect to the session)

    Comment | March 2, 2010
  • bill

    I can connect using the nomachine nx client, but not qtnx. so I think the problem is there…

    Comment | March 2, 2010
  • mattb

    Your logs show ‘NX> 705 Session display: 1005’. So you’re probably okay. Try using the free nomachine client and see if you have the same error. Let me know!

    Comment | March 3, 2010
  • 5parky

    I had the same problem you did using the windows client on an oneiric server. I chmod’d the directory that the session ID was in (/var/lib/nxserver/db/running/)

    That fixed the problem.

    Comment | January 31, 2012
  • awi

    Have much thanks!!!

    This issue, solving by just setting in the end “DISPLAY_BASE=xxxx”, has fixed several problems for me. But it bothered me 3 days! (And I tried many package reinstallations and configurations!!!) I’ve installed two CentOS 6.2 Servers running KVM virtualization on it, and it’s much easier to handle it via virtual machine manager on the desktop remotely.

    This solution also fixes the problem of connecting 2 CentOS Servers via NX-Client parallely at the same time. But the problem only occurrs to CentOS, maybe also other Red Hat distributions. Connecting to an Ubuntu Server and CentOS-Server at the same time was no problem. Hmm, finally I can only say “Thaaaaaaaaaaaaaaannnnnnks!!!” 🙂

    Comment | March 21, 2012
  • mattb

    You’re welcome, I spent weeks working on this and the issue where the arrow keys take screen shots!

    Comment | March 21, 2012

RSS feed for comments on this post. TrackBack URL

Leave a comment