0

I have been trying to install Tightvnc server on my Raspberry Pi3b, which is running Raspbian Jessie. In a ssh terminal session I typed: sudo install tightvncserver. It seemed to install and when finished I typed in: tightvncserver:1 and it came back with "bad command". I also tried sudo tightvncserver:1 with the same results. It is supposed to ask to enter a password. I didn't get to that prompt.

What do I do now? I want tightvncserver to start at boot after I get this working, if I can actually do this.

1
  • You need a space between the command and the display address: tightvncserver :1, not tightvncserver:1. Either way, Raspbian now comes with a RealVNC server licence (enable it through raspi-config) which is exceedingly fast.
    – scruss
    Commented Nov 6, 2017 at 2:32

3 Answers 3

1

Raspbian now comes with a personal licence for the commercial RealVNC server. Install it like this:

sudo apt install realvnc-vnc-server

It creates an icon in the menu bar, and you can set it up from there.

Alternatively, enable it in raspi-config.

0

To install you need sudo apt-get install tightvncserver.

See Start VNC on Jessie at boot for one way of doing this.

You may have followed the Foundation tutorial (I don't know why the Foundation hasn't updated its documentation for systemd).

I haven't actually run tightvncserver from the command line for years, but AFAIK tightvncserver is all you need to enter.

2
  • In the link "Start VNC on Jessie at boot" it states to create a file. How do I do this? Do I create it in notepad on my PC and then paste it or what? Commented Sep 19, 2016 at 2:32
  • 1
    You can use any editor on any machine. I would use sudo nano /etc/systemd/system/[email protected] but there are thousands of different ways of doing it. You probably need to read some basics on using Linux.
    – Milliways
    Commented Sep 19, 2016 at 2:43
0

I use x11vnc instead, due to some problems on other PCs (not the Raspberry Pi). Do sudo apt-get install x11vnc, then create (touch /etc/init.d/myx11vnc) and edit /etc/init.d/myx11vnc and put in it: [CODE] ---------------

#!/bin/sh
# /etc/init.d/myx11vnc: set up the vnc server
### BEGIN INIT INFO
# Provides:          x11vnc
# Required-Start:    $remote_fs x11-common
# Required-Stop:     $remote_fs x11-common
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO

set -e

PATH=/usr/bin:/usr/sbin:/bin:/sbin

COMMAND="/usr/bin/x11vnc"
NAME="x11vnc"
THISSCRIPT="/etc/init.d/myx11vnc"

. /lib/lsb/init-functions
if [ -f /etc/default/rcS ]; then
  . /etc/default/rcS
fi

if [ ! -e $DISPLAY ]; then
   export DISPLAY=":0"
fi

if [ -e /root/.vnc/passwd ]; then
   PASSFILE="/root/.vnc/passwd"
fi

VERBOSE="yes"

if [ "$VERBOSE" != no ]; then
   echo "Executing $NAME $1..." >> /var/log/x11vnc-boot.log
fi

case "$1" in
  status)
    echo "$0 checking status of $NAME..."

    if [ ! -z "$(pidof $NAME)" ]; then
       echo "checking..."

       x11vncPID="$(pidof $NAME)"
       onePID="${x11vncPID%%[ ]*}" # ensure only ONE pid!

       if [ -d /proc/$onePID ]; then
          echo "found PID = $onePID, so it's running."
          x11Link="$(readlink /proc/$onePID/exe)"
          echo "/proc link is $x11Link"

          if [ $x11Link = $COMMAND ]; then
             echo "$NAME is  RUNNING."
             echo "STATUS: $NAME is  RUNNING." >> /var/log/x11vnc-boot.log
          fi
       fi
    else
       echo "$NAME has NO PID."
       echo "STATUS: $NAME is NOT RUNNING." >> /var/log/x11vnc-boot.log
    fi
  ;;

  start)
    #x11vncPID="$(pidof $NAME)"

    if [ -z "$(pidof $NAME)" ]; then
       if [ "$VERBOSE" != no ]; then
          log_begin_msg "Setting up $NAME..."
          echo  "Setting up $NAME..." >> /var/log/x11vnc-boot.log
       fi

       # uncomment this if you have setup .x11vncrc correctly...
       #if [ -e /root/.x11vncrc ]; then
       #   if [ "$VERBOSE" != no ]; then
       #      log_begin_msg "Using .x11vncrc for $NAME..."
       #   fi
       #   ARGS="-o /var/log/x11vnc.log -display $DISPLAY"
       #   $COMMAND $ARGS 2>/dev/null 1>&2 &
       #else
          ARGS="-norc -auth /var/run/lightdm/root/:0 -forever -shared -allow 192.168.1. -geometry 1900x980 -passwd MyX11VNCPasswd -o /var/log/x11vnc.log -display $DISPLAY"
          $COMMAND $ARGS 2>/dev/null 1>&2 &
       #fi
       if [ ! -z "$(pidof $NAME)" ]; then
          echo  "$NAME PID=$(pidof $NAME) started with $ARGS." >> /var/log/x11vnc-boot.log
       fi

       if [ "$VERBOSE" != no ]; then
          log_end_msg 0
       fi
    fi
    exit 0
  ;;

  restart|reload|force-reload)
    $THISSCRIPT start
  ;;

  stop)
#   :
    echo "$0 checking status of $NAME..."

    if [ ! -z "$(pidof $NAME)" ]; then
       echo "checking..."

       x11vncPID="$(pidof $NAME)"
       onePID="${x11vncPID%%[ ]*}" # ensure only ONE pid!

       if [ -d /proc/$onePID ]; then
          echo "found PID = $onePID, so it's running."
          x11Link="$(readlink /proc/$onePID/exe)"
          echo "/proc link is $x11Link"

          if [ $x11Link = $COMMAND ]; then
             kill -s SIGTERM $onePID
             # echo "$NAME is  RUNNING."
          fi
       fi
    fi
  ;;

  *)
    log_success_msg "Usage: $THISSCRIPT {start|stop|status|restart|reload|force-reload}"
    exit 1
    ;;
esac

exit 0

[/CODE] -------------------

Next do sudo update-rc.d myx11vnc defaults so that the myx11vnc script will run when you do a reboot.

The following script (startupx11vnc.sh) should work for you as well:

#!/bin/bash
#
#  Start x11vnc the hard way...
#
#
if [ ! -e $DISPLAY ]; then
   export DISPLAY=":0"
fi
#
if [ -z $DISPLAY ]; then
   export DISPLAY=":0"
fi
#
COMMAND="sudo x11vnc "
ARGS="-norc -auth /var/run/lightdm/root/:0 -forever -shared -allow 192.168.1. -geometry 1920x1080 -passwd MyX11vncPasswd -o /var/log/x11vnc.log -display $DISPLAY"
#
$COMMAND $ARGS 2>/dev/null 1>&2 &
#
exit 0
#

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.