# Faster Remote Desktop alternative to vnc?

## RaceTM

Well I have been working at this issue for a while, and I seem to be getting nowhere.  I am trying to find an alternative to vnc which is faster (good over slower connections), and preferably one which supports public key authentication so I dont need to type in a password every time I launch it.  I have been using rdc on windows for years, which is great because my windows cedentials get transfered to tehr emote session and I get logged in automatically.  I would love to find a linux to linux alternative.  I have looked in to NX server, but I wasn't able to get it working at all.  After some troubleshooting I discovered that one of the packages wasn't installed, and when I tried to emerge it, the server reported a 404.  I wasnt able to find the package via google, either.  Any suggestions would be appreciated!

----------

## timeBandit

Did you follow the FreeNX HOWTO on the Gentoo Wiki? What specifically went wrong?

A number of people here have successfully installed FreeNX--there is a lengthy HOWTO thread devoted to general setup problems (it dates to 2004 so you might want to start near the end) and a host of others on more specific issues. I took the plunge about a month ago and I must say, NX is crazy fast compared to VNC. Don't give up on it yet.  :Smile: 

----------

## RaceTM

Hi, thanks for the reply (again  :Smile:  )

well, lets see..after I emerged nxserver-freenx, I got some errors from the installer:

emerge -avt nxserver-freenx

source /etc/profile

cp /usr/lib/NX/bin/nx* /usr/bin/

nxsetup --override --install

----> Testing your nxserver configuration ...

Warning: Could not find nxdesktop in /usr/bin. RDP sessions won't work.

Warning: Could not find nxviewer in /usr/bin. VNC sessions won't work.

Warning: Invalid value "DEFAULT_X_SESSION=/etc/X11/xdm/Xsession"

         Users might not be able to request a default X session.

Warning: Invalid value "COMMAND_START_KDE=startkde"

         Users will not be able to request a KDE session.

Warning: Invalid value "COMMAND_START_GNOME=/etc/X11/Sessions/Gnome"

         Users will not be able to request a Gnome session.

Warning: Invalid value "COMMAND_START_CDE=cdwm"

         Users will not be able to request a CDE session.

  Warnings occured during config check.

  To enable these features please correct the configuration file.

<---- done

----> Testing your nxserver connection ...

The authenticity of host '[127.0.0.1]:5000 ([127.0.0.1]:5000)' can't be established.

RSA key fingerprint is 75:b2:66:3b:15:a4:3c:a6:e8:0a:7a:d2:ad:a8:20:00.

Are you sure you want to continue connecting (yes/no)? Fatal error: Could not connect to NX Server.

Despite these errors (none of them seemed fatal), I tried to start the nxserver service, and was told it was already running.  So, I fired up the client, and tried to connect.  That was where the fun started.

I got an error message, and wasnt able to complete the session connection.  I googled around for quite a while, adn eventually found out that the issue was related to the fact that the later NX clients dont support FeeeNX any more.  I wasnt abel to find an old enough client anywhere, so, I tried to use the FreeNX client, and it just crashed upon connecting.  I found some troubleshooting documents, but they all referred to files which I didnt have on my system. I think they fell under the /usr/NX directory which, on my system, didn't exist.

After reading your above post, I re-installed NX quickly so I could reproduce the issue.  Thanks to murphy's law, the software seemed to do a better job of installing itself this time, however im still unable to connect.  The FreeNX client crashes, and the normal NX client isnt able to start the session after authenticating, it just seems to hang. I tried to reconnect, and it hung on the "Session resume failed" message before returning this error log:

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

------- ---------------- -------------------------------- -------- ----- -------------- ----------- ------------------------------

1001    unix-kde         BF0428529D8324683141CE6020EE2421 -RD--PSA    32 1680x1022      Running     Server2k

NX> 148 Server capacity: not reached for user: fox2k

NX> 105 restoresession --id="BF0428529D8324683141CE6020EE2421"  --resize="1" --session="Server2k" --type="unix-kde" --cache="8M" --images="32M" --link="adsl" --kbtype="pc102/en_US" --nodelay="1" --backingstore="never" --geometry="1680x1022" --media="0" --agent_server="" --agent_user="" agent_password="******"" 

NX> 1000 NXNODE - Version 1.5.0-50 OS (GPL)

NX> 700 Session id: server2k-1001-BF0428529D8324683141CE6020EE2421

NX> 705 Session display: 1001

NX> 703 Session type: unix-kde

NX> 701 Proxy cookie: fa572ff1fd7e88f63a88a330f991ccc3

NX> 702 Proxy IP: 192.168.1.1

NX> 706 Agent cookie: fa572ff1fd7e88f63a88a330f991ccc3

NX> 704 Session cache: unix-kde

NX> 707 SSL tunneling: 0

NX> 1004 Error: Session did not start.

NX> 596 Session resume failed.

NX> 999 Bye

Killed by signal 15.

```

So I guess this has turned in to an NX help thread, unless somebody can recommend another alternative. I am open to anything at this point  :Smile: 

----------

## RaceTM

alrighty now we are back in to familiar territory.  I restarted the service and tried to connect.  This is the error log I was getting before as well:

```

NX> 148 Server capacity: not reached for user: fox2k

NX> 105 startsession --session="Server2k" --type="unix-kde" --cache="8M" --images="32M" --link="adsl" --kbtype="pc102/en_US" --nodelay="1" --backingstore="never" --geometry="1680x1022" --media="0" --agent_server="" --agent_user="" agent_password="******""  --screeninfo="1680x1022x32+render" 

NX> 1000 NXNODE - Version 1.5.0-50 OS (GPL)

NX> 596 Session startup failed.

NX> 1004 Error: NX Agent exited with exit status 1.

NX> 105 /usr/bin/nxserver: line 1077:   681 Terminated              sleep $AGENT_STARTUP_TIMEOUT

NX> 1006 Session status: closed

Can't open /var/lib/nxserver/db/running/sessionId{332033BFE482C0A7459EF24A54504350}: No such file or directory.

mv: cannot stat `/var/lib/nxserver/db/running/sessionId{332033BFE482C0A7459EF24A54504350}': No such file or directory

NX> 700 Session id: server2k-1000-332033BFE482C0A7459EF24A54504350

NX> 705 Session display: 1000

NX> 703 Session type: unix-kde

NX> 701 Proxy cookie: 50b421d945735c96e612981b09178d82

NX> 702 Proxy IP: 192.168.1.1

NX> 706 Agent cookie: 50b421d945735c96e612981b09178d82

NX> 704 Session cache: unix-kde

NX> 707 SSL tunneling: 0

Killed by signal 15.

```

Googling that I discovered that it was an issue with freeNX not being supported by the windows client anymore.  I am trying to use the 2X client now, and I simply get "error unknown" when I try to connect.

----------

## RaceTM

bump!

----------

## Voyageur

 *RaceTM wrote:*   

> 
> 
> ```
> NX> 1000 NXNODE - Version 1.5.0-50 OS (GPL)
> ```
> ...

 

From your log, I'd say you have installed freenx 0.5, please update to net-misc/nx-2.1.0 and net-misc/nxserver-freenx-0.6.0 (marked ~ARCH).

These new versions are compatible with the 2.x NX clients (and include lots of bugfixes too  :Wink:  )

----------

## RaceTM

Alright guys,

I have been trying to work with this for the past few days.  I swear to God every time I reinstall the packages, something different happens. I have tried the 2x version, the freeedition, and freenx.  I have tried with and without overlays.

So finally, I decided to start from scratch, and take note of everything I did in the exact order I did it.  I would greatly appreciate the time anyone could take to help me get this set up  I would even be willing to talk on msn or something..because this has taken me way too much time and I am getting nowhere fast. I have been looking through the help thread mentioned above, but all of the posts are out of date and things keep changing every time a new version is released.

So, here is my (lack of) progress report:

```
ACCEPT_KEYWORDS="~x86" emerge -N  nxserver-freenx

cp /usr/lib/NX/bin/nx* /usr/bin/

nxsetup --clean --purge --install (answered no to creating custom keypair, as I already have a key in my authorized_keys and the matching key on my windows machine)

```

Here was the output:

----------

## Voyageur

OK, let's see if we can solve most of these:

```
cp /usr/lib/NX/bin/nx* /usr/bin/

nxsetup --clean --purge --install (answered no to creating custom keypair, as I already have a key in my authorized_keys and the matching key on my windows machine) 
```

What's that cp for? The only command to run after emerge is 

```
nxsetup --install --setup-nomachine-key --clean --purge
```

as emerge tells you at the end of freenx merging

```
ssh: connect to host 127.0.0.1 port 22: Connection refused
```

 *Quote:*   

> -change the port to my sshd's port
> 
> - enable ssh authentication
> 
> - enable userdb authentication

 Is your server running on a different port than 22? Then you do have to change nxnode.conf, but then you can rerun the install command. SSH authentification is the default, what do you mean by userdb? Usermode auth or Passdb auth?

Some NX internals now: when you connect to a NX server, the client uses key authentification for the nx user (and connects as nx user). This is why it is recommended to use the default key, so you don't have to reconfigure every nxclient (and fail sometimes  :Wink:  ) to have the correct key. Once authentified as nx, a nxserver process starts. This is not a daemon so you will not see it running when no one is using NX. If the install process did not report a successful setup, you will often meet the Error: Server not installed or NX access disabled.. The nxserver then connects you as your normal user, usually by ssh to localhost (default method)

 *Quote:*   

> Looks like its using authorized_keys2, which I forgot to change to authorized_keys. So, I edit the config file appropriately

 The nx user does have a authorized_keys2 file (which is the one used for nx auth), you should set it back in nxloadconfig

```
NX> 202 Authenticating user: nx

NX> 208 Using auth method: publickey

NX> 204 Authentication failed.
```

 The real problem is here: did you set a different key in your nxclient? When using the default NoMachine key, you just use the default key provided in nxclient and you're up and running  :Wink: 

So for your current problem, please try the following:

* get back to standard configuration, change the SSH port if you do not run it on 22

* before running nxsetup, ssh on localhost to see if it works 

* re-run the install line (if it does not say success at the end, no need to get further and try with clients, it won't work)

After getting the "successful setup" line, try again with nxclient, resetting the SSH key to the default one, and with your standard password (with SSH auth).

Hope that helps!

----------

## RaceTM

Thanks voyageur, that was very informative.  At least now I understand how the authentication procedure works a little better.

 *Quote:*   

> What's that cp for? The only command to run after emerge is

 

I was following the wiki for this step.  Actually, I thought that it might be out of date, so I was going to try without this (seems weird to me to need to manually move files after an installation).  HOWEVER..when I tried to run nxsetup, the command wasn't found.  I found the file in /usr/lib/NX/bin/ so I did the copy line so I would have everything in a path directory so I wouldn't have to type the full path every time I wanted to run an nx script.  Did this potentially mess something up? should I delete the files I copied?

 *Quote:*   

> Is your server running on a different port than 22? Then you do have to change nxnode.conf, but then you can rerun the install command. SSH authentification is the default, what do you mean by userdb? Usermode auth or Passdb auth? 

 

I didn't properly understand nx authentication, so this is irrelevant now.  I was attempting to get passdb authentication working as anotehr torubleshooting step, in case the ssh credentials were an issue.  But since youre now saying that the nx client can use the nx user's key, then log me in using my password, thats fine too!  Don't need to worrry about this anymore (I dont think)

 *Quote:*   

> The nx user does have a authorized_keys2 file (which is the one used for nx auth), you should set it back in nxloadconfig 

 

Again this was due to my misunderstanding how the authentication works, however now it seems to be configured properly for looking in this file (the nx user can log in), so I will leave it like this I think, unless you suggest otherwise

 *Quote:*   

>  The real problem is here: did you set a different key in your nxclient? When using the default NoMachine key, you just use the default key provided in nxclient and you're up and running

 

I have reset the key in the nx client.

 *Quote:*   

> So for your current problem, please try the following:
> 
> * get back to standard configuration, change the SSH port if you do not run it on 22
> 
> * before running nxsetup, ssh on localhost to see if it works
> ...

 

the ssh port is already changed, but I'm not sure what you mean by trying ssh on localhost.  Do you mean try ssh using the nx user? I already have ssh working properly, there is ans ftp server running on this machine with no issues.

I re-ran the install line, and things look more promising:

 *Quote:*   

> server2k fox2k # nxsetup --install --setup-nomachine-key --clean --purge
> 
> Removing special user "nx" ...done
> 
> Removing session database ...done
> ...

 

So, I tried logging in:

 *Quote:*   

> NX> 203 NXSSH running with pid: 2836
> 
> NX> 285 Enabling check on switch command
> 
> NX> 285 Enabling skip of SSH config files
> ...

 

Now I think we are back to where I was in the first place, but this time I understand what is going on quite a bit better!

----------

## Voyageur

Glad I could help, let's see if we can get a little further  :Wink: 

First step, what rights/owner do you have on /var/lib/nxserver/db/*? This should be OK if nxsetup succeeded

Next, this kind of messages can be caused by a faulty remote session. Which one do you try to run? (KDE, Gnome, ...). You can try with a simpler session: custom desktop, running /usr/bin/xterm or any simple program you have installed on the server

Aside from the logs, you can get some infos from ~/.nx/F-{something}/, in files session and erros (the F- is for failed session).

----------

## RaceTM

Well, these are the permissions on the files in the db directory:

```

server2k fox2k # ls -lt /var/lib/nxserver/db/

total 12

drwx------ 2 nx root 4096 Apr 21 23:25 failed

drwx------ 2 nx root 4096 Apr 21 23:25 running

drwx------ 2 nx root 4096 Apr 21 12:09 closed

```

I tried all of the default commands, and I also tried initializing /usr/bin/xterm, none of which resulted in any difference.  Also, there were no log or failure files present in /my ~/.nx directory:

```
fox2k@server2k ~ $ ls -Alt ~/.nx/

total 8

drwx------ 2 fox2k fox2k 4096 Apr 21 21:06 config

drwx------ 3 fox2k fox2k 4096 Apr 21 21:06 temp

```

I am wondering if this might be an issue outside of nx, as I tried to ssh to the machine using putty and opening an X window, but I got an error because the DISPLAY environment variable wasnt set. 

```

fox2k@server2k ~ $ xterm

xterm Xt error: Can't open display:

xterm:  DISPLAY is not set

```

 I checked locally, and DISPLAY was set to 

:1.0

If I remember correctly, ssh requires $DISPLAY to be set to localhost:some port for ssh X forwarding to work, however I am almost certain my sshd_config is set correctly.

```
fox2k@server2k ~ $ sudo cat /etc/ssh/sshd_config | grep X

X11Forwarding yes

X11UseLocalHost yes

#X11Forwarding no

#X11DisplayOffset 10

#X11UseLocalhost yes

#       X11Forwarding no

```

Just for fun I tried doing an ssh -X localhost on the machine itself, and it worked fine.  I dont know if that means anything but I still find it strange that it works locally but not remotely :/

----------

## timeBandit

 *RaceTM wrote:*   

> I am wondering if this might be an issue outside of nx, as I tried to ssh to the machine using putty and opening an X window, but I got an error because the DISPLAY environment variable wasnt set. ... If I remember correctly, ssh requires $DISPLAY to be set to localhost:some port for ssh X forwarding to work.... I tried doing an ssh -X localhost on the machine itself, and it worked fine.

 

There is a PuTTY option to enable X11 forwarding, similar to ssh -X. It's on the Tunnels page of the settings dialog. Setting DISPLAY doesn't enable X11 forwarding, enabling the option sets the DISPLAY variable.   :Wink: 

You're very close with NX: you appear to be logging in successfully but NX can't start a session for you. Did you check the .nx directories on both the client and server for session logs? If you find none, there is an option in the client to clean old sessions from the .nx directory--make sure it's not checked. Also, did you try a console session (it's an option for Custom sessions)?

----------

## RaceTM

 *timeBandit wrote:*   

>  *RaceTM wrote:*   I am wondering if this might be an issue outside of nx, as I tried to ssh to the machine using putty and opening an X window, but I got an error because the DISPLAY environment variable wasnt set. ... If I remember correctly, ssh requires $DISPLAY to be set to localhost:some port for ssh X forwarding to work.... I tried doing an ssh -X localhost on the machine itself, and it worked fine. 
> 
> There is a PuTTY option to enable X11 forwarding, similar to ssh -X. It's on the Tunnels page of the settings dialog. Setting DISPLAY doesn't enable X11 forwarding, enabling the option sets the DISPLAY variable.  
> 
> You're very close with NX: you appear to be logging in successfully but NX can't start a session for you. Did you check the .nx directories on both the client and server for session logs? If you find none, there is an option in the client to clean old sessions from the .nx directory--make sure it's not checked. Also, did you try a console session (it's an option for Custom sessions)?

 

I made sure that X11 forwarding was enabled in putty.  I tried both with and without specifying the display parameter, since the X11 forwarding option has a checkbox and a place to specify that.

When I get home tonight I will try what you suggested about doing a console session and ensureing the files arent getting cleared.  I dont recall seeing an option for a console login but I will check again!

----------

## RaceTM

Initiating a console session does not work either.  I found this log in the nx directory of the windows box:

```
nxwinOpenLogFile: Redirected the standard error to the log file.

nxwinOpenLogFile: NX_TEMP is set to [C:\Documents and Settings\Fox2k\.nx/D-system2k-45C8405848B102595B17BF4885C5C362].

nxwinOpenLogFile: Using log file [C:\Documents and Settings\Fox2k\.nx/D-system2k-45C8405848B102595B17BF4885C5C362/winlog].

ddxProcessArgument - Initializing default screens

winInitializeDefaultScreens - w 1680 h 1050

winInitializeDefaultScreens - Returning

ddxProcessArgument - screen - Found ``WxD'' arg

_XSERVTransmkdir: Owner of C:\Documents and Settings\Fox2k\.nx/D-system2k-45C8405848B102595B17BF4885C5C362/.X11-unix should be set to root

(EE) Unable to locate/open config file

InitOutput - Error reading config file

winDetectSupportedEngines - Windows NT/2000/XP

winDetectSupportedEngines - DirectDraw installed

winDetectSupportedEngines - Allowing PrimaryDD

winDetectSupportedEngines - DirectDraw4 installed

winDetectSupportedEngines - Returning, supported engines 0000001f

InitOutput - g_iNumScreens: 1 iMaxConsecutiveScreen: 1

winSetEngine - Multi Window => ShadowGDI

winAdjustVideoModeShadowGDI - Using Windows display depth of 32 bits per pixel

winCreateBoundingWindowWindowed - User w: 640 h: 480

winCreateBoundingWindowWindowed - Current w: 640 h: 480

winAdjustForAutoHide - Original WorkArea: 0 0 1022 1680

winAdjustForAutoHide - Found BOTTOM auto-hide taskbar

winAdjustForAutoHide - Adjusted WorkArea: 0 0 1021 1680

winCreateBoundingWindowWindowed - WindowClient w 1680 h 1021 r 1680 l 0 b 1021 t 0

winCreateBoundingWindowWindowed -  Returning

Info: Display running with pid '3292' and handler '0x2f0394'.

winAllocateFBShadowGDI - Creating DIB with width: 1680 height: 1021 depth: 32

winAllocateFBShadowGDI - Dibsection width: 1680 height: 1021 depth: 32 size image: 6861120

winAllocateFBShadowGDI - Created shadow stride: 1680

winFinishScreenInitFB - Masks: 00ff0000 0000ff00 000000ff

winInitVisualsShadowGDI - Masks 00ff0000 0000ff00 000000ff BPRGB 8 d 24 bpp 32

winCreateDefColormap - Deferring to fbCreateDefColormap ()

null screen fn ReparentWindow

null screen fn RestackWindow

winFinishScreenInitFB - Calling winInitWM.

winFinishScreenInitFB starting winInitWM

winInitWM starting InitQueue

InitQueue: - Calling pthread_mutex_init

InitQueue: pthread_mutex_init returned

InitQueue: calling pthread_cond_init

InitQueue: pthread_cond_init returned

winInitWM spawning winMultiWindowWMProc

winInitMultiWindowWM:

winInitMultiWindowWM - Calling pthread_mutex_lock ()

winInitWM - Returning.

winFinishScreenInitFB After winInitWM

color offset: 10 8 0

winFinishScreenInitFB - returning

winScreenInit - returning

InitOutput - Returning.

error opening security policy file /usr/X11R6/lib/X11/xserver/SecurityPolicy

(EE) No primary keyboard configured

(==) Using compiletime defaults for keyboard

names.keymap=(null)Rules = "xfree86" Model = "pc101" Layout = "us" Variant = "(null)" Options = "(null)"

Couldn't load XKB keymap, falling back to pre-XKB keymap

winBlockHandler - Releasing pmServerStarted

winBlockHandler - pthread_mutex_unlock () returned

winInitMultiWindowWM - pthread_mutex_lock () returned.

winInitMultiWindowWM - pthread_mutex_unlock () returned.

winInitMultiWindowWM - DISPLAY=127.0.0.1:0.0

winInitMultiWindowWM - MUTEX successfully initialized.

winInitMultiWindowWM: creating Atom WM_PROTOCOLS

winInitMultiWindowWM: creating Atom WM_DELETE_WINDOW

Dispatch: Exiting from the dispatcher with exception [2].

```

----------

## timeBandit

Did you find any logs in /var/lib/nxserver/db/failed on the server? Based on the files in the other db subdirectories, I suspect not, but I have no failed sessions recorded on my machine (anymore  :Wink: ) so I can't be certain.

I'm writing this post from an NX session--I compared my winlog file with yours and didn't see any radical differences. Mine reports most of the same errors as yours (regarding the config file and keyboard) so clearly they're not show-stoppers. My log does not show this error from yours:

```
error opening security policy file /usr/X11R6/lib/X11/xserver/SecurityPolicy
```

...but then I don't have that file on my system, either, so that also seems not to be the  problem.

Maybe it's a separate issue, or maybe not, but I'm a bit concerned that you can't tunnel an X session over PuTTY. I don't know whether NX needs that to work or operates completely outside the X protocol from a tunneling standpoint. I'd try to sort that out first.

----------

## RaceTM

thanks timeBandit,

I did figure out the putty issue, I simply needed to install the x server emulator thingy for windows.  I can now open an xterm window, konqueror window, etc (form within putty)

I looked in /var/lib/nxserver/db/failed, adn I do see log files there.  This is the most recent one:

server2k failed # cat sessionId\{30C1C6FAC396285457882CA00C69A493\}

sessionName=Server2k

display=1000

status=Failed

startTime=1177690863

foreignAddress=192.168.1.110

sessionRootlessMode=1

type=unix-console

sessionId=30C1C6FAC396285457882CA00C69A493

creationTime=1177690863

userName=fox2k

serverPid=

screeninfo=1680x1022x32+render

geometry=

host=127.0.0.1

----------

