GearHack

: :

Add Comment | Related Links | TrackBack
Related Content

Troubleshooting: X connection to localhost:10.0 broken (explicit kill or server shutdown).

If you remote connect to UNIX from Windows, then it's likely you will bump into this error message at least once in your lifetime:

X connection to localhost:10.0 broken (explicit kill or server shutdown).

This error messages occurs when you try to execute an X Window graphics user interface software, but you haven't started the X Windows display software on your Windows machine.

The X Window display server that I prefer to use on Windows is Xming 6.9.0.31. It's available on SourceForge and it's low-maintenance. If you haven't gotten a X Window display server software, you might give it a try. After starting Xming, you should not have this problem again.

However, if this problem does occur when you have Xming running, it's probably because you did not enable X11 forwarding in PuTTY, or your ssh software.

Chieh Cheng
Sun, 07 Jun 2009 18:35:41 +0000

Checklist for using Xming through a tunneled Putty session.

Putty:
* In the Connection->SSH->X11 panel, set the Enable X11 forwarding checkbox.
* In the same panel, enter "localhost:0" as the X display location. This redirects forwarded X traffic to display number 0. Match the Xming Display number, set below.
* Generally, MIT-Magic-Cookie-1 (set by default) is the most common authentication protocol. This will be added/updated in your .Xauthority file after a successful login for each display (one per Putty session).

Xming:
* In the Select display settings panel, set the Display number to 0. The IP port number used is 6000 + this number, so anything other than 0 will affect the display number used by X clients.
* In the same panel, if you want to connect directly from the remote client to the Xming server (not through Putty's X Forwarding), you should probably check the No Access Control box or your connection will be refused.

Remote system:
* Verify your SSH configuration allows X11 forwarding. In OpenSSH, the .ssh/config file should contain the entry "ForwardX11 yes".
* Your DISPLAY environment variable will be set automatically by Putty upon successful login. This will be "localhost:10.0" for the first session when the remote system's SSH daemon X11DisplayOffset is set to 10 (default). This display number will correspond to a TCP port that is listening on 6000 + display number, e.g. 6010. Use the command "netstat -an | grep -i listen" to see the ports on a Unix/Linux/Solaris box.
* If you "su" or "sudo" to a different user after login, you must merge the .Xauthority entry for the display associated with your session into the .Xauthority file of the new user. The DISPLAY environment variable should be set and exported the same as for the login user, for convenience. Otherwise, the X applications you lanuch with the new user will not have the authority to connect to your X server.

Windows:
* For the "localhost" part of the X display location to be converted to the correct IP address, your hosts file (%SYSTEMROOT%\System32\drivers\etc\hosts) must contain the entry "127.0.0.1 localhost".
* IMPORTANT: If you are using Windows Vista, the hosts file does not contain this entry by default. Instead, there is a "::1 localhost", which is for IPv6 instead of IPv4. This causes the "X connection to localhost:10.0 broken (explicit kill or server shutdown)" error to appear when you try to launch an X client application.
* If you use a firewall, make sure that Putty SSH is allowed through it. If you can't establish a login session with Putty, X applications aren't going to work, either.

Ed Eaglehouse
Wed, 15 Jul 2009 19:22:24 +0000

Hey thanks..
This was very useful..

slapstick
Thu, 16 Jul 2009 06:18:26 +0000

Yah! Awesome list. That is going to come in handy.

Chieh Cheng
Fri, 17 Jul 2009 01:29:48 +0000

YAY! You saved me! Xming is definately the way to go. Cygwin didn't work on my computer.

LearningProgramming
Tue, 15 Sep 2009 03:18:06 +0000

Hi

"If you "su" or "sudo" to a different user after login, you must merge the .Xauthority entry for the display associated with your session into the .Xauthority file of the new user. The DISPLAY environment variable should be set and exported the same as for the login user, for convenience. Otherwise, the X applications you lanuch with the new user will not have the authority to connect to your X server."

I wish I'd read this article ahead of me shafting my X connection settings

I did a su to another user after login and that then trashed my X connection and now I can't get an X session anymore

I just now get: "connection to localhost:10.0 broken (explicit kill or server shutdown)"

Can you give the exact steps for merging the .Xauthority entry please

My target server is a Solaris 9 box

Oh, and great write up!

CheekyMonkey
Wed, 16 Sep 2009 21:03:50 +0000

good information!! was very helpful. thank you.

Sharath
Tue, 03 Nov 2009 16:32:43 +0000

Hi Chieh,

I've followed your suggestions step by step, however I'm still getting the same error message of explicit kill or server shutdown. X11 forwarding is activated, Xming is launched, Display location = localhost:0, 127.0.0.1 localhost on my host file, and still I cannot get rid of the same error message. Do you have any idea why it still shows up and any other way to sidestep this problem? Thanks a million.

Miguel E. Perez
Wed, 18 Nov 2009 09:17:01 +0000

Just want to thank you for the write up, since it fixed my issue. Also, remember to remove or comment out the "::1". Otherwise, you will get the same error message. To test to see if you have the correct localhost definition run a ping localhost from the command prompt. It should give you the 127.0.0.1
;

George
Wed, 17 Mar 2010 01:23:48 +0000

This is the quick setup guide that I needed!
Many thanks.

mgpmul
Thu, 29 Apr 2010 10:05:58 +0000

If you "su" or "sudo" to a different user after login, you must merge the .Xauthority entry .. No idea how to do this...

mo
Fri, 28 May 2010 03:47:31 +0000

I was getting the error "X connection to localhost:10.0 broken" when trying to run xclock on my remote linux box connected through putty. I did had Xming already running on my windows PC, but in Putty, I had to set Enable X11 forwarding checkbox and set it to "localhost:0". I was setting it to my local IP which doesn't work.

Also I verified $xuath list and it gave the correct cookie as below both for user and root.
==========
Putty:
* In the Connection->SSH->X11 panel, set the Enable X11 forwarding checkbox.
* In the same panel, enter "localhost:0" as the X display location. This redirects forwarded X traffic to display number 0. Match the Xming Display number, set below.
* Generally, MIT-Magic-Cookie-1 (set by default) is the most common authentication protocol. This will be added/updated in your .Xauthority file after a successful login for each display (one per Putty session
======

Arun Sethi
Tue, 06 Jul 2010 19:19:41 +0000

Thank you very much. The suggestion solved my problem. And also gave me a reason.
My case is:
I use "ssh -Y" from cygwin to connect to my FC13 Linux.
And on FC13, there runs a chroot environment, in which, I want to start Xehpyr.
It seems in the chroot environment, the .Xauthority doesn't generated automatically, so I need to merge my ssh .Xauthority into the chroot environment manually. I did it like this:
1. On windows, start cygwin
2. In cygwin: $ ssh -Y [email protected]
3. After login FC13 by ssh, $ cp ~/.Xauthority to/the/chroot/user/home/path
4. chroot into my SDK, now, I can start $ Xephyr :2

Sylvia.J Liu
Wed, 28 Jul 2010 07:53:43 +0000

Great writeup. If you happen to running under Solaris 8, 9 OR 10, you
might have problems getting the X port forwarded properly due to a legacy socfs bug. If you do, you will see errors like this in the syslog:

[ID 800047 auth.error] error: Failed to allocate internet-domain X11 display socket.

Be sure to have the following set in /usr/local/etc/sshd_config:

ListenAddress 0.0.0.0

And also make sure you are loading up sshd with a -4 arg to force IPv4 connections.

/usr/local/sbin/sshd -4

You can confirm that the forward worked by checking the socket tables for someone listening on port 6010:

127.0.0.1.6010 *.* 0 0 49152 0 LISTEN

That worked great for me.
JP

Joshua Pincus
Sun, 08 Aug 2010 20:40:18 +0000

Thanx a ton Xming was the missing piece of the puzzle i have been getting this to work for almost 6 days. than you once again

shash
Sat, 26 Mar 2011 14:58:21 +0000

Thanx!
Your instructions are very useful

from RUSSIA
Tue, 26 Jul 2011 10:09:42 +0000

You can check your comms path i.e. your port-forwarded tunnel with tcpdump, e.g.

Use two ssh sessions and become root on the first.
Make sure at least one of them is configured for X11 forwarding.

On the first session start tcpdump and filter for x11-ssh-offset traffic.

[root@somehost ~]# tcpdump -i lo port 6010
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 96 bytes
[root@somehost ~]#

On your second session start an X app.
[user@somehost ~]$ xclock &

If tcpdump in your root session spews out messages like below then your port-forwarded comms path is working ok.


16:23:04.948257 IP localhost.localdomain.54363 > localhost.localdomain.x11-ssh-offset: S 2488089048:2488089048(0) win 32792
16:23:04.948595 IP localhost.localdomain.x11-ssh-offset > localhost.localdomain.54363: S 2484370399:2484370399(0) ack 2488089049 win 32768
16:23:04.948266 IP localhost.localdomain.54363 > localhost.localdomain.x11-ssh-offset: . ack 1 win 257
16:23:04.948580 IP localhost.localdomain.54363 > localhost.localdomain.x11-ssh-offset: P 1:49(48) ack 1 win 257
16:23:04.948607 IP localhost.localdomain.x11-ssh-offset > localhost.localdomain.54363: . ack 49 win 256
16:23:05.907929 IP localhost.localdomain.x11-ssh-offset > localhost.localdomain.54363: F 1:1(0) ack 49 win 256
16:23:05.908589 IP localhost.localdomain.54363 > localhost.localdomain.x11-ssh-offset: F 49:49(0) ack 2 win 257
16:23:05.908613 IP localhost.localdomain.x11-ssh-offset > localhost.localdomain.54363: . ack 50 win 256

If you still see the dreaded "X connection to localhost:10.0 broken (explicit kill or server shutdown)" in the session you tried to run xclock in then you probably have an xauth problem.
Try deleting your ~/.Xauthority file and logging in again to recreate it.
You should see a message like this when it's recreated.

/usr/bin/xauth: creating new authority file /home//.Xauthority

Then try to run xclock again.

Bruce from Oz
Thu, 22 Sep 2011 07:31:41 +0000

It worked. Very useful tips. Thanks a lot

chris USA
Tue, 04 Sep 2012 22:44:34 +0400

I got this error message because of the opposite problem.

I started my putty session with the check mark on, and was using X during my session.
I started a background process up, expecting it to stay running after I logged out ( nohup command > logfile 2> errorfile & )

Every time I logged out the process would crash with the "X connection to localhost:10.0 broken " error message.

Turning the "Connection > SSH > X11 > Enable X11 forwarding" check box *OFF* allowed me to connect and start my process without shutting it down when I logged off.

jAHOLMES
Sat, 20 Jul 2013 01:33:44 +0400

Here is a KSH program I wrote to help with the problem of when you change to a different user account and still want to get X-gui stuff to work.

EG: you log in and ==> su - root
And you want to run an xlogo.. ( will not work )

After, (you perform a su to whatever) that happens, the SSH keys will not match. This script will provide the SSH key information for you before hand..
So, just run the script, copy the output to a notepad and paste them back after you do an su.
Your X-gui things will work again. (enjoy)

code below.

####################################

cat display_ssh_connection_variables.ksh

#!/usr/bin/ksh

#

DIsplay_VAR_num=0

DIsplay_VAR=`echo $DISPLAY`
DIsplay_VAR_num=`echo $DISPLAY | awk -F: '{print $2}' | awk -F. '{print $1}'`
CON_VAR=`echo $SSH_CONNECTION`
CLI_VAR=`echo $SSH_CLIENT`

/usr/lpp/X11/bin/xauth list | while read line
do
THIS_DISPLAY=`echo $line | awk '{print $1}' | awk -F: '{print $2}'`
if [ $DIsplay_VAR_num = $THIS_DISPLAY ]
then
AUTH_VAR=`echo $line`
#
AUTH_1=`echo ${AUTH_VAR} | awk '{print $1}'`
AUTH_2=`echo ${AUTH_VAR} | awk '{print $3}'`
#
echo " "
echo "export DISPLAY=$DISPLAY"
echo "export SSH_CONNECTION='$SSH_CONNECTION'"
echo "export SSH_CLIENT='$SSH_CLIENT'"
echo "/usr/lpp/X11/bin/xauth add ${AUTH_1} . ${AUTH_2}"
fi
done

Graeme
Fri, 28 Aug 2015 09:09:10 +0400

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.

TrackBack

TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.

Send Ping | TrackBack URL | Spam Control

Title: Gracefully Handle XOpenDisplay Errors
Weblog: Cynosure.X International
Excerpt: All you say is crystal clear, thanks. In fact, I get into this error when calling the XOpenDisplay function from within an application running on a remote Unix machine (connected to using PuTTY with X forwarding enabled), when there is not any Xserver (e.g. XMing) running on the local machine. . . .
Tracked: Wed, 30 Dec 2009 09:20:39 +0000

Add Comment

Spam Control | * indicates required field
Your Name: *
E-mail:
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 10 + 9?
Click button only once, please!

Messages, files, and images copyright by respective owners.


Articles | Wiki
Forums | Latest | RSS
Library | Links | News
Search | Store | Help

203 Users Online

Hacking Digital Cameras
Fun for Photographers


Get Our

Memecoins!



Hacking Digital Cameras
Fun for Photographers

Amazon Associate




Copyright © 2004 - 2024. All Rights Reserved.