1

I have installed VNC Server, it starts from the command line and I am able to connect from my laptop. The problem is that I can not make start up at boot, which forces me to link a monitor, keyboard and mouse to the Raspberry each time I switch it on.

I have the following script at /etc/init.d:

#! /bin/sh
# /etc/init.d/vncboot

USER=root
HOME=/root

export USER HOME

case "$1" in
 start)
   echo "Starting VNC Server"
   #Insert your favoured settings for a VNC session
   /usr/bin/vncserver :2 -geometry 1680x945 -depth 24
   ;;

 stop)
   echo "Stopping VNC Server"
   /usr/bin/vncserver -kill :0
   ;;

 *)
   echo "Usage: /etc/init.d/vncboot {start|stop}"
   exit 1
   ;;
esac

exit 0

Am I doing something wrong? Is there any way to understand what is failing?

  • This looks OK. Have you set permissions to 755? See elinux.org/RPi_VNC_Server#Run_at_boot You don't need to use a monitor, keyboard and mouse. When I want to run tightvncserver I ssh into my Pi and start it from there. – Milliways Jul 14 '14 at 0:17
2

The following process worked for me, it's a little long but I hope it helps:

Log into a terminal on the Pi as root:

sudo su

Navigate to the directory /etc/init.d/:

cd /etc/init.d/

Create a new file here containing the following script:

#! /bin/sh
# /etc/init.d/vncboot

### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO

USER=pi
HOME=/home/pi

export USER HOME

case "$1" in
 start)
  echo "Starting VNC Server"
  #Insert your favoured settings for a VNC session
  su - $USER -c "/usr/bin/vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565"
  ;;

 stop)
  echo "Stopping VNC Server"
  /usr/bin/vncserver -kill :1
  ;;

 *)
  echo "Usage: /etc/init.d/vncboot {start|stop}"
  exit 1
  ;;
esac

exit 0

Save this file as vncboot (for example)

Make this file executable:

chmod 755 vncboot

Enable dependency-based boot sequencing:

update-rc.d lightdm remove
update-rc.d vncboot defaults

If enabling dependency-based boot sequencing was successful, you will see this:

update-rc.d: using dependency based boot sequencing

Reboot your Raspberry Pi and you should find a VNC server already started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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