14

I have a Raspberry Pi with Raspbian OS. After install VNC I've tried to start the server and return this:

 ~ $ vncserver :0

Warning: raspberrypi:0 is taken because of /tmp/.X0-lock
Remove this file if there is no X server raspberrypi:0
A VNC server is already running as :0

If I remove that temp file, return this:

~ $ vncserver :0

Warning: raspberrypi:0 is taken because of /tmp/.X11-unix/X0
Remove this file if there is no X server raspberrypi:0
A VNC server is already running as :0

If I remove again, the server start, but a plain grey screen is shown trough VNC client. In short, after:

~ $ sudo rm /tmp/.X11-unix/X0
~ $ sudo rm /tmp/.X0-lock
~ $ vncserver :0

New 'X' desktop is raspberrypi:0

Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspberrypi:0.log

I can see this in the RealVNC client (screen capture):

https://dzwonsemrish7.cloudfront.net/items/40182G3E332b3f1j3846/Captura%20de%20pantalla%202013-11-11%20a%20las%2023.03.46.png?v=6719a796

I have no idea what happens.

Cœur
  • 37,241
  • 25
  • 195
  • 267
aitor
  • 2,281
  • 3
  • 22
  • 44

4 Answers4

5

Finally, I've dicovered that I can run VNC in port :1

vncserver :1

then, I must connect VNC viewer at

myIP:1

It works.

aitor
  • 2,281
  • 3
  • 22
  • 44
4

I had this issue.

The default preferences are for "Auto Login" "Login as user Pi" This means that the :0 session is already taken.

Un-click this option using Menu > Preferences > Raspberry Pi Configuration and your original scheme should work.

You can modify the default settings via the command line using

sudo raspi-config

( options 3 -> B2 ) or via a new vnc session

or via a new vnc session using session :1 vncserver :1 -geometry 1920x1080 -depth 24 -dpi 96

Sean Cull
  • 503
  • 3
  • 17
1

You should use x11vnc, install it by apt install x11vnc and run x11vnc -auth /var/run/lightdm/root/\:0 -display :0 -geometry 1280x720 to bind to the current X11 session.

After that, you can run vncviewer <your-machine-name>:0 to connect to it. (You also need to install vncviewer, there are a few choices from apt-cache search vncviewer)

vncserver is inferior to x11vnc because it cannot bind existing X11 sessions, but can only create new X11 sessions. x11vnc can do both.

To eliminate the security starting message, you can set a password with x11vnc -storepasswd and run it with x11vnc -auth /var/run/lightdm/root/\:0 -display :0 -rfbauth ~/.vnc/passwd

Brethlosze
  • 1,533
  • 1
  • 22
  • 41
xuancong84
  • 1,412
  • 16
  • 17
  • This is the proper answer. To eliminate the huge security starting message, you can set a password with `x11vnc -storepasswd` and run it with `x11vnc -auth /var/run/lightdm/root/\:0 -display :0 -rfbauth ~/.vnc/passwd` – Brethlosze May 28 '23 at 23:26
0

Try to kill process that uses 5900 port (that mean :0). you can find that process like this - netstat -antup | grep 5900. Killing with kill -9 PID command. After that just start vncserver another time.

user2986553
  • 121
  • 3
  • 1
    Thanks for your answer. I tried it, but nothin returns with sudo netstat -antup | grep 5900 – aitor Nov 13 '13 at 09:23