Search code examples
linuxubuntusshvncvnc-server

VNC4Server/vncserver – always use desktop number 1 after starting of the vnc server


I am using vncserver on a Ubuntu 14.04.3 LTS server machine to connect remotely and perform administrative tasks. I do not automatically start VNC. I first connect over SSH and call "vncserver -geometry 1024x800 &" to start it.

However normally vncserver always created desktop 1. Only if I had forgotten about a already running desktop it used 2 or 3 for the second session. But as soon as I killed all processes it started clean at desktop 1 again.

Now since I did some changes in startup by running multiple sessions for testing at a time and also after I changed the hostname of the server it always keeps starting with desktop 2 meanwhile 3. While 1 and 2 is definitively not running. I also removed all logs in my vnc home dir of previous sessions.

Well I'm wondering why and out of what reason it keeps increasing the desktop number sometimes. Also I would like to get it back to desktop 1 and fix it somehow. So that I can easily save the server Ip (IP:1) in my Remote-Profile without the need of changing it from time to time because vnsserver starts from an higher number.

Any ideas why it won't take desktop 1 any more?

:( Thanks


Solution

  • vncserver will take the first available port from 5901 and onwards. There can be a few reasons why this does not work, like the port already being taken for something else. Or that vncserver is actually still running. Check out the file specified as log file for a clue.

    You can check whether there still are vncserver processes running with:

    vncserver -list
    

    Without more information it's difficult to answer your question to the fullest. The various vnc implementations also behaves differently.

    You can try to force it to open on display :1 by specifying it on the command line

    vncserver :1 -geometry 1024x800