0


This is what i am trying to do-
I have made a automatic plant watering system which uses a simple moisture sensor to check if there is water a or not and run a pump accordingly.. I have to present this and i don't have a monitor setup over there. So i am trying to use vnc server. i start my hotspot and connect raspberry pi to it at home and i switch on vnc server once to test it(using sudo raspi-config in advanced options). When i restart my raspbery pi it connects to my hotspot automatically but the vnc server does not work. to make it work i need to sudo raspi-config and go to vnc and switch it one even when it shows on. It works after that. can someone tell me what can i do so that vnc server remains on all the time and works?

  • Please indicate which vnc server software you are running and how you have installed it – Mohammad Ali Nov 26 '16 at 15:39
  • @MohammadAli I am running the pre-installed vnc server on JESSIE WITH PIXEL os – Dhruva Nov 26 '16 at 15:45
  • In the original Raspbian+PIXEL release (Oct 2016), there was an issue where the VNC service mode server wouldn't start on boot in some circumstances. Are you using this version? If so, try updating your system (or at least update the realvnc-vnc-server package). – Andrew Wedgbury Feb 23 '17 at 11:29
0

1) Make sure VNC is enabled is system preferences

sudo su

cd /etc/init.d/

2) Create another file in nano, this time called vncboot:

sudo nano vncboot

3) Enter the following (copy and paste should work, but check that it hasn’t pasted multipe times).

#! /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 - pi -c "/usr/bin/vncserver :1 -geometry 1920x1200"
;;

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

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

exit 0

4) Next, make the file executable:

chmod 755 vncboot

5.1) Finish with

update-rc.d /etc/init.d/vncboot defaults

5.2) …or if this doesn’t work…

update-rc.d vncboot defaults

(Note: I found this online but lost the source. . .)

  • This vncboot script starts a VNC virtual mode server, which I don't think is what the OP was asking about. Enabling VNC from raspi-config is supposed to start the VNC service mode server, which allows access to the console session - this appears to be the part that isn't working. – Andrew Wedgbury Feb 23 '17 at 11:24

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.