0

I'm setting up my RPi 2 so I can run VNC from my Mac. I am running Raspbian Jessie Lite, and using this setup

http://www.brooksskybennett.cm/brooksskybennett/wp-content/uploads/2013/05/Setting-up-VNC-on-Raspberry-Pi-for-Mac-access-4DC5.pdf.

Utilizing the last script for the tightvncserver file:

#!bin/bash
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $remotefs $syslog
# Required-Stop: $remotefs $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
# The Username:Group that will run VNC
export USER=”pi”
#${RUNAS}

# The display that VNC will use
DISPLAY=”1"
# Color depth (between 8 and 32)
DEPTH=”16"
# The Desktop geometry to use.
#GEOMETRY=”x”
GEOMETRY=”800×600"
#GEOMETRY=”1440×900"
#GEOMETRY=”1280×1024" 
#GEOMETRY=”1920×1080"
# The name that the VNC Desktop will have.
NAME=”Rasp2_VNC”
OPTIONS=”-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}”
. /lib/lsb/init-functions

case “$1" in
    start)
log_action_begin_msg “Starting vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
su ${USER} -c “/usr/bin/vncserver ${OPTIONS}”
;;

    stop)
log_action_begin_msg “Stoping vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
su ${USER} -c “/usr/bin/vncserver -kill :${DISPLAY}”
;;
    restart)
$0 stop
$0 start
;;
esac

exit 0

If I then check

cd /etc/init.d
cat -v tightvncserver

I don't have any carriage returns (^M) in the file

EDIT:

I run the command

sudo /etc/init.d/tightvncserver
sudo: unable to execute /etc/init.d/tightvncserver: No such file or directory 

Any suggestions as to why I would be seeing the error: No such file or directory? I obviously can see it when using

ls

or

sudo nano tightvncserver
Milliways
  • 54,718
  • 26
  • 92
  • 182
Architek1
  • 143
  • 2
  • 8
  • Are you saying you are only getting the error when running it without sudo? – Steve Robillard Jan 11 '16 at 00:07
  • sudo /etc/init.d/tightvncserver start Apologies as I didn't make it clear. My fault on that. I'm running the above command. – Architek1 Jan 11 '16 at 00:15
  • you didn't what? – Steve Robillard Jan 11 '16 at 00:16
  • what is the output of ls -la /etc/init.d – Steve Robillard Jan 11 '16 at 00:26
  • @SteveRobillard I edited the question as it should've been. Sorry about that. – Architek1 Jan 11 '16 at 00:26
  • -rwxr-xr-x 1 root root 1148 Jan 10 16:47 tightvncserver – Architek1 Jan 11 '16 at 00:28
  • First the above details belong in your question not in the comments. The problem may be this line export USER=”pi” but the owner/group is root. What happens if you change that line to export USER=”root”? Or change the ownership of the file to pi by doing chown pi:pi /etc/init.d/tightvncserver? – Steve Robillard Jan 11 '16 at 00:33
  • the link to the tutorial is broken as well please edit and fix that – Steve Robillard Jan 11 '16 at 00:33
  • what happens when you run this sudo /etc/init.d/tightvncserver start which is the actual command in the tutorial – Steve Robillard Jan 11 '16 at 00:40
  • I changed as your recommendations: USER = "root", sudo chown pi:pi /etc/init.d/tightvncserver and they both came back with No such file or directory. I also changed the original question to represent that with the sudo /etc/init.d/tightvncserver start which gives the same error. – Architek1 Jan 11 '16 at 00:46
  • Did you do them separately or did you do one then do the second without reverting the first? you need to change the line back to USER = "pi" before doing chown – Steve Robillard Jan 11 '16 at 00:47
  • Valid question...Changed to USER = "root" first as per permissions. Same error. Then changed USER="pi" and then changed permissions as you suggested. – Architek1 Jan 11 '16 at 00:49

1 Answers1

1

First you should run tightvncserver manually at the command line and setup the passwords etc. Don't use any fancy scripts.

You should not be messing around with init.d. That is SysV and is obsolete.

If you are running Jessie and want this to run at startup this should be started with a systemd service. See:- https://raspberrypi.stackexchange.com/a/39374/8697

This is the script I use to setup for access from my Mac.

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • Thanks for this. I followed the original thread and although I get no errors. Nothing happens. I thought I'd get a screen after the sudo systemctl daemon-reload && sudo systemctl enable vncserver@1.service? Also am I suppose to have anything in /.vnc/xstartup file? – Architek1 Jan 11 '16 at 02:36
  • @Architek1 I assume you mean `/home/pi/.vnc/xstartup` AFAIK this should be created. I changed one line `xsetroot -solid grey -cursor_name left_ptr` – Milliways Jan 11 '16 at 03:03
  • I do as I did a sudo nano /.vnc/xstartup and the file was empty. Somehow I get the feeling that this shouldn't be the case... – Architek1 Jan 11 '16 at 15:42
  • `open vnc://IP ADDRESS :5901` on my mac command line is what I was missing. – Architek1 Jan 12 '16 at 00:26