LibVNC / x11vnc

a VNC server for real X displays
GNU General Public License v2.0
725 stars 142 forks source link

Reverse connection display geometry w:0 h:0 and client shows black screen. #180

Open danielmilvus opened 3 years ago

danielmilvus commented 3 years ago

I’m trying to stablish reverse connection between my Mac and a VNC viewer but it seems OpenGL can’t calculate my display geometry, width and height are zero sized and the viewer just gets a black screen.

I’m able to use the viewer to remote control the Mac if I do a normal connection, the problem just occurs when I try reverse connection.

I’ve tried several different options but none of them seems to do the job.

Important: the viewer listener is configured correctly, I can start a reverse connection using the same listener from Linux and Windows. There is a repeater configured on the listener side where the port is 5500 and connection ID is 1234.

Output I get is below, the last block of lines keeps looping and showing w: 0 , h: 0 and the display is always black on listener side! Could you help me, what can I do to get it working ? Thank you very much !!

x11vnc: 0.9.16 lastmod: 2019-01-05:

My OS details: macOS Big Sur 11.5.2 MacBook Pro 13 2020 Apple M1 8 gb

The most simple version of the command I use to start the remote connection is: x11vnc -display :0 -connect repeater=ID:1234+192.168.15.149:5500 Output:

lvus@MacBook-Pro-de-Daniel ~ % x11vnc -display :0 -connect repeater=ID:1234+192.168.15.149:5500 ###############################################################

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@ @

@ WARNING WARNING WARNING WARNING ** @

@ @

@ YOU ARE RUNNING X11VNC WITHOUT A PASSWORD!! @

@ @

@ This means anyone with network access to this computer @

@ may be able to view and control your desktop. @

@ @

@ >>> If you did not mean to do this Press CTRL-C now!! <<< @

@ @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@ @

@ You can create an x11vnc password file by running: @

@ @

@ x11vnc -storepasswd password /path/to/passfile @

@ or x11vnc -storepasswd /path/to/passfile @

@ or x11vnc -storepasswd @

@ @

@ (the last one will use ~/.vnc/passwd) @

@ @

@ and then starting x11vnc via: @

@ @

@ x11vnc -rfbauth /path/to/passfile @

@ @

@ an existing ~/.vnc/passwd file from another VNC @

@ application will work fine too. @

@ @

@ You can also use the -passwdfile or -passwd options. @

@ (note -passwd is unsafe if local users are not trusted) @

@ @

@ Make sure any -rfbauth and -passwdfile password files @

@ cannot be read by untrusted users. @

@ @

@ Use x11vnc -usepw to automatically use your @

@ ~/.vnc/passwd or ~/.vnc/passwdfile password files. @

@ (and prompt you to create ~/.vnc/passwd if neither @

@ file exists.) Under -usepw, x11vnc will exit if it @

@ cannot find a password to use. @

@ @

@ @

@ Even with a password, the subsequent VNC traffic is @

@ sent in the clear. Consider tunnelling via ssh(1): @

@ @

@ http://www.karlrunge.com/x11vnc/#tunnelling @

@ @

@ Or using the x11vnc SSL options: -ssl and -stunnel @

@ @

@ Please Read the documention for more info about @

@ passwords, security, and encryption. @

@ @

@ http://www.karlrunge.com/x11vnc/faq.html#faq-passwd @

@ @

@ To disable this warning use the -nopw option, or put @

@ 'nopw' on a line in your ~/.x11vncrc file. @

@ @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

############################################################### 02/09/2021 10:31:38 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 45991 02/09/2021 10:31:38 This x11vnc was built without X11 support (-rawfb only). 02/09/2021 10:31:38 Continuing without X display in -rawfb mode. 02/09/2021 10:31:38 macosxCG_init: initializing display. 02/09/2021 10:31:39 macosx_opengl_init: Using OpenGL for screen capture. 02/09/2021 10:31:39 console_guess: file is /dev/null 02/09/2021 10:31:39 console_guess returned: map:macosx:/dev/null@0x0x32:ff0000/ff00/ff 02/09/2021 10:31:39 raw fb is non-regular file: /dev/null 02/09/2021 10:31:39 CGDisplayBaseAddress disabled by OpenGL. 02/09/2021 10:31:39 rawfb: macosx fb: /dev/null 02/09/2021 10:31:39 w: 0 h: 0 b: 32 addr: 0x0 sz: 0 02/09/2021 10:31:39 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/0 02/09/2021 10:31:39 02/09/2021 10:31:39 Raw fb at addr 0x0 is 32bpp depth=24 true color 02/09/2021 10:31:39 02/09/2021 10:31:39 Autoprobing TCP port 02/09/2021 10:31:39 Autoprobing selected TCP port 5901 02/09/2021 10:31:39 Autoprobing TCP6 port 02/09/2021 10:31:39 rfbListenOnTCP6Port: error in bind IPv6 socket: Address already in use 02/09/2021 10:31:39 Autoprobing selected TCP6 port 5901 02/09/2021 10:31:39 listen6: bind: Address already in use 02/09/2021 10:31:39 Not listening on IPv6 interface. 02/09/2021 10:31:39 Manually set num_buttons to: 5 02/09/2021 10:31:39 macosx_console: copied screen in 0.000 sec 0.0 MB/sec 02/09/2021 10:31:39 screen setup finished. 02/09/2021 10:31:39 02/09/2021 10:31:39 WARNING: You are running x11vnc WITHOUT a password. See 02/09/2021 10:31:39 WARNING: the warning message printed above for more info. 02/09/2021 10:31:39

The VNC desktop is: MacBook-Pro-de-Daniel.local:1 PORT=5901 02/09/2021 10:31:39 -connect prestring: 'ID:1234' 02/09/2021 10:31:39 connect_tcp: trying: 192.168.15.149 5500 02/09/2021 10:31:39 0 other clients 02/09/2021 10:31:39 Normal socket connection 02/09/2021 10:31:39 macosxCG_refresh_callback: register 02/09/2021 10:31:39 incr accepted_client=1 for 192.168.15.149:5500 sock=11 02/09/2021 10:31:39 reverse_connect: 192.168.15.149:5500/192.168.15.149 OK 02/09/2021 10:31:39 reverse_connect: turning on auth for 192.168.15.149 02/09/2021 10:31:39 client progressed=0 in 15/10 0.000508 s 02/09/2021 10:31:39 Client Protocol Version 3.8 02/09/2021 10:31:39 Protocol version sent 3.8, using 3.8 02/09/2021 10:31:39 rfbProcessClientSecurityType: executing handler for type 1 02/09/2021 10:31:39 rfbProcessClientSecurityType: returning securityResult for client rfb version >= 3.8 02/09/2021 10:31:39 Pixel format for client 192.168.15.149: 02/09/2021 10:31:39 32 bpp, depth 24, little endian 02/09/2021 10:31:39 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:39 no translation needed 02/09/2021 10:31:39 rfbProcessClientNormalMessage: ignoring unsupported encoding type ultraZip 02/09/2021 10:31:39 Using compression level 3 for client 192.168.15.149 02/09/2021 10:31:39 Enabling X-style cursor updates for client 192.168.15.149 02/09/2021 10:31:39 Enabling full-color cursor updates for client 192.168.15.149 02/09/2021 10:31:39 Enabling cursor position updates for client 192.168.15.149 02/09/2021 10:31:39 Enabling KeyboardLedState protocol extension for client 192.168.15.149 02/09/2021 10:31:39 Enabling NewFBSize protocol extension for client 192.168.15.149 02/09/2021 10:31:39 Enabling SupportedMessages protocol extension for client 192.168.15.149 02/09/2021 10:31:39 Enabling SupportedEncodings protocol extension for client 192.168.15.149 02/09/2021 10:31:39 Enabling ServerIdentity protocol extension for client 192.168.15.149 02/09/2021 10:31:39 Using ZRLE encoding for client 192.168.15.149 02/09/2021 10:31:40 macosxCG_refresh_callback: unregister 02/09/2021 10:31:40 deleted 1 tile_row polling images. 02/09/2021 10:31:40 macosxCG_init: initializing display. 02/09/2021 10:31:40 macosx_opengl_init: Using OpenGL for screen capture. 02/09/2021 10:31:40 console_guess: file is /dev/null 02/09/2021 10:31:40 console_guess returned: map:macosx:/dev/null@0x0x32:ff0000/ff00/ff 02/09/2021 10:31:40 raw fb is non-regular file: /dev/null 02/09/2021 10:31:40 CGDisplayBaseAddress disabled by OpenGL. 02/09/2021 10:31:40 rawfb: macosx fb: /dev/null 02/09/2021 10:31:40 w: 0 h: 0 b: 32 addr: 0x0 sz: 0 02/09/2021 10:31:40 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/0 02/09/2021 10:31:40 rfbNewFramebuffer(0x2af31eb0, 0x0, 0, 0, 8, 1, 4) 02/09/2021 10:31:40 Pixel format for client 192.168.15.149: 02/09/2021 10:31:40 32 bpp, depth 24, little endian 02/09/2021 10:31:40 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:40 02/09/2021 10:31:40 Raw fb at addr 0x0 is 32bpp depth=24 true color 02/09/2021 10:31:40 02/09/2021 10:31:40 calling setTranslateFunction()... 02/09/2021 10:31:40 Pixel format for client 192.168.15.149: 02/09/2021 10:31:40 32 bpp, depth 24, little endian 02/09/2021 10:31:40 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:40 no translation needed 02/09/2021 10:31:40 done. 02/09/2021 10:31:40 Sending rfbEncodingNewFBSize for resize to (0x0) 02/09/2021 10:31:40 client_set_net: 192.168.15.149 0.0115 02/09/2021 10:31:40 macosxCG_refresh_callback: register 02/09/2021 10:31:41 macosxCG_refresh_callback: unregister 02/09/2021 10:31:41 deleted 1 tile_row polling images. 02/09/2021 10:31:41 macosxCG_init: initializing display. 02/09/2021 10:31:41 macosx_opengl_init: Using OpenGL for screen capture. 02/09/2021 10:31:41 console_guess: file is /dev/null 02/09/2021 10:31:41 console_guess returned: map:macosx:/dev/null@0x0x32:ff0000/ff00/ff 02/09/2021 10:31:41 raw fb is non-regular file: /dev/null 02/09/2021 10:31:41 CGDisplayBaseAddress disabled by OpenGL. 02/09/2021 10:31:41 rawfb: macosx fb: /dev/null 02/09/2021 10:31:41 w: 0 h: 0 b: 32 addr: 0x0 sz: 0 02/09/2021 10:31:41 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/0 02/09/2021 10:31:41 rfbNewFramebuffer(0x2af31eb0, 0x0, 0, 0, 8, 1, 4) 02/09/2021 10:31:41 Pixel format for client 192.168.15.149: 02/09/2021 10:31:41 32 bpp, depth 24, little endian 02/09/2021 10:31:41 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:41 02/09/2021 10:31:41 Raw fb at addr 0x0 is 32bpp depth=24 true color 02/09/2021 10:31:41 02/09/2021 10:31:41 calling setTranslateFunction()... 02/09/2021 10:31:41 Pixel format for client 192.168.15.149: 02/09/2021 10:31:41 32 bpp, depth 24, little endian 02/09/2021 10:31:41 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:41 no translation needed 02/09/2021 10:31:41 done. 02/09/2021 10:31:41 Sending rfbEncodingNewFBSize for resize to (0x0) 02/09/2021 10:31:41 macosxCG_refresh_callback: register 02/09/2021 10:31:41 macosxCG_refresh_callback: unregister 02/09/2021 10:31:41 deleted 1 tile_row polling images. 02/09/2021 10:31:41 macosxCG_init: initializing display. 02/09/2021 10:31:41 macosx_opengl_init: Using OpenGL for screen capture. 02/09/2021 10:31:41 console_guess: file is /dev/null 02/09/2021 10:31:41 console_guess returned: map:macosx:/dev/null@0x0x32:ff0000/ff00/ff 02/09/2021 10:31:41 raw fb is non-regular file: /dev/null 02/09/2021 10:31:41 CGDisplayBaseAddress disabled by OpenGL. 02/09/2021 10:31:41 rawfb: macosx fb: /dev/null 02/09/2021 10:31:41 w: 0 h: 0 b: 32 addr: 0x0 sz: 0 02/09/2021 10:31:41 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/0 02/09/2021 10:31:41 rfbNewFramebuffer(0x2af31eb0, 0x0, 0, 0, 8, 1, 4) 02/09/2021 10:31:41 Pixel format for client 192.168.15.149: 02/09/2021 10:31:41 32 bpp, depth 24, little endian 02/09/2021 10:31:41 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:41 02/09/2021 10:31:41 Raw fb at addr 0x0 is 32bpp depth=24 true color 02/09/2021 10:31:41 02/09/2021 10:31:41 calling setTranslateFunction()... 02/09/2021 10:31:41 Pixel format for client 192.168.15.149: 02/09/2021 10:31:41 32 bpp, depth 24, little endian 02/09/2021 10:31:41 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:41 no translation needed 02/09/2021 10:31:41 done. 02/09/2021 10:31:41 Sending rfbEncodingNewFBSize for resize to (0x0) 02/09/2021 10:31:42 macosxCG_refresh_callback: register 02/09/2021 10:31:43 macosxCG_refresh_callback: unregister 02/09/2021 10:31:43 deleted 1 tile_row polling images. 02/09/2021 10:31:43 macosxCG_init: initializing display. 02/09/2021 10:31:43 macosx_opengl_init: Using OpenGL for screen capture. 02/09/2021 10:31:43 console_guess: file is /dev/null 02/09/2021 10:31:43 console_guess returned: map:macosx:/dev/null@0x0x32:ff0000/ff00/ff 02/09/2021 10:31:43 raw fb is non-regular file: /dev/null 02/09/2021 10:31:43 CGDisplayBaseAddress disabled by OpenGL. 02/09/2021 10:31:43 rawfb: macosx fb: /dev/null 02/09/2021 10:31:43 w: 0 h: 0 b: 32 addr: 0x0 sz: 0 02/09/2021 10:31:43 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/0 02/09/2021 10:31:43 rfbNewFramebuffer(0x2af31eb0, 0x0, 0, 0, 8, 1, 4) 02/09/2021 10:31:43 Pixel format for client 192.168.15.149: 02/09/2021 10:31:43 32 bpp, depth 24, little endian 02/09/2021 10:31:43 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:43 02/09/2021 10:31:43 Raw fb at addr 0x0 is 32bpp depth=24 true color 02/09/2021 10:31:43 02/09/2021 10:31:43 calling setTranslateFunction()... 02/09/2021 10:31:43 Pixel format for client 192.168.15.149: 02/09/2021 10:31:43 32 bpp, depth 24, little endian 02/09/2021 10:31:43 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:43 no translation needed 02/09/2021 10:31:43 done. 02/09/2021 10:31:43 Sending rfbEncodingNewFBSize for resize to (0x0) 02/09/2021 10:31:45 macosxCG_refresh_callback: register 02/09/2021 10:31:45 macosxCG_refresh_callback: unregister 02/09/2021 10:31:45 deleted 1 tile_row polling images. 02/09/2021 10:31:45 macosxCG_init: initializing display. 02/09/2021 10:31:45 macosx_opengl_init: Using OpenGL for screen capture. 02/09/2021 10:31:45 console_guess: file is /dev/null 02/09/2021 10:31:45 console_guess returned: map:macosx:/dev/null@0x0x32:ff0000/ff00/ff 02/09/2021 10:31:45 raw fb is non-regular file: /dev/null 02/09/2021 10:31:45 CGDisplayBaseAddress disabled by OpenGL. 02/09/2021 10:31:45 rawfb: macosx fb: /dev/null 02/09/2021 10:31:45 w: 0 h: 0 b: 32 addr: 0x0 sz: 0 02/09/2021 10:31:45 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/0 02/09/2021 10:31:45 rfbNewFramebuffer(0x2af31eb0, 0x0, 0, 0, 8, 1, 4) 02/09/2021 10:31:45 Pixel format for client 192.168.15.149: 02/09/2021 10:31:45 32 bpp, depth 24, little endian 02/09/2021 10:31:45 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:45 02/09/2021 10:31:45 Raw fb at addr 0x0 is 32bpp depth=24 true color 02/09/2021 10:31:45 02/09/2021 10:31:45 calling setTranslateFunction()... 02/09/2021 10:31:45 Pixel format for client 192.168.15.149: 02/09/2021 10:31:45 32 bpp, depth 24, little endian 02/09/2021 10:31:45 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 02/09/2021 10:31:45 no translation needed 02/09/2021 10:31:45 done. 02/09/2021 10:31:45 Sending rfbEncodingNewFBSize for resize to (0x0)

freebrowser1 commented 2 years ago

Same issue here. I have enabled x11vnc in "System preferences" => Accessibility and Screen recording.

I use a Macbook Pro M1 running Monterey. The client shows a black screen. See below the text x11vnc on the macOS server outputs and see that there is also w: 0 and h: 0.

mymac.local:~/scratch % x11vnc -usepw -forever -rfbport 5901 2>&1 | tee z
26/05/2022 08:35:38 MacOS X: set -connect file to /tmp/x11vnc-macosx-remote.user
26/05/2022 08:35:38 passing arg to libvncserver: -rfbport
26/05/2022 08:35:38 passing arg to libvncserver: 5901
26/05/2022 08:35:38 -usepw: found /Users/user/.vnc/passwd
26/05/2022 08:35:38 x11vnc version: 0.9.16 lastmod: 2019-01-05  pid: 36555
26/05/2022 08:35:38 This x11vnc was built without X11 support (-rawfb only).
26/05/2022 08:35:38 Continuing without X display in -rawfb mode.
26/05/2022 08:35:38 macosxCG_init: initializing display.
26/05/2022 08:35:38 macosx_opengl_init: Using OpenGL for screen capture.
26/05/2022 08:35:38 console_guess: file is /dev/null
26/05/2022 08:35:38 console_guess returned: map:macosx:/dev/null@0x0x32:ff0000/ff00/ff
26/05/2022 08:35:38 raw fb is non-regular file: /dev/null
26/05/2022 08:35:38 CGDisplayBaseAddress disabled by OpenGL.
26/05/2022 08:35:38 rawfb: macosx fb: /dev/null
26/05/2022 08:35:38    w: 0 h: 0 b: 32 addr: 0x0 sz: 0
26/05/2022 08:35:38 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/0
26/05/2022 08:35:38 
26/05/2022 08:35:38 Raw fb at addr 0x0 is 32bpp depth=24 true color
26/05/2022 08:35:38 
26/05/2022 08:35:38 Listening for VNC connections on TCP port 5901
26/05/2022 08:35:38 rfbListenOnTCP6Port: error in bind IPv6 socket: Address already in use
26/05/2022 08:35:38 Listening also on IPv6 port 5901 (socket 10)
26/05/2022 08:35:39 Manually set num_buttons to: 5
26/05/2022 08:35:39 macosx_console: copied screen in 0.000 sec 0.0 MB/sec
26/05/2022 08:35:39 screen setup finished.
26/05/2022 08:35:39 

The VNC desktop is:      mymac.local:1
PORT=5901