How to Run TightVNC Server at Boot on new 3.1 Image

I downloaded and installed the new 3.1 image and it’s running great. I’ve also installed the TightVNC Server. I can get the service to run manually by SSH’ing into the Pi, but I’d like the service to start automatically on boot. I’ve tried the usual ways via the config.txt file, but the raspi-config utility won’t keep the settings when I select the VNC service. Any ideas?

A cron job to start it at boot maybe? Or change one of the init.d thingies?..no experience there. I installed webmin, and you can select which services start at boot. …just a couple of thoughts.

I got this instructions some place and they work for me fine:
(I just don’t remember from what site I copied this).

Open nano (text editor) to create a file to auto start Tight VNC Server

sudo nano /etc/init.d/tightvncserver

Type in the following (or copy and paste exactly as shown):

#!/bin/sh

/etc/init.d/tightvncserver

BEGIN INIT INFO

Provides: tightvncserver

Required-Start: $remote_fs $syslog

Required-Stop: $remote_fs $syslog

Default-Start: 2 3 4 5

Default-Stop: 0 1 6

Short-Description: Start daemon at boot time

Description: Enable service provided by daemon.

END INIT INFO

Set the VNCUSER variable to the name of the user to start tightvncserver under

VNCUSER=‘pi’
case “$1” in
start)
su $VNCUSER -c ‘/usr/bin/tightvncserver :1’
echo “Starting TightVNC server for $VNCUSER”
;;
stop)
pkill Xtightvnc
echo “Tightvncserver stopped”
;;
*)
echo “Usage: /etc/init.d/tightvncserver {start|stop}”
exit 1
;;
esac
exit 0

Press Ctrl+x, then y to save and Enter to keep the same file name.
Edit the permissions of this file to make it executable and active:

sudo chmod 755 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults

Now it is time to test it: Reboot the Rpi:

sudo reboot
And now try connecting the thightVNC program from your remote computer, where you need to load a VNC viewer first for your PC, MAC or tablet.

Or issue this command to check if VNC server is listening to port 5901 ( if you accepted this default port):

sudo netstat -apn | grep -w tcp | grep LISTEN

Additionally we use a VNC weaved service to connect to the VNC from anywhere (weaved.com)

===========================================================================
Remember you need to load a browser too, none is available in ver 3.1. With this commands from the terminal:

sudo apt-get update
To install Firefox, that was named iceweasel due to copyrighted stuff.
sudo apt-get install iceweasel

Cheers and again my apologies for the author of this mod for not naming him.

Alex

I tried the init.d script and now it works flawlessly. Thanks for posting the code and step-by-step instructions. I know just enough about the command line stuff to be very dangerous. :smiley:

You are welcome, and we are always glad to share our experiences on remote connecting to our almost 30 rPi systems in N. Mexico.

Alex