# tightvnc: "Network error: remote side closed connection"

## KShots

I get the above when I tunnel into my vnc server via the java interface.

I point my web browser to the server's IP on port 5800 (tightvnc running on :0), enter my password in the authentication dialog, then I get the message in the title along with a "login again" button.

My config:

net-misc/tightvnc-1.2.9-r3

~/.vnc/xstartup:

```
#!/bin/sh

xrdb $HOME/.Xresources

xsetroot -solid grey

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

twm &
```

~/.vnc/madusa\:0.log:

```
05/03/07 12:57:31 Xvnc version 3.3.tight1.2.9

05/03/07 12:57:31 Copyright (C) 1999 AT&T Laboratories Cambridge.

05/03/07 12:57:31 Copyright (C) 2000-2002 Constantin Kaplinsky.

05/03/07 12:57:31 All Rights Reserved.

05/03/07 12:57:31 See http://www.uk.research.att.com/vnc for information on VNC

05/03/07 12:57:31 See http://www.tightvnc.com for TightVNC-specific information

05/03/07 12:57:31 Desktop name 'X' (madusa:0)

05/03/07 12:57:31 Protocol version supported 3.3

05/03/07 12:57:31 Listening for VNC connections on TCP port 5900

05/03/07 12:57:31 Listening for HTTP connections on TCP port 5800

05/03/07 12:57:31   URL http://madusa:5800

Font directory '/usr/share/fonts/Type1/' not found - ignoring

05/03/07 12:58:06 httpd: get '' for 10.4.12.1

05/03/07 12:58:06 httpd: defaulting to 'index.vnc'

05/03/07 12:58:07 httpd: get 'VncViewer.jar' for 10.4.12.1

05/03/07 12:58:08 httpd: get 'VncViewer.jar' for 10.4.12.1

05/03/07 12:58:09 httpd: get 'VncViewer.jar' for 10.4.12.1
```

Basically, what I am trying to do is run mythtv-setup on a headless machine (this machine is only to run the mythtv backend, as it has no video card, keyboard, monitor, nor mouse). To do this, I need an X session, and I also emerged xterm so I can run a simple command in the X session without manually inputting it in my xstartup file. What am I missing?

EDIT: I may have found the problem. It seems that X is not a pre-requisite for tightvnc. A test emerge of xorg-server tells me that it, and all its dependencies, are not installed:

```
rich@madusa ~/.vnc $ sudo emerge -av xorg-server

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild  N    ] x11-proto/xf86miscproto-0.9.2  USE="-debug" 38 kB

[ebuild  N    ] x11-libs/liblbxutil-1.0.1  USE="-debug" 237 kB

[ebuild  N    ] x11-libs/libxkbui-1.0.2  USE="-debug" 217 kB

[ebuild  N    ] x11-proto/resourceproto-1.0.2  USE="-debug" 36 kB

[ebuild  N    ] x11-proto/xf86dgaproto-2.0.2  USE="-debug" 40 kB

[ebuild  N    ] x11-proto/trapproto-3.4.3  USE="-debug" 48 kB

[ebuild  N    ] x11-proto/recordproto-1.13.2  USE="-debug" 39 kB

[ebuild  N    ] x11-apps/iceauth-1.0.1  USE="-debug" 83 kB

[ebuild  N    ] media-fonts/font-adobe-75dpi-1.0.0  USE="nls -X" 827 kB

[ebuild  N    ] x11-proto/xf86rushproto-1.1.2  USE="-debug" 37 kB

[ebuild  N    ] x11-proto/damageproto-1.0.3  USE="-debug" 37 kB

[ebuild  N    ] x11-apps/xkbcomp-1.0.2  USE="-debug" 181 kB

[ebuild  N    ] dev-perl/XML-Parser-2.34  225 kB

[ebuild  N    ] x11-proto/evieext-1.0.2  USE="-debug" 37 kB

[ebuild  N    ] x11-proto/compositeproto-0.3.1  USE="-debug" 37 kB

[ebuild  N    ] x11-proto/scrnsaverproto-1.1.0  USE="-debug" 38 kB

[ebuild  N    ] x11-libs/libXxf86misc-1.0.1  USE="-debug" 218 kB

[ebuild  N    ] x11-libs/libXres-1.0.1  USE="-debug" 221 kB

[ebuild  N    ] x11-libs/libXtst-1.0.1  USE="-debug" 208 kB

[ebuild  N    ] x11-misc/xkeyboard-config-0.8  401 kB

[ebuild  N    ] x11-base/xorg-server-1.1.1-r4  USE="dri ipv6 nptl xorg -3dfx -aiglx -debug -dmx -kdrive -minimal -sdl -xprint" INPUT_DEVICES="evdev keyboard mouse -acecad -aiptek -calcomp -citron -digitaledge -dmc -dynapro -elo2300 -elographics -fpit -hyperpen -jamstudio -joystick -magellan -microtouch -mutouch -palmax -penmount -spaceorb -summa -synaptics -tek4957 -ur98 -vmmouse -void -wacom" VIDEO_CARDS="-apm -ark -chips -cirrus -cyrix -dummy -epson -fbdev -fglrx -glint -i128 -i740 -i810 (-impact) -imstt -mach64 -mga -neomagic (-newport) -nsc -nv -nvidia -r128 -radeon -rendition -s3 -s3virge -savage -siliconmotion -sis -sisusb (-sunbw2) (-suncg14) (-suncg3) (-suncg6) (-sunffb) (-sunleo) (-suntcx) -tdfx -tga -trident -tseng -v4l -vesa -vga -via -vmware -voodoo" 6,106 kB

[ebuild  N    ] x11-drivers/xf86-input-evdev-1.1.2-r2  USE="-debug" 221 kB

[ebuild  N    ] x11-drivers/xf86-input-mouse-1.1.1  USE="-debug" 262 kB

[ebuild  N    ] x11-drivers/xf86-input-keyboard-1.1.0  USE="-debug" 227 kB

Total: 24 packages (24 new), Size of downloads: 10,010 kB

Would you like to merge these packages? [Yes/No]
```

Sounds like a bug to submit...

----------

## KShots

Well, emerging xorg-server changed nothing. I'm still unable to run a vnc session.

----------

## KShots

It's been a while. I'm still looking to solve this, though I've had to re-install the machine because it was diskless and the server went belly-up.

As I've said, emerging xorg-server didn't solve the problem, so I haven't bothered. Here's the new environment:

net-misc/tightvnc-1.3.8-r1

relevant USE flags: java server tcpd

connection port: 5801 via web browser

log file:

```
15/05/07 09:35:38 Xvnc version TightVNC-1.3.8

15/05/07 09:35:38 Copyright (C) 2000-2006 Constantin Kaplinsky

15/05/07 09:35:38 Copyright (C) 1999 AT&T Laboratories Cambridge

15/05/07 09:35:38 All Rights Reserved.

15/05/07 09:35:38 See http://www.tightvnc.com/ for information on TightVNC

15/05/07 09:35:38 Desktop name 'X' (madusa:1)

15/05/07 09:35:38 Protocol versions supported: 3.7t, 3.7, 3.3

15/05/07 09:35:38 Listening for VNC connections on TCP port 5901

15/05/07 09:35:38 Listening for HTTP connections on TCP port 5801

15/05/07 09:35:38   URL http://madusa:5801
```

This was after an attempted login - I got the authentication page, then the error in the subject line.

xstartup file:

```
#!/bin/sh

xrdb $HOME/.Xresources

xsetroot -solid grey

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

twm &
```

... and to verify that all such binaries exist:

```
rich@madusa ~/.vnc $ which xrdb xsetroot xterm twm

/usr/bin/xrdb

/usr/bin/xsetroot

/usr/bin/xterm

/usr/bin/twm
```

fontPath in the vncserver script: $fontPath = "/usr/share/fonts/misc/,/usr/share/fonts/Type1/";

contents of /usr/share/fonts:

```
rich@madusa ~ $ ls /usr/share/fonts/

100dpi  75dpi  Type1  cyrillic  default  encodings  misc  util
```

What seems to be the problem, here?

----------

## Hu

If you use a full VNC viewer, instead of the Java applet, does it work?  What does a tcpdump (from net-analyzer/tcpdump) on the VNC server show happening during the time that you connect from your client?  You can use net-analyzer/wireshark to view the pcap file in a GUI.  Have you considered using a different VNC server, such as net-misc/vnc (which unfortunately conflicts with net-misc/tightvnc, so you can only have one installed at a time)?

Can you avoid VNC entirely, and instead use X11 forwarding to display the contents elsewhere?  To do this, configure sshd on the MythTV box to allow X11 forwarding (see the sshd_config manpage), then on your client machine, run ssh -X medusa.  When the prompt comes up, you should be able to start an X11 application and have it display on the machine from which the ssh connection originated.  Both ssh and sshd are part of net-misc/openssh.  The X11 application is running on medusa, so it should be just as effective as using VNC.

----------

## KShots

Well, I found something interesting. Here's more detail.

To get to madusa, I am tunneling from outside of my network, connecting to the tunnel via localhost:5801 (which goes through the tunnel and gets sent to madusa:5801 on the ssh server side - also has the side effect of encrypting the authentication)

This fails. However, I have another host on the same network configured as an actual desktop, which I have configured another tunnel to go to 5802 (localhost:5802 points to basilisk:5802 on the server side of the tunnel)). This works fine... and the REALLY weird thing is that I can then connect to madusa:5801 from the web client on basilisk successfully and run mythtv-setup, which then segfaults under VNC, but not locally after I finally threw my hands in the air and hauled a monitor over to the thing, compiled xorg-x11 and xorg-server (which were not installed) along with some vesa drivers, typed "startx", then tried REAL hard to look at things on an ancient 15 year old standard VGA that just "technically" supported the resolution that was being used and did so with serious contrast issues (very dark).

Anyways... long story cut short, the machine has now been configured and I no longer need X. I'm hesitant to unmerge it because I'm not sure which pieces Qt must tie into for the mythbackend, and as long as it's not called it's not really slowing me down either.

----------

