2009-03-19

PuTTY X11 forwarding stopped working on Vista

At work my primary desktop system is running Windows Vista Business 64 and our servers are all Debian. Almost daily I access these servers using ssh via the awesome PuTTY (0.60) program. When I want some graphical display returned, like a gvim, pgadmin3 or etherape, I fire up Cygwin/X and use it as my local X server. Once configured this has been working flawlessly for years on MS XP and Vista the past several months.

Yesterday when I tried firing up etherape to track down some network usage, I got the discouraging message "X connection to localhost:10.0 broken (explicit kill or server shutdown)." I followed some basic ssh and X forwarding troubleshooting steps and everything checked out. Finally I found and installed iftop which was everything I wanted ntop to be and did a good enough job.

Today I tackled the issue and found that a Cygwin/X xterm would properly bring the xclient home to my desktop, so the issue was not the servers (which had not had any software changes in the previous few days) it must be the software running on Windows.

I looked at the PuTTY > Connection > SSH > X11 settings and noticed the X display location was blank. I thought this might be akin to the $DISPLAY variable so I checked the help file. It said that if the field was blank PuTTY tried to use :0. Sounded reasonable, but I decided to test it anyway. The xterm had said $DISPLAY was 127.0.0.1:0.0 so, prefering names over numbers, I tried localhost:0.0. No dice. I then tried 127.0.0.1:0.0 and was rewarded with xclock and friends from the remote system.

A little googling lead me to a bug report from 2004 about possibly needing to specify the X display location. I don't think my issue was the same. The note claims that using localhost:0 on MS Windows should work, and it does not for me. I believe that some recent Windows Vista update or setting change (I have not changed networking settings for months) has broken localhost:0, but somehow using the ip address instead of the name works from PuTTY. It doesn't matter if I use the number or the name in a local Cygwin xterm.

Next I pulled up the trusty cmd.exe and tried ping localhost. This showed me that localhost resolves to the IPv6 address ::1. Perhaps this has changed recently due to a Windows update or some setting change I don't remember? I don't know if the root issue is Cygwin/X server not listening on IPv6 addresses (perhaps my version isn't even capable) or if the IPv6 syntax doesn't play nice with the final :0. I did try setting the display to ::1:0 in the xterm and that didn't work. It said "_X11TransSocketINETConnect: Can't get address for :: Error: Can't open display: ::1:0".

For now I'm going with updating all my PuTTY session configs to use 127.0.0.1:0.0

3 comments:

Unknown said...

A co-worker complained of the same problem today, reducing the likely hood that it was a configuration we both changed. I suppose it could be that both of our systems picked up the same network change, but I am not aware of one.

Unknown said...

Verified that the problem also happens with the development snapshot 2009-03-19:r8492

Unknown said...

Windows Defender the likely culprit. Adding "127.0.0.1 localhost" back to the hosts file fixes the problem.