:: Re: [DNG] Can't open display, excep…
Top Page
Delete this message
Reply to this message
Author: Rainer Weikusat
Date:  
To: dng
Subject: Re: [DNG] Can't open display, except from ICEWM launcher
Walter Dnes <waltdnes@???> writes:
> This is *NOT* remote X; everything is local. My X display, under
> ICEWM, crashed to text console mode a few days ago. I restarted X.


[...]

> =====================================================
>
> [dev2][waltdnes][~/tv] echo ${DISPLAY}
> :0
> [dev2][waltdnes][~/tv] xhost
> xhost: unable to open display ":0"
> [dev2][waltdnes][~/tv] xhost +
> xhost: unable to open display ":0"
>
> =====================================================
>
> What the bleep?!?!?


Some bleep that might be helpful: That's the error message which gets
printed when it wasn't possible to connect to an X server on any socket
one was expected to be found. Assuming the current display number is n,
the following socket addresses will be tried:

@"/tmp/.X11-unix/Xn"
/tmp/.X11-unix/Xn
TCP 127.0.0.1 port 600n
TCP6 ::1 port 600n

The first is a socket in the abstact namespace for AF_UNIX sockets which
exists on Linux. It's possible to observe this with strace:

[rw@ftvaux]/tmp#DISPLAY=:1 strace xhost 2>&1 | grep connect
connect(3, {sa_family=AF_UNIX, sun_path=@"/tmp/.X11-unix/X1"}, 20) = -1 ECONNREFUSED (Connection refused)
connect(3, {sa_family=AF_UNIX, sun_path="/tmp/.X11-unix/X1"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_INET, sin_port=htons(6001), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
connect(3, {sa_family=AF_INET6, sin6_port=htons(6001), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_scope_id=0}, 28) = 0
connect(3, {sa_family=AF_INET6, sin6_port=htons(6001), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_scope_id=0}, 28) = -1 ECONNREFUSED (Connection refused)
connect(3, {sa_family=AF_INET, sin_port=htons(6001), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 ECONNREFUSED (Connection refused)

[attempt to connect to a display :1 which didn't exist]

My guess for the cause would be (can't test this without killing my X
session) that the crash caused the /tmp/.X11-unix/X0 socket to be left
behind in the filesystem and that the next instance of the X server
which got started thus chose the display number :1.