Tips

problems with "socket() failed for local/xxx" errors when running quake?

date added/updated
7/Oct/2002
keywords
X11TransSocketOpen X11FontTransSocketOpen GLimp_Init "protocol not supported"
example
I had this problem when trying to run quake3 after installing a large number of maps. Other people have it trying to start X after recompiling their kernel.
Possible causes and/or fixes:
  • If you've just recompiled your kernel, you may not have compiled UNIX domain sockets, or you may need to load the module. If you compiled it in as a module, try

    lsmod

    to see if it is loaded. I think the module is just called 'unix'. If it's not, run

    modprobe unix

    If you didn't compile it in to your kernel or as a module, you'll need to do so. You can see if any applications are using unix domain sockets by running the command

    netstat -xp

  • Check that you have the host defined properly in /etc/hosts or that it can be resolved properly. For example, if your error was

    socket() failed for local/blah:0

    check that you have blah defined in your /etc/hosts file.
  • If the error is something like X11FontTransSocketOpen, check that your font server (xfs) is running, or check your font configuration in your X setup. Also, your font server may be configured to only allow up to some small number of connections. Check your xfs configuration (maybe in /etc/X11/fs/). I saw two options in there - one which said how many connections the server should accept, and another which says whether the xfs should spawn off another font server to handle connections over this limit. So you may want to try setting the number up or enabling the other option. Still, I don't think this is likely to help unless you are running many X servers, because I think (I don't know) that it would probably only be the X server itself which would connect to the font server.
  • From the socket or unix man page, apparently unix sockets can fail to be created or connected to if they they are represented by a file in the file system and the permisssions on the file or parent directory of the file are not suitable. So if you know the name of the socket, check that there isn't an old file around with too restrictive permissions. An example of a such a socket file is

    /tmp/.X11-unix/X0

    for the XFree86 server display :0
  • Your application may have too many files open. I think there is usually a limit to the number of files an application can have open at once, and if you application has this many files open it may not then be able to open a socket (since the socket may be represented in UNIX as a file). I think this is the problem I had. If you think your application may be opening many files, read the description of the problem that I had, just below.
My problem and how I fixed it
I couldnt' run quake 3. Here's the exact error message that I was getting:

----- R_Init -----
...loading libGL.so.1: Initializing OpenGL display
...setting mode 3: 640 480
_X11TransSocketOpen: socket() failed for local
_X11TransSocketOpenCOTSClient: Unable to open socket for local
_X11TransOpen: transport open failed for local/blah:0
Error couldn't open the X display
...WARNING: could not set the given mode (3)
----- CL_Shutdown -----
RE_Shutdown( 1 )
-----------------------
----- CL_Shutdown -----
-----------------------
Sys_Error: GLimp_Init() - could not load OpenGL subsystem

Other applications connected to the X server fine, both with and without openGL. My hostname was configured completely correctly. The font server was running fine. I only had the problem with quake3. I had just added 600 or so maps to my quake installation. It is my opinion that quake3 was scanning all these files, and keeping them open. Then when it got to the socket() call, it had no file handles left for opening the socket to the X server. Anyway now I have a bunch of map sets and a script which just sets up links to the files from whichever set of maps I'm trying out. If this is not a suitable solution for you, you may be able to increase the file handle limit by recompiling your kernel or possibly with the ulimit command.

Unfortunately it took me two days to realise that this was the problem. Before installing the maps I had made a backup of /usr/local/games/quake3 to /usr/local/games/quake3-backup. Then I installed the maps and tried to run quake3, and got the above error. The first thing I tried was running the backup version of quake3 (/usr/local/games/quake3-backup/quake3), to check that that ran ok. Of course in a stroke of genius, loki games or whoever ported quake3 to linux decided to make that file a script with, as it's first line:

cd /usr/local/games/quake3

ie the script in my backup directory did not run the quake3 backup version at all. Since, in the last couple of days, I'd upgraded my nVidia drivers, my XFree86 installation, and the glibc libraries, I could not be sure that one of those hadn't caused the problem. First I tried downgrading my nVidia drivers again, then X, then I tried a completely new installation of mandrake 9, then when it still didn't work, to go back to mandrake 8.2, with the same nVidia drivers and X installation that had been working for ages. It still didn't work.

It was only when I went to try using strace on /usr/local/games/quake3-backup/quake3 that I remembered it was a script and so I went to edit the script to make it strace the quake3 binary and saw that it was cd'ing to the /usr/local/games/quake3 directory regardless of where it was itself.