mushuuu
Posts: 7
Joined: Fri Aug 31, 2012 10:50 pm

can't get VNC server enabled on boot

Sat Sep 01, 2012 12:43 am

Hey, i tried to manage to get tightvncserver started on boot but i failed, here's what i did :

created VNC.sh :
#/bin/bash
vncserver :1 -geometry 800x600 -depth 16 -pixelformat rgb565

modified /etc/rc.local : added :
/home/pi/Desktop/VNC.sh

but my vnc viewer won't connect until i start vncserver manually. Any idea to get it working folks?

Thanks in advance.

User avatar
LetHopeItsSnowing
Posts: 357
Joined: Sat May 26, 2012 6:40 am
Location: UK
Contact: Website

Re: can't get VNC server enabled on boot

Sat Sep 01, 2012 5:38 am

I dont know why your script isn't working but I've had problems getting stuff started using local.rc, and found init.d scripts more a reliable way of starting services, they also ensure services are shutdown correctly too.

See http://stuffaboutcode.blogspot.com/2012 ... p.html?m=1 for info on how to startup services using init.d scripts.

LHIS
"am I getting slower, or is stuff more complicated; either way I now have to write it down - stuffaboutcode.com"

mushuuu
Posts: 7
Joined: Fri Aug 31, 2012 10:50 pm

Re: can't get VNC server enabled on boot

Sat Sep 01, 2012 8:30 am

Alright i followed the tutorial,

I came up with this :

Code: Select all

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

vncserver :1 -geometry 1024x600 -depth16 -pixelformat rgb565

case "$1" in
 start)
  echo "Starting VNC server"
  vncserver :1 -geometry 1024x600 -depth 16 -pixelformat rgb565
  ;;
 stop)
  echo "Stopping VNC Server"
  vncserver -kill :1
  ;;
 *)
  echo "Usage : /etc/init.d/vnc {start|stop}"
  exit 1
  ;;
esac


exit 0
Integrated it in the system with :
sudo update-rc.d vnc defaults
Made sure it worked well with start/stop.
Tried to add a number after "defaults", same result.

But my VNC client still won't connect when my raspi reboot.

mushuuu
Posts: 7
Joined: Fri Aug 31, 2012 10:50 pm

Re: can't get VNC server enabled on boot

Sat Sep 01, 2012 6:40 pm

I edited my script with

Code: Select all

touch /home/pi/Desktop/testatlaunch 
instead of the vncserver and stuff line and it worked.

Therefore i'm pretty sure that my problem is related with the fact that Raspi doesn't start "by default" with a desktop enabled.

I used raspi-config to have a dekstop on boot already, so the solution is not here.
I also tried to update-rc.d it with "defaults 99" at the end, same result.

Any advice ?

Wendo
Posts: 142
Joined: Sun Jun 10, 2012 8:27 pm

Re: can't get VNC server enabled on boot

Sun Sep 02, 2012 7:54 am

You shouldn't have to give vncserver any command line options.

I've got it happily running at startup on raspbian, startup script below

Code: Select all

#! /bin/sh
### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: vnc server
# Description:
#
### END INIT INFO

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    su pi -c '/usr/bin/vncserver'
    echo "Starting VNC server "
    ;;
  stop)
    pkill vncserver
    echo "VNC Server has been stopped (didn't double check though)"
    ;;
  *)
    echo "Usage: /etc/init.d/blah {start|stop}"
    exit 1
    ;;
esac

exit 0

mushuuu
Posts: 7
Joined: Fri Aug 31, 2012 10:50 pm

Re: can't get VNC server enabled on boot

Sun Sep 02, 2012 6:23 pm

Solved, guess i was too much noob to debian to succeed by myself.

I love you so much,
Thank you.

munklefish
Posts: 75
Joined: Tue Oct 02, 2012 5:35 pm
Location: Neumarkt in der Oberpfalz
Contact: Website

Re: can't get VNC server enabled on boot

Tue Jan 07, 2014 9:03 pm

Please elaborate on how you resolved this.
http://www.codeclinic.de

Return to “Raspbian”