# tightvnc - unable to connect with client

## to_kallon

so here stands the situation:

i would like to clone my display across several networked machine without giving those machines the option to interface with the root display. to accomplish this i chose tightvnc.

```
USE="server" emerge tightvnc
```

upon executing  *Quote:*   

> vncserver

  i am prompted for passwords, as expected, and things seem to start up and run correctly.

however,  *Quote:*   

> $ vncviewer host:1

  results in  *Quote:*   

> Error: Can't open display:

 

i've read a few threads with similar symptoms, generally resulting in some configuration error or other which leads to a solution. at the root of my problem, however, is that the tightvnc log shows:

 *Quote:*   

> 25/09/07 18:53:25 Xvnc version TightVNC-1.3.9
> 
> 25/09/07 18:53:25 Copyright (C) 2000-2007 TightVNC Group
> 
> 25/09/07 18:53:25 Copyright (C) 1999 AT&T Laboratories Cambridge
> ...

 

after i attempt to connect via vncviewer, which gives the appearance that, for some reason, no connection attempt is even being made.

additionally, since emerging tightvnc i have been unable to launch graphical applications. all fail with a message similar to (from opera)  *Quote:*   

> cannot connect to X server

  i further believe the two to be related as, after unmerging tightvnc, graphical applications behaved normally.

suggestions regarding this problem, or regarding alternatives, much appreciated. thanks.

----------

## thecooptoo

does it start oK ?

start vncserver  and then see if the process is running 

```

paul@gravity ~ $ ps -A |grep vnc

15222 pts/2    00:00:00 Xvnc

```

then can you connect to the server on the serve machine ?

eg

```

paul@gravity ~ $ telnet localhost 5901

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

RFB 003.008

                    
```

then try vncviewer localhost::5901

and do you get another screen ?

if you do then its running OK on the server.

from your client 

can you 

```
telnet server::5901

```

and get an output ?

----------

## hexstar

You need to unblock the vnc ports on the server's firewall...

----------

## to_kallon

hexstar, that was my first suspicion, however, even without the firewall running the performance remains the same. additionally connecting to the localhost should not be making a connection over the ethernet adapter, so the firewall should not be involved at all anyway.

thecoptoo, the output from telnet looks the same as what you posted, except for the RFB line. still cannot use vncviewer with any success. i do have  *Quote:*   

> httpd: premature connection close
> 
> httpd: no GET line

  in my vnc log now, which i believe is from the localhost telnet session.

having tightvnc installed continues to cause graphical app launches to fail.

----------

## thecooptoo

so is vnc actually running ?

on the server :

start the server and then whats the output of 

ps -A |grep vnc 

 and also 

 nmap -sS 127.0.0.1

----------

## to_kallon

vnc is running, with -desktop X (in case that's significant)

 *Quote:*   

> $ nmap -sS 127.0.0.1
> 
> Starting Nmap 4.20 ( http://insecure.org ) at 2007-09-27 12:55 EDT
> 
> Interesting ports on Astaire (127.0.0.1):
> ...

 

----------

## ttw

i would guess the message is comming from vncserver not being able to connect to your display, not from 'Xvnc' rejecting the connection[/code].  try manually setting your display variable via

```
# DISPLAY=":0.0" ; export DISPLAY
```

and post that.

failing that i would also try

```
# xhost +
```

to disable xhost authentication (temporarily).

can't really guess the correlation between the install of tightvnc and your problem but i would also try ensuring that your local host name (from 'hostname') is listed in your '/etc/hosts' file as an alias of 127.0.0.1 to ensure you're connecting over the 'lo' inteface.

----------

## to_kallon

apologies for the long time getting back, but thanks for the suggestions.

ttw, my DISPLAY is already set as :0.0

i use kdm locally to authenticate, do you think this could be causing an issue? shouldn't i still be seeing an attempt being made to do *something* even if authentication were broken?

----------

## thecooptoo

can you connect to the server from the localhost  

ie vncviewer localhost::5901

----------

## to_kallon

i cannot.

----------

## thecooptoo

as the same user that you have acess to the X-server on display 0 ( ie your regular user) ?

----------

## to_kallon

i've tried both as root and as my uid (the only other user on the host) with the same results

----------

## thecooptoo

error message ?

and then do ( as user) 

xhost + 

and try again

----------

## ttw

to be honest, reading back through, i'm a bit confused as to what you're actually trying to achive (please note the question marks below)

you're running vncserver from a network machine and trying to connect it from another machine across the network ?

the vncserver start correctly and is listening on the port, you have verified that you get an RGB message when telnetting to the listening port ?

when you try and run the vncviewer from the remote machine you receive a "Error: cannot open display: " ?

OR

you are trying to connect back to the localhost as as test and are recieving an "Error: cannot open display: " ?

whatever you answer from the above you need to start including the "~/.xsession-error" file so that we can see something more concrete.  there is probably also Xvnc error logs in "~/.vnc" directory, post that too.

current guess you need the following in /etc/hosts

```
127.0.0.1 hostname.netname.tld hostname
```

obviously the actual "hostname.netname.tld" and "hostname" entries should reflect your actual hostname

i would also guess that

```
xhost +
```

after you login to your local KDE session will temporarily resolve the problem.

anyway, as above, error logs

----------

## ttw

 *to_kallon wrote:*   

> apologies for the long time getting back, but thanks for the suggestions.
> 
> ttw, my DISPLAY is already set as :0.0
> 
> i use kdm locally to authenticate, do you think this could be causing an issue? shouldn't i still be seeing an attempt being made to do *something* even if authentication were broken?

 

yes, you are.  it looks like the application (vncviewer) is attempting to connect to the local Xserver and cannot, thus throws out the "Error: cannot connect to display: ".  Default authentication will usually allow connections from 'localhost' this is why you need to add the 127.0.0.1 to '/etc/hosts' then when your application trys to connect to "hostname" it finds the localhost address connects over the loopback, the Xserver then does a reverse lookup and finds "127.0.0.1' to be from localhost (assuming you don't delete the current localhost entry) and allows it (actually i'm not sure if it actually does a reverse lookup but either way, that's roughly what i think's happening).

----------

## to_kallon

i meant seeing something in the log, but i see your point.

/etc/hosts has had an entry for 127.0.0.1 pointing to localhost and my hostname from the beginning.

----------

## thecooptoo

Id see what happens with all the variations

localhost::5901

187.0.0.1::5901

192.168.x.x::5901 ( depending on your subnet)

adn if you get a display  then its  not the vncserver

----------

## ttw

 *to_kallon wrote:*   

> i meant seeing something in the log, but i see your point.
> 
> /etc/hosts has had an entry for 127.0.0.1 pointing to localhost and my hostname from the beginning.

 

since you're not posting your log Xsession log (.xsession-errors) or your Xvnc server log (somewhere in .vnc i think) i can only take you word for that.

----------

