Thursday, June 5, 2014

RaspBMC Remote Desktop

First of all, although possible to connect to setup remote desktop on RaspBMC it works awfully slow and probably does not bring a other usability than navigating through UI.
Video simply hangs so it's impossible to watch any.

These are the steps to set it up:
1.  Open your favorite text editor and save the script,

e.g. command : nano vncserver
and paste this script:

!/bin/sh

case $1 in
  start)
    if [ -f /var/run/vnc.pid ] ; then
      echo "VNC server is already running"
    else
      initctl stop xbmc
      sudo vnc_dispmanx 2>/dev/null &
      echo $! | sudo dd of=/var/run/vnc.pid
      initctl start xbmc
    fi
    ;;
  stop)
    if [ -f /var/run/vnc.pid ] ; then
      sudo kill -TERM $(cat /var/run/vnc.pid)
      sudo rm /var/run/vnc.pid
    else
      echo "VNC server is not running"
    fi
    ;;
  *)
    echo "Usage $0 start|stop"
    ;;
esac

2. chmod +x vncserver

3. sudo mv vncserver /usr/local/sbin

4. vncserver start
If you want to check if it's running, check if vnc_dispmanx has the default VNC port open (5900)
pi@raspbmc:~$ sudo netstat -lnptu |grep vnc
tcp        0      0 0.0.0.0:5900            0.0.0.0:*               LISTEN      3687/vnc_dispmanx

tcp6       0      0 :::5900                 :::*                    LISTEN      3687/vnc_dispmanx

5. When you're done, you should turn it off, as it's quite CPU hungry: 

vncserver stop

Connecting with VNC viewerFrom Ubuntu you can use vncviewer:

sudo apt-get install vncviewer

vncviewer 192.168.1.101:5900


1 comment:

  1. After trying for days to get x11vnc to work and failed, I tried this solution and was finally able to remotely connect to my rasbperry pi's desktop (running kodi). Thank you for posting this. It was very very helpful!

    ReplyDelete