16

I exactly followed these instructions on the official RPi site to install TightVNC on my Pi (model 2). The Pi has a static IP address and I can ping it and SSH in (obviously), so I know it's working.

When I try to connect using the Windows TightVNC client, however, I get a message that the server actively refused the connection. I'm using 192.168.x.x:0 to connect, but I also tried 192.168.x.x:5900 as recommended elsewhere, neither worked. What do I need to do to get TightVNC to properly work?

ps aux | grep vnc returns the following:

root      1888  0.0  0.0   1768   376 ?        S    11:26   0:00 /bin/sh /etc/init.d/vncboot start
root      1899  0.0  0.3   4756  3752 ?        S    11:26   0:00 /usr/bin/perl /usr/bin/vncserver :0 -geometry 1920x1080 -depth 32 -pixelformat rgb565
root      2055  0.0  0.0   1692   272 ?        S    11:26   0:00 vncpasswd /root/.vnc/passwd

netstat -l returns this:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:ssh                   *:*                     LISTEN
udp        0      0 192.168.6.31:ntp        *:*
udp        0      0 localhost:ntp           *:*
udp        0      0 *:ntp                   *:*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ACC ]     STREAM     LISTENING     4914     /tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     4887     /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     4913     @/tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     6965     /tmp/.pcmanfm-socket--0-pi
unix  2      [ ACC ]     STREAM     LISTENING     4972     /tmp/ssh-yoCLTWKx0wUO/agent.2194
unix  2      [ ACC ]     STREAM     LISTENING     8238     /tmp/.menu-cached-:1-steven
unix  2      [ ACC ]     SEQPACKET  LISTENING     419      /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     5730     @/tmp/dbus-GF4T9MxwNb
unix  2      [ ACC ]     STREAM     LISTENING     5779     /tmp/.menu-cached-:0-pi
32

I know this was asked a long time ago, but I found an solution to this problem.

If you start it using display :1 (or something more than 0), you have to enter the IP like this: 192.168.x.x:590<displayNumber> (like this 192.168.1.23:5901).

I hope this helps a future user

  • In the TightVNC viewer you have to specify the port number, i.e. 192.168.0.10::5901 (yes, double colon) – user36573 Nov 8 '15 at 13:31
  • Happy it helps! – jdtech Apr 22 '17 at 4:49
3

I think that the number 0 of Xserver is for the real screen (HDMI on pi).
So, do not login the GUI desktop after booting up. Or you can try to use :1 instead.

tightvncserer :1

Below is a config file for auto startup.

#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvnc
# 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

# Set the VNCUSER variable to the name of the user to start tightvncserver under
VNCUSER='pi'
eval cd ~$VNCUSER
case "$1" in
 start)
   su $VNCUSER -c '/usr/bin/tightvncserver :1 -geometry 1200x700 -depth 16 -pixelformat rgb565'
   echo "Starting TightVNC server for $VNCUSER "
   ;;
 stop)
   pkill Xtightvnc
   echo "Tightvncserver stopped"
   ;;
 *)
   echo "Usage: /etc/init.d/tightvnc {start|stop}"
   exit 1
   ;;
esac
exit 0

Save this file to /etc/init.d/tightvnc, and add it to start-up list.

sudo chmod 755 tightvnc
sudo update-rc.d tightvnc defaults
  • Running OS X default VNC connection. After enabling VNC on Rpi Gui config I couldn't connect anymore... Starting TightVNC with :1 at Rpi command line fixed the issue for me. Auto start-up worked like a charm as well. Thanks!! – brasofilo Feb 14 '17 at 3:33
2

After you install TightVNC on server(pi) and client(remote computer) you have to put a password on server end. Type vncpasswd in tight vnc server's terminal (i.e pi). Give a password and then try to login your pi.

1

This does NOT work. Many people (including myself) have tried, unsuccessfully.

If fact, it probably does work, but only if you try to connect as root, which is not a good idea, and not what most people expect.

tightvncserver can not share the user desktops until the user is logged in.

I suggest you first logon using ssh and start tightvncserver. You can then connect using a VNC client.

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.