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
  • Are you saying you are only getting the error when running it without sudo? – Steve Robillard Jan 11 '16 at 0: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 0:15
  • you didn't what? – Steve Robillard Jan 11 '16 at 0:16
  • what is the output of ls -la /etc/init.d – Steve Robillard Jan 11 '16 at 0:26
  • @SteveRobillard I edited the question as it should've been. Sorry about that. – Architek1 Jan 11 '16 at 0:26
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.

  • 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 2: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 3: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 0:26

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.