Bug 94598

Summary: Connection refused to default socket
Product: XQuartz Reporter: Michel Rogers-Vallee <mrvkino>
Component: New BugsAssignee: Jeremy Huddleston Sequoia <jeremyhu>
Status: RESOLVED WORKSFORME QA Contact: Jeremy Huddleston Sequoia <jeremyhu>
Severity: normal    
Priority: medium    
Version: 2.7.8 (xserver-1.16.4)   
Hardware: x86-64 (AMD64)   
OS: Mac OS X (All)   
Whiteboard:
i915 platform: i915 features:

Description Michel Rogers-Vallee 2016-03-17 19:07:12 UTC
I am using Xquartz 2.7.8 on OSX 10.11.3. When I try to forward my display from my  CENTOS VM to my mac on iTerm I get the following message:

[vagrant@localhost ~]$ firefox
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
Error: cannot open display: localhost:11.0

The socket does exist in the path mentionned.

But if I start Xquartz open an xterm window and type 'xhost +', then go to iTerm and set $DISPLAY to :0 I am capable to forward my X11 window.

The problem seem to be limited to the default socket. Because the new socket '/tmp/.X11-unix/X0=' works fine.
Comment 1 Jeremy Huddleston Sequoia 2016-03-17 21:01:59 UTC
Almost certainly a bug in the version of ssh that you are using.  I suspect you’re not using /usr/bin/ssh.  Is that correct?
Comment 2 Michel Rogers-Vallee 2016-03-18 17:27:05 UTC
I tried with my os ssh and the command "vagrant ssh" both of them have the same problem. My ssh seems to be default one:
⋊> which ssh
/usr/bin/ssh

Here is the result using the os ssh:
⋊> /usr/bin/ssh -X vagrant@192.168.56.100
vagrant@192.168.56.100's password:
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Last login: Fri Mar 18 13:22:52 2016 from 192.168.56.1
[vagrant@localhost ~]$ firefox
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
Error: cannot open display: localhost:10.0
[vagrant@localhost ~]$

or with ssh -Y

⋊> /usr/bin/ssh -Y vagrant@192.168.56.100
vagrant@192.168.56.100's password:
Last login: Fri Mar 18 13:23:23 2016 from 192.168.56.1
[vagrant@localhost ~]$ firefox
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
connect /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0: Connection refused
Error: cannot open display: localhost:10.0
[vagrant@localhost ~]$
Comment 3 Jeremy Huddleston Sequoia 2016-03-18 17:56:12 UTC
Hmm... Are you actually able to connect to the socket locally (eg: by running 'xterm')?
Comment 4 Michel Rogers-Vallee 2016-03-18 18:07:47 UTC
No. I still have the same error.

⋊> xterm
xterm: Xt error: Can't open display: /private/tmp/com.apple.launchd.Ds68znvOZ3/org.macosforge.xquartz:0
Comment 5 Jeremy Huddleston Sequoia 2016-05-28 21:35:48 UTC
Are you using HomeBrew? MacPorts? fink? 

What is the output of running this:
    which xterm
Comment 6 Jeremy Huddleston Sequoia 2016-05-28 21:36:39 UTC
Also, what is the output of:

    dwarfdump -u /usr/bin/ssh
Comment 7 Michel Rogers-Vallee 2016-09-19 02:50:58 UTC
I get this

which xterm
/opt/X11/bin/xterm

and 

dwarfdump -u /usr/bin/ssh
UUID: 831730CD-9991-361E-B70D-901725F1BE61 (x86_64) /usr/bin/ssh
Comment 8 Jeremy Huddleston Sequoia 2016-09-19 04:04:21 UTC
Ok, well that ssh is from Apple in 10.11.4, so it should be good.  The fact that you can't start an xterm locally is pretty much indicative that it's not ssh anyways.

What's the output of these commands:

ls -ld $DISPLAY
launchctl getenv DISPLAY
launchctl print gui/`id -u`/org.macosforge.xquartz.startx
Comment 9 Michel Rogers-Vallee 2016-09-19 13:21:43 UTC
Here are the output:
> ls -ld $DISPLAY
srw-rw-rw-  1 Shadow  wheel  0 Sep 19 09:07 /private/tmp/com.apple.launchd.7nOED0eNIw/org.macosforge.xquartz:0

> launchctl getenv DISPLAY
/private/tmp/com.apple.launchd.7nOED0eNIw/org.macosforge.xquartz:0

> launchctl print gui/`id -u`/org.macosforge.xquartz.startx
org.macosforge.xquartz.startx = {
	active count = 1
	path = /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
	state = running

	program = /opt/X11/lib/X11/xinit/launchd_startx
	arguments = {
		/opt/X11/lib/X11/xinit/launchd_startx
		/opt/X11/bin/startx
		--
		/opt/X11/bin/Xquartz
	}

	inherited environment = {
		PATH => /usr/local/Cellar/pyenv-virtualenv/20160716/shims /Users/Shadow/.pyenv/shims /Users/Shadow/.rbenv/shims /Users/Shadow/bin /Users/Shadow/.rbenv/shims /opt/X11/bin /usr/local/bin /usr/bin /bin /usr/local/sbin /usr/sbin /sbin . /Users/Shadow/hardent_tools/bin /Users/Shadow/Applications/fakeQuesta /usr/X11R6/bin /usr/X11/bin /Users/Shadow/go_workdir/bin
		DISPLAY => /private/tmp/com.apple.launchd.7nOED0eNIw/org.macosforge.xquartz:0
		SSH_AUTH_SOCK => /private/tmp/com.apple.launchd.GtseBCE6Hp/Listeners
		Apple_PubSub_Socket_Render => /private/tmp/com.apple.launchd.h8W1MU3r7e/Render
	}

	default environment = {
		PATH => /usr/bin:/bin:/usr/sbin:/sbin
	}

	environment = {
		XPC_SERVICE_NAME => org.macosforge.xquartz.startx
	}

	domain = com.apple.xpc.launchd.user.domain.501.100007.Aqua
	asid = 100007
	minimum runtime = 10
	exit timeout = 5
	runs = 8
	successive crashes = 0
	excessive crashing = 0
	pid = 13005
	immediate reason = ipc (socket)
	forks = 1
	execs = 1
	trampolined = 1
	started suspended = 0
	proxy started suspended = 0
	last terminating signal = Unknown signal: 58

	event triggers = {
	}

	endpoints = {
	}

	dynamic endpoints = {
	}

	pid-local endpoints = {
	}

	instance-specific endpoints = {
	}

	event channels = {
	}

	sockets = {
		"org.macosforge.xquartz:0" = {
			type = stream
			path = /private/tmp/com.apple.launchd.7nOED0eNIw/org.macosforge.xquartz:0
			secure key = DISPLAY
			owner uid = 501
			group id = 0

			sockets = {
				49 (bytes to read)
			}

			active = 1
			passive = 1
			bonjour = 0
			ipv4v6 = 0
		}
	}

	spawn type = daemon
	cpumon = default

	properties = {
		partial import = 0
		launchd bundle = 0
		xpc bundle = 0
		keepalive = 0
		runatload = 0
		dirty at shutdown = 0
		low priority i/o = 0
		low priority background i/o = 0
		legacy timer behavior = 0
		exception handler = 0
		multiple instances = 0
		supports transactions = 1
		supports pressured exit = 0
		enter kdp before kill = 0
		wait for debugger = 0
		app = 0
		system app = 0
		creates session = 0
		inetd-compatible = 0
		inetd listener = 0
		abandon process group = 0
		one-shot = 0
		requires reap = 0
		event monitor = 0
		penalty box = 0
		pended non-demand spawn = 0
		role account = 0
		launch only once = 0
		system support = 0
		app-like = 0
		inferred program = 1
		joins gui session = 0
		joins host session = 0
		parameterized sandbox = 0
		resolve program = 0
		abandon coalition = 0
		extension = 0
		nano allocator = 0
		no initgroups = 0
		start on fs mount = 0
		endpoints initialized = 1
		disallow all lookups = 0
		system service = 0
	}
}
Comment 10 Michel Rogers-Vallee 2016-11-25 21:33:44 UTC
Is there any changes on this front. The new version of Xquartz still has the same behaviour.
Comment 11 Jeremy Huddleston Sequoia 2016-11-26 01:38:21 UTC
Yes, you need to logout and then log back in after updating from 2.7.8 (or maybe it was 2.7.7).

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.