Everytime after reboot when user tries to start vnc below error is thrown
$ vncserver :5
Couldn't start Xvnc; trying default font path.
Please set correct fontPath in the vncserver script.
Couldn't start Xvnc process.
_XSERVTransSocketCreateListener: failed to bind listener
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local
Fatal server error:
Failed to establish all listening sockets
_XSERVTransSocketCreateListener: failed to bind listener
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local
Fatal server error:
Failed to establish all listening sockets
It works after removing .X11* files under /tmp . But want to know why this is happening after each reboot and we have to remove these files manually after which user is able to start the session.
A script is seen under /etc/rc2.d which has the below content
There are options to tell vnc to use just tcp/ip sockets. Since you are usually not local, that is fine. It takes the first one it can bind(). Look around in vncserver perl.
There are two families of sockets X supports, AF_UNIX and AF_INET, see man 2 socket. AF_UNIX only works locally but AF_INET works on the internet. The files are markers for the AF_UNIX listeners, and should be removed on reboot but apparently are not. I usually have too little access to remove them, anyway. I had a similar error before, so I went into vncserver, a perl script, and discovered how to make it just test AF_UNIX. Oh look what google found: Unix - VNC
Thanks to you , i didnt know that vncserver was a perl script. i will try this option next time.
vncserver -nolisten local
Btw.. can you please tell me what should i edit in the perl script so that a execution of "vncserver" command the system should automatically pick "-nolisten local" as parmaters.
It's not the display number that is an issue, just let it find an open one, but my vncserver gets chatty along the way. That option is passed to Xvnc, apparently:
$ vncserver -h
usage: vncserver [:<number>] [-name <desktop-name>] [-depth <depth>]
[-geometry <width>x<height>]
[-pixelformat rgbNNN|bgrNNN]
<Xvnc-options>...
vncserver -kill <X-display>
$
#
# CheckDisplayNumber checks if the given display number is available. A
# display number n is taken if something is listening on the VNC server port
# (5900+n) or the X server port (6000+n).
#
sub CheckDisplayNumber
{
local ($n) = @_;
socket(S, $AF_INET, $SOCK_STREAM, 0) || die "$prog: socket failed: $!\n";
eval 'setsockopt(S, &SOL_SOCKET, &SO_REUSEADDR, pack("l", 1))';
if (!bind(S, pack('S n x12', $AF_INET, 6000 + $n))) {
close(S);
return 0;
}
close(S);
socket(S, $AF_INET, $SOCK_STREAM, 0) || die "$prog: socket failed: $!\n";
eval 'setsockopt(S, &SOL_SOCKET, &SO_REUSEADDR, pack("l", 1))';
if (!bind(S, pack('S n x12', $AF_INET, 5900 + $n))) {
close(S);
return 0;
}
close(S);
if (-e "/tmp/.X$n-lock") {
warn "\nWarning: $host:$n is taken because of /tmp/.X$n-lock\n";
warn "Remove this file if there is no X server $host:$n\n";
return 0;
}
if (-e "/tmp/.X11-unix/X$n") {
warn "\nWarning: $host:$n is taken because of /tmp/.X11-unix/X$n\n";
warn "Remove this file if there is no X server $host:$n\n";
return 0;
}
if (-e "/usr/spool/sockets/X11/$n") {
warn("\nWarning: $host:$n is taken because of ".
"/usr/spool/sockets/X11/$n\n");
warn "Remove this file if there is no X server $host:$n\n";
return 0;
}
return 1;
}