FreeNX – 1004 Error: NX Agent exited with exit status 1

This error is very generic and while googling I found different issues can cause it. I was able to resolve it this particular instance by creating the folders

/tmp/.X11-unix - as root
/tmp/.ICE-unix - as user logging in

and file

/tmp/.X0-lock - as root

Which had been deleted while manually cleaning up a previous session. The statement below was also logged when this error occured but it to appears to be a generic error logged for different cases whenever a session fails.

596 Session startup failed

FreeNX/NX No suitable cache file found.

I ran into this error after my connection got disconnected due to a power outage during a storm. Googling around I could not find a solution to fix my situation. On a hunch I connected a keyboard and monitor to the server logged on and off in the GUI then tried the NX connection and it worked, so in my situation it seems some Xorg files got corrupted causing NX to fail starting an X session.
If this ever happens again I would like to try fixing it from an ssh connection by clearing X related files and locks for the user, as some fixes online involved adding a new user to NX and using the new account. So it looks as if the problem might be caused by unreleased locks or session files.

Black screen FreeNX/NX

I have been running my FreeNX for several years with no problem then all of a sudden I tried to log in today and I received a black screen. After several searches I found out that it’s a problem with the window manager temporary files being corrupt. Just to test I changed the settings on my nx client to use another window manager “KDE” in the system and it worked. To resolve the issue I SSHed into the box and deleted all gconfd, orbit and mapping tmp folders/files for the affected user. Tried to reconnect again and it worked.