Asustor NASでVNCサーバーを走らせる

手軽に使えるHDMIディスプレーの手持ちがないので古いVGA CRTディスプレーを変換アダプタを介して使用

手軽に使えるHDMIディスプレーの手持ちがないので古いVGA CRTディスプレーを変換アダプタを介して使用

このほど購入したAsustor社製NAS AS3102TでVNCサーバーを走らせた。理由は階が違うなど離れた部屋からもどういう画面表示がされているのか見られると便利だから。特にKodiは設定はNASに直結されたディスプレーが見えてないとできないので、VNCサーバーを利用するなどしない限り、ディスプレーの前にいないと設定ができない。

x11vnc: a VNC server for real X displaysが利用できそうだと気がついた。参考:

X11vnc – Portal to control ASUSTOR distance- (thanks to Father-Mande) – NAS Forum“に既にインストール済みのEntware-ngの作者によるアプリがあるが、すぐあとで見るようにVNCサーバーを走らせるものに必要なものは最初からADMに含まれている。なので自力で走らせようとしたのだが、結果論としては使えるようにするまでが手間で、もしそれをやってくれるのならこちらの方が楽だったかも。

まず探してみる:

root@AS3102T-693D:/ # find . -name "*vnc*"                                               
./volume1/.@plugins/AppCentral/xorg/usr/bin/x11vnc                                       
./volume1/.@plugins/AppCentral/xorg/usr/share/applications/x11vnc.desktop                
./volume1/.@plugins/AppCentral/xorg/usr/share/x11vnc                                     
./volume1/.@plugins/AppCentral/xorg/usr/share/x11vnc/classes/index.vnc                   
./volume1/.@plugins/AppCentral/xorg/usr/share/x11vnc/classes/ssl/proxy.vnc               
./volume1/.@plugins/AppCentral/xorg/usr/share/x11vnc/classes/ssl/ultra.vnc               
./volume1/.@plugins/AppCentral/xorg/usr/share/x11vnc/classes/ssl/index.vnc               
./volume1/.@plugins/AppCentral/xorg/usr/share/x11vnc/classes/ssl/ss_vncviewer            
./volume1/.@plugins/AppCentral/xorg/usr/share/x11vnc/classes/ssl/ultrasigned.vnc

あれ、どうやらXサーバーアプリの一部としてインストールされているようだ。走るかな?

root@AS3102T-693D:/ # ./volume1/.@plugins/AppCentral/xorg/usr/bin/x11vnc                 
./volume1/.@plugins/AppCentral/xorg/usr/bin/x11vnc: error while loading shared libraries:
 libXtst.so.6: cannot open shared object file: No such file or directory                 
root@AS3102T-693D:/ # find . -name "*libXtst*"                                           
./volume1/.@plugins/AppCentral/xorg/usr/lib/libXtst.so.6.1.0                             
./volume1/.@plugins/AppCentral/xorg/usr/lib/libXtst.so                                   
./volume1/.@plugins/AppCentral/xorg/usr/lib/libXtst.so.6

必要なライブラリは用意されてるのだがパスが通ってないため起動しない模様。なら通してやれば起動するかも、と思いながら試してみるとできた。

というわけで最低限以下で起動できることを確認。

LD_LIBRARY_PATH=/volume1/.@plugins/AppCentral/xorg/usr/lib/:$LD_LIBRARY_PATH /volume1/.@plugins/AppCentral/xorg/usr/bin/x11vnc -display :0 -usepw -forever -ncache 10
Windows PC上で走らせたTightVNC Viewerからアクセスした、Kodiを実行中のAS3102Tの画面

Windows PC上で走らせたTightVNC Viewerからアクセスした、Kodiを実行中のAS3102Tの画面

オプションはもっといろいろつけないといけないのだが、とりあえず以下だけ。

  • -usepwオプションをつけると初回にパスワードを設定することを求めてくる。これはUnixパスワードとは別物であることに注意。それ以降は起動するごとにこの作成されたパスワードによる認証が行われる。
  • -foreverオプションをつけないと、一回クライアントが接続した後終了すると、VNCサーバーも終了してしまう。

Lubuntu上でRemmia Remote Desktop Clientを使って接続してみたときの出力が以下。ポートはデフォルトでは5900。

クライアントとしてWebアプリのnoVNC: VNC client using HTML5 (Web Sockets, Canvas) with encryption (wss://) support.も試してみたが、サーバー側がWebSocketsに対応していないようでうまくいかなかった。サーバー側で、noVNCのディストリビューションの一部として提供されているPythonによるプロクシを使えばこの問題は解消するようだが、面倒なのでやってない。

ここで止めればよかったのだが、NAS本体起動時にVNCサーバーが自動起動するようにしようとして手間がかかった。それについては後日

root@AS3102T-693D:/ # LD_LIBRARY_PATH=/volume1/.@plugins/AppCentral/xorg/
usr/lib/:$LD_LIBRARY_PATH /volume1/.@plugins/AppCentral/xorg/usr/bin/x11vnc -display :0 -
usepw -forever -ncache 10                                                                
28/10/2016 20:50:13 -usepw: found /root/.vnc/passwd                                      
28/10/2016 20:50:13 x11vnc version: 0.9.13 lastmod: 2011-08-10  pid: 21908               
28/10/2016 20:50:13 Using X display :0                                                   
28/10/2016 20:50:13 rootwin: 0xf2 reswin: 0x1200001 dpy: 0x1ac5270                       
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 ------------------ USEFUL INFORMATION ------------------             
28/10/2016 20:50:13 X DAMAGE available on display, using it for polling hints.           
28/10/2016 20:50:13   To disable this behavior use: '-noxdamage'                         
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13   Most compositing window managers like 'compiz' or 'beryl'          
28/10/2016 20:50:13   cause X DAMAGE to fail, and so you may not see any screen          
28/10/2016 20:50:13   updates via VNC.  Either disable 'compiz' (recommended) or         
28/10/2016 20:50:13   supply the x11vnc '-noxdamage' command line option.                
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 Wireframing: -wireframe mode is in effect for window moves.          
28/10/2016 20:50:13   If this yields undesired behavior (poor response, painting         
28/10/2016 20:50:13   errors, etc) it may be disabled:                                   
28/10/2016 20:50:13    - use '-nowf' to disable wireframing completely.                  
28/10/2016 20:50:13    - use '-nowcr' to disable the Copy Rectangle after the            
28/10/2016 20:50:13      moved window is released in the new position.                   
28/10/2016 20:50:13   Also see the -help entry for tuning parameters.                    
28/10/2016 20:50:13   You can press 3 Alt_L's (Left "Alt" key) in a row to               
28/10/2016 20:50:13   repaint the screen, also see the -fixscreen option for             
28/10/2016 20:50:13   periodic repaints.                                                 
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 XFIXES available on display, resetting cursor mode                   
28/10/2016 20:50:13   to: '-cursor most'.                                                
28/10/2016 20:50:13   to disable this behavior use: '-cursor arrow'                      
28/10/2016 20:50:13   or '-noxfixes'.                                                    
28/10/2016 20:50:13 using XFIXES for cursor drawing.                                     
28/10/2016 20:50:13 GrabServer control via XTEST.                                        
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 Scroll Detection: -scrollcopyrect mode is in effect to               
28/10/2016 20:50:13   use RECORD extension to try to detect scrolling windows            
28/10/2016 20:50:13   (induced by either user keystroke or mouse input).                 
28/10/2016 20:50:13   If this yields undesired behavior (poor response, painting         
28/10/2016 20:50:13   errors, etc) it may be disabled via: '-noscr'                      
28/10/2016 20:50:13   Also see the -help entry for tuning parameters.                    
28/10/2016 20:50:13   You can press 3 Alt_L's (Left "Alt" key) in a row to               
28/10/2016 20:50:13   repaint the screen, also see the -fixscreen option for             
28/10/2016 20:50:13   periodic repaints.                                                 
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 Client Side Caching: -ncache mode is in effect to provide            
28/10/2016 20:50:13   client-side pixel data caching.  This speeds up                    
28/10/2016 20:50:13   iconifying/deiconifying windows, moving and raising                
28/10/2016 20:50:13   windows, and reposting menus.  In the simple CopyRect              
28/10/2016 20:50:13   encoding scheme used (no compression) a huge amount                
28/10/2016 20:50:13   of extra memory (20-100MB) is used on both the server and          
28/10/2016 20:50:13   client sides.  This mode works with any VNC viewer.                
28/10/2016 20:50:13   However, in most you can actually see the cached pixel             
28/10/2016 20:50:13   data by scrolling down, so you need to re-adjust its size.         
28/10/2016 20:50:13   See http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching.   
28/10/2016 20:50:13   If this mode yields undesired behavior (poor response,             
28/10/2016 20:50:13   painting errors, etc) it may be disabled via: '-ncache 0'          
28/10/2016 20:50:13   You can press 3 Alt_L's (Left "Alt" key) in a row to               
28/10/2016 20:50:13   repaint the screen, also see the -fixscreen option for             
28/10/2016 20:50:13   periodic repaints.                                                 
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 XKEYBOARD: number of keysyms per keycode 7 is greater                
28/10/2016 20:50:13   than 4 and 51 keysyms are mapped above 4.                          
28/10/2016 20:50:13   Automatically switching to -xkb mode.                              
28/10/2016 20:50:13   If this makes the key mapping worse you can                        
28/10/2016 20:50:13   disable it with the "-noxkb" option.                               
28/10/2016 20:50:13   Also, remember "-remap DEAD" for accenting characters.             
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 X FBPM extension not supported.                                      
28/10/2016 20:50:13 X display is capable of DPMS.                                        
28/10/2016 20:50:13 --------------------------------------------------------             
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 Default visual ID: 0x21                                              
28/10/2016 20:50:13 Read initial data from X display into framebuffer.                   
28/10/2016 20:50:13 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/7680                 
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 X display :0 is 32bpp depth=24 true color                            
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 Autoprobing TCP port                                                 
28/10/2016 20:50:13 Autoprobing selected port 5900                                       
28/10/2016 20:50:13 Listening also on IPv6 port 5900 (socket 10)                         
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 Xinerama is present and active (e.g. multi-head).                    
28/10/2016 20:50:13 Xinerama: number of sub-screens: 1                                   
28/10/2016 20:50:13 Xinerama: no blackouts needed (only one sub-screen)                  
28/10/2016 20:50:13                                                                      
28/10/2016 20:50:13 fb read rate: 358 MB/sec                                             
28/10/2016 20:50:13 fast read: reset -wait  ms to: 10                                    
28/10/2016 20:50:13 fast read: reset -defer ms to: 10                                    
28/10/2016 20:50:13 The X server says there are 11 mouse buttons.                        
28/10/2016 20:50:13 screen setup finished.                                               
28/10/2016 20:50:13                                                                      
                                                                                         
The VNC desktop is:      AS3102T-693D:0                                                  
PORT=5900                                                                                
28/10/2016 20:50:17 Got connection from client 192.168.11.61                             
28/10/2016 20:50:17   other clients:                                                     
28/10/2016 20:50:17 Disabled X server key autorepeat.                                    
28/10/2016 20:50:17   to force back on run: 'xset r on' (3 times)                        
28/10/2016 20:50:17 incr accepted_client=1 for 192.168.11.61:51515  sock=11              
28/10/2016 20:50:17 Client Protocol Version 3.8                                          
28/10/2016 20:50:17 Protocol version sent 3.8, using 3.8                                 
28/10/2016 20:50:17 rfbProcessClientSecurityType: executing handler for type 2           
28/10/2016 20:50:17 Pixel format for client 192.168.11.61:                               
28/10/2016 20:50:17   8 bpp, depth 8                                                     
28/10/2016 20:50:17   true colour: max r 7 g 7 b 3, shift r 0 g 3 b 6                    
28/10/2016 20:50:17 Enabling X-style cursor updates for client 192.168.11.61             
28/10/2016 20:50:17 Enabling full-color cursor updates for client 192.168.11.61          
28/10/2016 20:50:17 Enabling cursor position updates for client 192.168.11.61            
28/10/2016 20:50:17 Enabling KeyboardLedState protocol extension for client 192.168.11.61
28/10/2016 20:50:17 Enabling NewFBSize protocol extension for client 192.168.11.61       
28/10/2016 20:50:17 Enabling SupportedMessages protocol extension for client 192.168.11.6
1                                                                                        
28/10/2016 20:50:17 Enabling SupportedEncodings protocol extension for client 192.168.11.
61                                                                                       
28/10/2016 20:50:17 Enabling ServerIdentity protocol extension for client 192.168.11.61  
28/10/2016 20:50:17 Enabling Xvp protocol extension for client 192.168.11.61             
28/10/2016 20:50:17 Using hextile encoding for client 192.168.11.61                      
28/10/2016 20:50:18 client 1 network rate 210.3 KB/sec (35706.4 eff KB/sec)              
28/10/2016 20:50:18 client 1 latency:  33.1 ms                                           
28/10/2016 20:50:18 dt1: 0.4561, dt2: 0.2574 dt3: 0.0331 bytes: 146565                   
28/10/2016 20:50:18 link_rate: LR_UNKNOWN - 33 ms, 210 KB/s                              
28/10/2016 20:50:18 client useCopyRect: 192.168.11.61 -1                                 
28/10/2016 20:50:18 client_set_net: 192.168.11.61  0.0530                                
28/10/2016 20:50:18 created   xdamage object: 0x1200040                                  
28/10/2016 20:50:18 copy_tiles: allocating first_line at size 61                         
28/10/2016 20:50:21 set_ncache_xrootpmap: trying root background                         
28/10/2016 20:50:21 snapshotting background...                                           
28/10/2016 20:50:21 done.                                                                
28/10/2016 20:50:21 cursor_noshape_updates_clients: 0                                    
28/10/2016 20:50:27 created selwin: 0x1200043                                            
28/10/2016 20:50:27 called initialize_xfixes()                                           
28/10/2016 20:50:27 cursor_noshape_updates_clients: 0                                    
28/10/2016 20:50:28 client_count: 0                                                      
28/10/2016 20:50:28 Restored X server key autorepeat to: 1                               
28/10/2016 20:50:28 Client 192.168.11.61 gone                                            
28/10/2016 20:50:28 Statistics             events    Transmit/ RawEquiv ( saved)         
28/10/2016 20:50:28  XvpServerMessage    :      1 |         4/        4 (  0.0%)         
28/10/2016 20:50:28  FramebufferUpdate   :     31 |         0/        0 (  0.0%)         
28/10/2016 20:50:28  hextile             :     86 |    294604/ 28368425 ( 99.0%)         
28/10/2016 20:50:28  ServerIdentify      :      1 |        36/       36 (  0.0%)         
28/10/2016 20:50:28  SupportedEncoding   :      1 |        92/       92 (  0.0%)         
28/10/2016 20:50:28  SupportedMessage    :      1 |        76/       76 (  0.0%)         
28/10/2016 20:50:28  PointerPos          :      1 |        12/       12 (  0.0%)         
28/10/2016 20:50:28  RichCursor          :      2 |       498/      498 (  0.0%)         
28/10/2016 20:50:28  TOTALS              :    124 |    295322/ 28369143 ( 99.0%)         
28/10/2016 20:50:28 Statistics             events    Received/ RawEquiv ( saved)         
28/10/2016 20:50:28  PointerEvent        :    104 |       624/      624 (  0.0%)         
28/10/2016 20:50:28  FramebufferUpdate   :     32 |       320/      320 (  0.0%)         
28/10/2016 20:50:28  SetEncodings        :      1 |        52/       52 (  0.0%)         
28/10/2016 20:50:28  SetPixelFormat      :      1 |        20/       20 (  0.0%)         
28/10/2016 20:50:28  TOTALS              :    138 |      1016/     1016 (  0.0%)         
28/10/2016 20:50:28 deleted 60 tile_row polling images.                                  
28/10/2016 20:50:28 Default visual ID: 0x21                                              
28/10/2016 20:50:29 Read initial data from X display into framebuffer.                   
28/10/2016 20:50:29 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/7680                 
28/10/2016 20:50:29 rfbNewFramebuffer(0x1b0eeb0, 0x0, 1920, 12960, 8, 1, 4)              
28/10/2016 20:50:29                                                                      
28/10/2016 20:50:29 X display :0 is 32bpp depth=24 true color                            
28/10/2016 20:50:29                                                                      
28/10/2016 20:50:29 calling setTranslateFunction()...                                    
28/10/2016 20:50:29   done.                                                              
28/10/2016 20:50:29                                                                      
28/10/2016 20:50:29 Xinerama is present and active (e.g. multi-head).                    
28/10/2016 20:50:29 Xinerama: number of sub-screens: 1                                   
28/10/2016 20:50:29 Xinerama: no blackouts needed (only one sub-screen)                  
28/10/2016 20:50:29                                                                      
28/10/2016 20:50:29 check_ncache: resetting cache: 11/512 10 0                           
28/10/2016 20:50:29 set_ncache_xrootpmap: trying root background                         
28/10/2016 20:50:29 snapshotting background...                                           
28/10/2016 20:50:29 done.                                                                
28/10/2016 20:50:29 destroyed xdamage object: 0x1200040                                  
広告