HAC
Posts: 16
Joined: Mon Aug 11, 2014 3:20 pm

Problems Running TightVNCServer

Tue Aug 26, 2014 4:25 pm

Hi there
I have successfully put my new Raspberry Pi B+ on to my home network with a static ip address. I am able to ping the Pi from my PC and the Pi has access to the Internet. I intend to be able to access the Pi remotely from my PC to save upon monitors, keyboards, etc lying around in limited space. I have been following the instructions on how to do this in the publication - Raspberry Pi for Beginners - which I got from WH Smith. I have installed the VNC server with the command sudo apt-get install tightvncserver with out a problem and then ran it with the comand tightvncserver. I was asked to set up a password which I did and all seemed well. The next step - Configuring the boot service (to get VNC running after each boot of the Pi) - calls for script to be written in the nano text editor as follows:
#!/bin/sh
# /etc/init.d/tightvncserver
#Set the VNUSER variable to the name of the user to start tightvncserver under
VNCUSER='pi'
case "$1" in
start)
su $VNCUSER -c '/usr/bin/tightvncserver :1'
echo "Starting TightVNC server for $VNCUSER"
;;
stop)
pkill Xtightvnc
echo "Tightvncserver stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0

After typing in this script, I saved it by using Ctrl & X and typing y when prompted to save it.

It is the next and final step of the instructions, editing the permissions, where the problem occurs. In the LX Terminal, you are required to enter the command: sudo chmod 755 /etc/init.d/tightvncserver This is followed by the command: update-rc.d tightvncserver defaults and, after hitting enter, it is at this point that I think the problem occurs. The screen scrolls a number of files, stating that access is denied after each one. The final instruction is to reboot using the command sudo reboot. This I do but when I try to access the Pi using the VNC viewer on my PC, it doesn't connect.

I have reinstalled Raspian and followed the instructions several times, each time with the same result. I have also tried it with the ssh server is enabled on the Pi to se if that made a difference but it didn't.

I would be grateful if anyone could help me sort this out as I have spent several hours trying to no avail.

Many thanks, in anticipation.

Andy

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Problems Running TightVNCServer

Tue Aug 26, 2014 5:45 pm

You need to make the script executable by entering

Code: Select all

chmod +x script.sh
There are 10 types of people: those who understand binary and those who don't.

HAC
Posts: 16
Joined: Mon Aug 11, 2014 3:20 pm

Re: Problems Running TightVNCServer

Tue Aug 26, 2014 5:59 pm

Thanks

New to this - sorry.

Do I enter the chmod +x script.sh as it stands in the LX terminal or does sudo need to go in front of it?

Also, do I enter before or after the sudo chmod 755 /etc/init.d/tightvncserver command?

Many thanks

Andy

tuttomatto
Posts: 15
Joined: Sat Apr 26, 2014 5:45 pm

Re: Problems Running TightVNCServer

Tue Aug 26, 2014 6:55 pm

hi,

I followed this post to enable tightvnc
http://gizmosnack.blogspot.fr/2013/11/a ... erver.html
(& you can enable it automatically at boot too)

I hope it should help you. Bye

T.

HAC
Posts: 16
Joined: Mon Aug 11, 2014 3:20 pm

Re: Problems Running TightVNCServer

Tue Aug 26, 2014 7:01 pm

Many thanks T

I will give it a try and let you know how I get on.

Cheers

Andy

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Problems Running TightVNCServer

Tue Aug 26, 2014 8:13 pm

It doesn't matter the order and if it says permission denied, then just put sudo in front of it.
There are 10 types of people: those who understand binary and those who don't.

HAC
Posts: 16
Joined: Mon Aug 11, 2014 3:20 pm

Re: Problems Running TightVNCServer

Tue Aug 26, 2014 8:31 pm

Thanks Kusti8
Is the command entered as part of the script in the nano editor or in the LX Terminal after the script has been saved to file?

Cheers
Andy

HAC
Posts: 16
Joined: Mon Aug 11, 2014 3:20 pm

Re: Problems Running TightVNCServer

Tue Aug 26, 2014 8:39 pm

Hi T

Unfortunately, the instructions at the link you sent me didn't work either. When trying to connect via the tight vnc viewer, I got the following message:

Error in TightVNC Viewer: No connection could be made because the target machine actively refused it.

Back to the drawing board! Thanks for your help anyway.

Andy

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Problems Running TightVNCServer

Tue Aug 26, 2014 9:29 pm

In the terminal after the file has been saved.
There are 10 types of people: those who understand binary and those who don't.

HAC
Posts: 16
Joined: Mon Aug 11, 2014 3:20 pm

Re: Problems Running TightVNCServer

Tue Aug 26, 2014 10:09 pm

Hi kusti8
I entered the command you suggested:

chmod +x script.sh

Unfortunately, the response I got was

chmod: cannot access 'script.sh' : No such file or directory

Any ideas?

Cheers

Andy

HAC
Posts: 16
Joined: Mon Aug 11, 2014 3:20 pm

Re: Problems Running TightVNCServer

Tue Aug 26, 2014 10:26 pm

Hi kusti8
Tried chmod +x /etc/init.d/tightvncserver which was accepted. However, after putting in update -rc.d tightvncserver defaults, still getting:

insserv: warning: script 'tightvncserver' missing LSB tags and overrides

This is followed by lots and lots of entries like those below:

innserv: cannot remove (file name): Permission denied
innserv: can not symlink (file name): Permission denied

Any ideas as to what is the problem?

Many thanks

Andy

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Problems Running TightVNCServer

Wed Aug 27, 2014 12:21 pm

I would just remove tightvncserver:

Code: Select all

sudo apt-get autoremove tightvncserver
And install it again:

Code: Select all

sudo apt-get install tightvncserver
Create a script to start tightvncserver:

Code: Select all

sudo nano /etc/init.d/start-tightvncserver.sh
And enter the following:

Code: Select all

#!/bin/bash
tightvncserver :1
echo "Started tightvncserver"
Save and exit: Ctrl+X, Y, Enter

And then make it executable:

Code: Select all

sudo chmod 755 /etc/init.d/start-tightvncserver.sh
sudo chmod +x /etc/init.d/start-tightvncserver
And then make it start automatically:

Code: Select all

sudo update-rc.d start-tightvncserver defaults
Hope this works
If the script above doesn't work, you can just ssh into the pi and execute tightvnvserver :1 and then VNC.
There are 10 types of people: those who understand binary and those who don't.

HAC
Posts: 16
Joined: Mon Aug 11, 2014 3:20 pm

Re: Problems Running TightVNCServer

Wed Aug 27, 2014 4:50 pm

Thanks for all your input kusti8 and also for your help T. I have now solved it and my Pi is working remotely on my home network. I found the solution by googling TightVNC running problems on Raspberry Pi. This took me to a previous post on this forum: http://www.raspberrypi.org/forums/viewt ... 2&p=552956

Simply by adding the full port number (::5901) after the ip address did the trick. I had been putting the ip address, followed by ::1

The script to start VNC automatically on boot up I was given was flawed and would not allow the tightvnc server defaults to be updated. A working script - provided by T (above) - can be found at:
http://gizmosnack.blogspot.fr/2013/11/a ... erver.html

A very frustrating few days; however, glad I have seen it through. Thank you for all your assistance.

Andy

Return to “Troubleshooting”