Bug 903186

Summary: Cannot connect to freenx session on fedora 18 system
Product: [Fedora] Fedora Reporter: Tom Horsley <horsley1953>
Component: freenx-serverAssignee: Ville Skyttä <ville.skytta>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: axel.thimm, bkelly, gwync, ngaywood, rok.mandeljc, ville.skytta
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-28 15:26:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tom Horsley 2013-01-23 12:29:51 UTC
Description of problem:

See https://bugzilla.redhat.com/show_bug.cgi?id=891109#c19

Also the message in comment 20 of that bug is what I see as well.

From my fedora 18 system at home, I cannot connect to my system at work.
On the other hand, on my system at work, I can connect to my system at home.

My work system is an older, slower, system and various comments in bug 891109 mention a race condition, so perhaps that is what I'm seeing.

I have attemtpted to connect many times without success.

I'm using the nomachine nxclient-3.5.0-7.x86_64 to connect with
both at home and work.

Version-Release number of selected component (if applicable):
freenx-server-0.7.3-28.fc18.x86_64

How reproducible:
Every time going from home to work
(Worked first time, every time going from work to home).

Steps to Reproduce:
1. try to connect
2. watch all the feedback seem to be working
3. get to almost the last step and see connection refused
  
Actual results:
see above

Expected results:
a working NX session

Additional info:

When both systems were running fedora 17, everything worked fine.

Comment 1 Boyd 2013-01-23 17:22:18 UTC
Same problem here with freenx-server-0.7.3-29.fc18.x86_64.

When attempting connection I receive the error:

NX> 203 NXSSH running with pid: 9815
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: 10.x.y.z on port: 22
NX> 202 Authenticating user: nx
NX> 208 Using auth method: publickey
HELLO NXSERVER - Version 3.2.0-74-SVN OS (GPL, using backend: 3.5.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: mpd
NX> 102 Password: 
NX> 103 Welcome to: zbox user: mpd
NX> 105 listsession --user="mpd" --status="suspended,running" --geometry="1680x1818x24+render" --type="unix-application"
NX> 127 Sessions list of user 'mpd' for reconnect:

Display Type             Session ID                       Options  Depth Screen         Status      Session Name
------- ---------------- -------------------------------- -------- ----- -------------- ----------- ------------------------------


NX> 148 Server capacity: not reached for user: mpd
NX> 105 startsession  --rootless="1" --virtualdesktop="0" --application="/usr/bin/quodlibet" --link="lan" --backingstore="1" --encryption="1" --cache="16M" --images="64M" --shmem="1" --shpix="1" --strict="0" --composite="1" --media="0" --session="quodlibet" --type="unix-application" --client="linux" --keyboard="pc102/ca" --screeninfo="1680x1818x24+render" 

Ncat: Connection refused.
NX> 280 Exiting on signal: 15

Comment 2 Rok Mandeljc 2013-01-23 21:31:45 UTC
Same problem here: freenx-server-0.7.3-29.fc18.x86_64 and same symptoms as above, when trying to connect with No Machine NX Client for Windows 3.5.0.9.

In my case, it seems that adding "2>/dev/null" (without quotes) at the end of all $COMMAND_NETCAT lines in /usr/libexec/nx/nxserver fixed the issue.

Additional investigation appears to suggest that the NX Client does not like "Connection refused" appearing anywhere in the received log. This was tested by adding echo "Test: Connection refused" or echo "Connection refused" before the session_add call in server_startrestore_session; it resulted in same symptoms as above. The old netcat silently returned 1 when closed ports were probed, whereas the new one unfortunately prints "Ncat: Connection refused", causing the issue.

Comment 3 Tom Horsley 2013-01-23 22:29:15 UTC
By golly, the fix in comment #2 worked for me as well. I must not be getting that error at home (maybe I have some service it checks enabled at home and don't have it enabled at work).

Thanks for the work around!

Comment 4 Norman Gaywood 2013-01-23 22:53:51 UTC
Nice work Rok Mandeljc. Fix works for me as well.

diff nxserver-orig nxserver
1494c1494
<                         if $COMMAND_NETCAT --send-only "$SERVER_HOST" $PROXY_DISPLAY </dev/null
---
>                         if $COMMAND_NETCAT --send-only "$SERVER_HOST" $PROXY_DISPLAY </dev/null 2>/dev/null
1504c1504
< 			if [ "$(getparam 'samba')" = 1 ] && $COMMAND_NETCAT --send-only "$SERVER_HOST" $SAMBA_DISPLAY </dev/null
---
> 			if [ "$(getparam 'samba')" = 1 ] && $COMMAND_NETCAT --send-only "$SERVER_HOST" $SAMBA_DISPLAY </dev/null 2>/dev/null
1512c1512
< 			if [ "$(getparam 'media')" = 1 ] && $COMMAND_NETCAT --send-only "$SERVER_HOST" $MEDIA_DISPLAY </dev/null
---
> 			if [ "$(getparam 'media')" = 1 ] && $COMMAND_NETCAT --send-only "$SERVER_HOST" $MEDIA_DISPLAY </dev/null 2>/dev/null
1521c1521
< 			if [ "$(getparam 'cups')" = 1 ] && $COMMAND_NETCAT --send-only "$SERVER_HOST" $CUPS_DISPLAY </dev/null
---
> 			if [ "$(getparam 'cups')" = 1 ] && $COMMAND_NETCAT --send-only "$SERVER_HOST" $CUPS_DISPLAY </dev/null 2>/dev/null
1640c1640
< 				$COMMAND_NETCAT $SERVER_HOST $PROXY_DISPLAY
---
> 				$COMMAND_NETCAT $SERVER_HOST $PROXY_DISPLAY 2>/dev/null

Comment 5 Tom Horsley 2013-01-24 12:58:04 UTC
Any freenx maintainers looking at this bug might want to glance at bug 903410 as well. I have called it a gtk 3 bug for now, but maybe it is really an NX bug?

Comment 6 Ville Skyttä 2013-01-24 15:20:40 UTC
Testing with remmina nx on my f-16 freenx-server box which I've patched to use ncat I get a genuine "Ncat: Connection refused" in the remmina log but it doesn't seem to matter; I succeed in logging in every time. Adding fake "Connection refused" echos as mentioned in comment 2 makes no difference either, it is shown in the logs but doesn't break logins. It'll take some time until I have a f-18 freenx-server box to test against.

Comment 7 Rok Mandeljc 2013-01-24 15:53:57 UTC
Maybe the issue is specific to NoMachine NX client, then? Even so, it appears to be caused by increased verbosity of the new ncat.

Comment 8 Ville Skyttä 2013-01-24 21:31:31 UTC
(In reply to comment #7)
> Maybe the issue is specific to NoMachine NX client, then?

Confirmed that NoMachine nxclient-3.5.0-7 has this issue (FWIW nxplayer-4.0.181-3 apparently doesn't).

Comment 9 Ville Skyttä 2013-01-24 21:34:11 UTC
BTW I'm leaving out the last hunk of the patch in comment 4 - that particular ncat call is not a "probe" one like the others and if that one fails, things will go south anyway and I don't think it'd be a good thing to hush stderr there.

Comment 10 Fedora Update System 2013-01-24 22:14:29 UTC
freenx-server-0.7.3-30.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/freenx-server-0.7.3-30.fc18

Comment 11 Fedora Update System 2013-01-25 21:29:45 UTC
Package freenx-server-0.7.3-30.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing freenx-server-0.7.3-30.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-1477/freenx-server-0.7.3-30.fc18
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2013-01-28 15:26:10 UTC
freenx-server-0.7.3-30.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.