# x11vnc troubles.  "Error: Can't open display: " [solved]

## tipp98

Hi all, I'm trying to follow the x11vnc wiki, but I am not having too much luck. I can start the server and connect to it while sitting at the server, but it gets stuck in a loop and opens vnc session after vnc session after vnc session.... Ok, at least I know the server works. I have no desire to connect locally anyway so I'm ignoring that issue unless it pops up on the client.

If I try to connect remotely to this session I get 

```
xs@satellite ~ $ vncviewer 192.168.0.179:0

VNC Viewer Free Edition 4.1.2 for X - built Nov 22 2007 23:14:01

Copyright (C) 2002-2005 RealVNC Ltd.

See http://www.realvnc.com for information on VNC.

Sat Nov 24 21:52:12 2007

 main:        unable to connect to host: Connection refused (111)

```

I'm guessing this is the result of a localhost option I have set with the server somewhere. Ok, fine, I'm happy with ssh. 

```
xs@satellite ~ $  ssh kyle@192.168.0.179

Password: 

Last login: Sun Nov 25 14:28:22 2007

kyle@Woody ~ $ x11vnc -localhost -display :0 -auth .Xauthority

25/11/2007 14:33:26 passing arg to libvncserver: -rfbauth

25/11/2007 14:33:26 passing arg to libvncserver: /home/kyle/.vnc/passwd

25/11/2007 14:33:26 x11vnc version: 0.9.2 lastmod: 2007-06-16

25/11/2007 14:33:26 Using X display :0

25/11/2007 14:33:26 

25/11/2007 14:33:26 ------------------ USEFUL INFORMATION ------------------

25/11/2007 14:33:26 X DAMAGE available on display, using it for polling hints.

25/11/2007 14:33:26   To disable this behavior use: '-noxdamage'

25/11/2007 14:33:26 

25/11/2007 14:33:26 Wireframing: -wireframe mode is in effect for window moves.

25/11/2007 14:33:26   If this yields undesired behavior (poor response, painting

25/11/2007 14:33:26   errors, etc) it may be disabled:

25/11/2007 14:33:26    - use '-nowf' to disable wireframing completely.

25/11/2007 14:33:26    - use '-nowcr' to disable the Copy Rectangle after the

25/11/2007 14:33:26      moved window is released in the new position.

25/11/2007 14:33:26   Also see the -help entry for tuning parameters.

25/11/2007 14:33:26   You can press 3 Alt_L's (Left "Alt" key) in a row to 

25/11/2007 14:33:26   repaint the screen, also see the -fixscreen option for

25/11/2007 14:33:26   periodic repaints.

25/11/2007 14:33:26 

25/11/2007 14:33:26 XFIXES available on display, resetting cursor mode

25/11/2007 14:33:26   to: '-cursor most'.

25/11/2007 14:33:26   to disable this behavior use: '-cursor arrow'

25/11/2007 14:33:26   or '-noxfixes'.

25/11/2007 14:33:26 using XFIXES for cursor drawing.

25/11/2007 14:33:26 GrabServer control via XTEST.

Xlib:  extension "RECORD" missing on display ":0.0".

25/11/2007 14:33:26 

25/11/2007 14:33:26 The RECORD X extension was not found on the display.

25/11/2007 14:33:26 If your system has disabled it by default, you can

25/11/2007 14:33:26 enable it to get a nice x11vnc performance speedup

25/11/2007 14:33:26 for scrolling by putting this into the "Module" section

25/11/2007 14:33:26 of /etc/X11/xorg.conf or /etc/X11/XF86Config:

25/11/2007 14:33:26 

25/11/2007 14:33:26   Section "Module"

25/11/2007 14:33:26   ...

25/11/2007 14:33:26       Load    "record"

25/11/2007 14:33:26   ...

25/11/2007 14:33:26   EndSection

25/11/2007 14:33:26 

25/11/2007 14:33:26 

25/11/2007 14:33:26 XKEYBOARD: all 28 "must have" keysyms accounted for.

25/11/2007 14:33:26   Not automatically switching to -xkb mode.

25/11/2007 14:33:26   If some keys still cannot be typed, try using -xkb.

25/11/2007 14:33:26   Also, remember "-remap DEAD" for accenting characters.

25/11/2007 14:33:26 X FBPM extension not supported.

25/11/2007 14:33:26 X display is capable of DPMS.

25/11/2007 14:33:26 --------------------------------------------------------

25/11/2007 14:33:26 

25/11/2007 14:33:26 Default visual ID: 0x23

25/11/2007 14:33:26 Read initial data from X display into framebuffer.

25/11/2007 14:33:26 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/4096

25/11/2007 14:33:26 

25/11/2007 14:33:26 X display :0.0 is 32bpp depth=24 true color

25/11/2007 14:33:26 

25/11/2007 14:33:26 Autoprobing TCP port 

25/11/2007 14:33:26 Autoprobing selected port 5900

25/11/2007 14:33:26 

25/11/2007 14:33:26 Xinerama is present and active (e.g. multi-head).

25/11/2007 14:33:26 Xinerama: enabling -xwarppointer mode to try to correct

25/11/2007 14:33:26 Xinerama: mouse pointer motion. XTEST+XINERAMA bug.

25/11/2007 14:33:26 Xinerama: Use -noxwarppointer to force XTEST.

25/11/2007 14:33:27 fb read rate: 5 MB/sec

25/11/2007 14:33:27 screen setup finished.

25/11/2007 14:33:27 

The VNC desktop is:      localhost:0

PORT=5900

******************************************************************************

Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster

retrieval.  It should work with any VNC viewer.  Try it by running:

    x11vnc -ncache 10 ...

more info: http://www.karlrunge.com/x11vnc/#faq-client-caching

25/11/2007 14:39:45 Got connection from client 127.0.0.1

25/11/2007 14:39:45   other clients:

25/11/2007 14:39:45 check_access: client 127.0.0.1 matches host 127.0.0.1

25/11/2007 14:39:45 Disabled X server key autorepeat.

25/11/2007 14:39:45   to force back on run: 'xset r on' (3 times)

25/11/2007 14:39:45 created xdamage object: 0xe00024

25/11/2007 14:39:46 Client Protocol Version 3.3

25/11/2007 14:39:46 Protocol version sent 3.3, using 3.3

25/11/2007 14:39:52 authProcessClientMessage: authentication failed from 127.0.0.1

25/11/2007 14:39:52 rfbAuthProcessClientMessage: password check failed

25/11/2007 14:39:52 client_count: 0

25/11/2007 14:39:52 Restored X server key autorepeat to: 1

25/11/2007 14:39:52 Client 127.0.0.1 gone

25/11/2007 14:39:52 Statistics             events    Transmit/ RawEquiv ( saved)

25/11/2007 14:39:52  TOTALS              :      0 |         0/        0 (  0.0%)

25/11/2007 14:39:52 Statistics             events    Received/ RawEquiv ( saved)

25/11/2007 14:39:52  TOTALS              :      0 |         0/        0 (  0.0%)

25/11/2007 14:39:54 Got connection from client 127.0.0.1

25/11/2007 14:39:54   other clients:

25/11/2007 14:39:54 check_access: client 127.0.0.1 matches host 127.0.0.1

25/11/2007 14:39:54 Disabled X server key autorepeat.

25/11/2007 14:39:54   to force back on run: 'xset r on' (3 times)

25/11/2007 14:39:55 Client Protocol Version 3.3

25/11/2007 14:39:55 Protocol version sent 3.3, using 3.3

25/11/2007 14:39:58 Pixel format for client 127.0.0.1:

25/11/2007 14:39:58   32 bpp, depth 24, little endian

25/11/2007 14:39:58   true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0

25/11/2007 14:39:58 no translation needed

25/11/2007 14:39:58 Defaulting to raw encoding for client 127.0.0.1

25/11/2007 14:40:01 client 2 network rate 70427.2 KB/sec (70427.2 eff KB/sec)

25/11/2007 14:40:01 client 2 latency:  0.5 ms

25/11/2007 14:40:01 dt1: 0.0290, dt2: 0.0003 dt3: 0.0005 bytes: 2061028

25/11/2007 14:40:01 link_rate: LR_LAN - 1 ms, 70427 KB/s

25/11/2007 14:40:04 rfbSendUpdateBuf: write: Broken pipe

25/11/2007 14:40:04 client_count: 0

25/11/2007 14:40:04 Restored X server key autorepeat to: 1

25/11/2007 14:40:04 Client 127.0.0.1 gone

25/11/2007 14:40:04 Statistics             events    Transmit/ RawEquiv ( saved)

25/11/2007 14:40:04  FramebufferUpdate   :     19 |         0/        0 (  0.0%)

25/11/2007 14:40:04  raw                 :     99 |  13939196/ 13939196 (  0.0%)

25/11/2007 14:40:04  TOTALS              :    118 |  13939196/ 13939196 (  0.0%)

25/11/2007 14:40:04 Statistics             events    Received/ RawEquiv ( saved)

25/11/2007 14:40:04  KeyEvent            :      1 |         8/        8 (  0.0%)

25/11/2007 14:40:04  PointerEvent        :    100 |       600/      600 (  0.0%)

25/11/2007 14:40:04  FramebufferUpdate   :     21 |       210/      210 (  0.0%)

25/11/2007 14:40:04  SetEncodings        :      1 |         4/        4 (  0.0%)

25/11/2007 14:40:04  SetPixelFormat      :      1 |        20/       20 (  0.0%)

25/11/2007 14:40:04  TOTALS              :    124 |       842/      842 (  0.0%)

25/11/2007 14:40:04 destroyed xdamage object: 0xe00024

caught signal: 2

25/11/2007 14:57:49 deleted 32 tile_row polling images.
```

The above connection was the one mentioned by connecting locally.

But when I try to connect to the server through the ssh tunnel

```
kyle@Woody ~ $ vncviewer localhost:0

Error: Can't open display: 
```

So now I'm stuck wondering if this is due to a resolution/colordepth issue as the computer(laptop) I'm trying to connect with is an old PII without DRI running & 1024x768@16bpp. On the host computer I've bumped the resolution down to 1024x768 from within the ATI Catalyst Control Center but when I try to change the default depth from within my xorg.conf I get a black screen at bootup no matter what tty I'm try to go to. I suppose this is something I can set using the aticonfig script, and now that I think of this I'll give it a try, but I'm not holding out much hope. Any suggestions?

```
Section "Device"

        Identifier      "aticonfig-Device[0]"

        Driver          "fglrx"

        Option          "DRI" "true"

        Option          "RenderAccel" "true"

        Option          "EnablePageFlip" "true

        Option          "Capabilities" "0x00000000"

#       Option          "VideoOverlay" "on"

#       Option          "OpenGLOverlay" "on"

#       Option          "FSAAEnable" "off"

#       Option          "FSAAScale" "0"

        Option          "XAANoOffscreenPixmaps" "true"

EndSection

Section "Monitor"

        Identifier   "aticonfig-Monitor[0]"

        Option      "VendorName" "ATI Proprietary Driver"

        Option      "ModelName" "Generic Autodetecting Monitor"

        Option      "DPMS" "true"

EndSection

Section "Screen"

        Identifier "aticonfig-Screen[0]"

        Device     "aticonfig-Device[0]"

        Monitor    "aticonfig-Monitor[0]"

        DefaultDepth     24

        SubSection "Display"

                Viewport   0 0

                Depth     24

        EndSubSection

EndSection
```

P.S. I just noticed "X display :0.0 is 32bpp depth=24 true color" in the above. What is the difference between bpp and depth?Last edited by tipp98 on Mon Nov 26, 2007 9:43 pm; edited 1 time in total

----------

## SinoTech

 *tipp98 wrote:*   

> Hi all, I'm trying to follow the x11vnc wiki, but I am not having too much luck. I can start the server and connect to it while sitting at the server, but it gets stuck in a loop and opens vnc session after vnc session after vnc session.... Ok, at least I know the server works. I have no desire to connect locally anyway so I'm ignoring that issue unless it pops up on the client.
> 
> [...]
> 
> 

 

Well, I assume that is a problem because yor client is running on the same machine as the server  :Wink: 

 *tipp98 wrote:*   

> 
> 
> If I try to connect remotely to this session I get 
> 
> ```
> ...

 

Yes. If you have set the "-localhost" option, then only connections from localhost are allowed. As your client is running on another system, the server revokes the connection.

 *tipp98 wrote:*   

> 
> 
> [...]
> 
> Ok, fine, I'm happy with ssh. 
> ...

 

You've ssh'ed to the machine where x11vnc is running and there you execute "vncviewer". In that case you DO NOT tunnel the vnc connection through ssh, but you try to start the vncviewer on server side. Normally that's a nice feature which can be used to start applications on a remote machine where as the graphical output is displayed on your local machine (the output of the X server is tunnelt through your SSH connection). To enable X forwarding use the "-Y" switch when ssh'ing to the server.

$ ssh -Y kyle@192.168.0.179

However, in that case the vncviewer is completed executed on the server, and that's not what you try to do  :Wink: 

What you try to do is to tunnel only the data exchanged between x11vnc and the vncviewer (not the whole vncviewer itself  :Wink:  ).

To tunnel the VNC connection through SSH, use the "-L" switch when ssh'ing to the server:

$ ssh kyle@192.168.0.179 -L 5900:localhost:5900

The parameter expected by the "-L" switch identifies the port where applications on the client side can connect to in order to send/receive data through the SSH tunnel, as well as the destination host and port of the tunnel. So in the example above, the ssh command will open port 5900 on the client side (that is where your vncviewer will connect to), tunnel all received data through ssh, and on the server side it forwards the data to the host "localhost" port 5900.

After you've created that tunnel, you can execute the vncviewer and tell it to connect to localhost.

Cheers,

Sino

----------

## tipp98

Oh wow thanks man, great explanation, that's gold. I see how I was getting tripped up. Also, I think maybe the -via option should be added to the vncTunnel.sh script on the wiki, no?

----------

## SinoTech

 *tipp98 wrote:*   

> Oh wow thanks man, great explanation, that's gold.
> 
> [...]
> 
> 

 

Thank you, nice to hear  :Smile: 

 *tipp98 wrote:*   

> 
> 
> [...]
> 
> Also, I think maybe the -via option should be added to the vncTunnel.sh script on the wiki, no?

 

According to the man-page the "-via" option simply invokes the ssh command in order to create a tunnel for the VNC connection. So it does the same as the script currently does. The disadvantage of the "-via" option is that it requires some envrionment variables to be set (namely "L", "H" and "R"). So I do not see any advantage of that option.

Cheers,

Sino

----------

