Dec
09
2008
14

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!