Discussion:
wrong DISPLAY variable
(too old to reply)
Asif Iqbal
2010-12-07 18:33:40 UTC
Permalink
***@jp2 { ~ }$ ssh -Y hlr-brixuat-01.example.net.
Password:
Last login: Tue Dec 7 17:33:46 2010 from jp2.example.net
[***@hlr-brixuat-01 ~]$ xterm
_X11TransSocketINETConnect() can't get address for hostname:6000: Name
or service not known
xterm Xt error: Can't open display: hostname:0.0

[***@hlr-brixuat-01 ~]$ echo $DISPLAY
hostname:0.0

[***@hlr-brixuat-01 ~]$ env | grep DISPLAY
DISPLAY=hostname:0.0


[***@hlr-brixuat-01 ~]$ DISPLAY=:0.0 xterm
xterm Xt error: Can't open display: :0.0

so DISPLAY id is wrong.

[***@hlr-brixuat-01 ~]$ xauth list $DISPLAY
xauth: (argv):1: bad display name "hostname:0.0" in "list" command


so I run xauth list to guess the correct DISPLAY id

[***@hlr-brixuat-01 ~]$ xauth list
hlr-brixuat-01.ip.qwest.net/unix:10 MIT-MAGIC-COOKIE-1
6e28736cb0f1227240fb9cd0ee304ca8
hlr-brixuat-01.ip.qwest.net/unix:12 MIT-MAGIC-COOKIE-1
f67286cba96bf92053290c367af9c1c3
hlr-brixuat-01.ip.qwest.net/unix:11 MIT-MAGIC-COOKIE-1
6687e7e136b618bbddca53ee7a10cba7
hlr-brixuat-01.ip.qwest.net/unix:13 MIT-MAGIC-COOKIE-1
b8821e6e537c7c9803342f7aa04cea76

so lets pick DISPLAY id as 12.0

[***@hlr-brixuat-01 ~]$ DISPLAY=:12.0 xterm
X connection to localhost:12.0 broken (explicit kill or server shutdown).

looks like I picked the wrong DISPLAY id. lets pick the next one, which is 13.0

[***@hlr-brixuat-01 ~]$ DISPLAY=:13.0 xterm

Yes! this time it worked.

Why do I have to pick a DISPLAY id? shouldn't xterm pick the correct
DISPLAY id already?

I am running OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 on
Red Hat Enterprise Linux Server release 5.5 (Tikanga)

Any suggestion on fix is appreciated.
--
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
Asif Iqbal
2010-12-07 22:34:49 UTC
Permalink
Last login: Tue Dec  7 17:33:46 2010 from jp2.example.net
_X11TransSocketINETConnect() can't get address for hostname:6000: Name
or service not known
xterm Xt error: Can't open display: hostname:0.0
Most likely something in your shell startup scripts is (re)setting $DISPLAY
to the wrong value.  sshd will set display numbers of 10 and up (by default,
this can be changed in sshd_config via X11DisplayOffset).
Thanks a lot for the pointer. That is exactly what happened.

There was this line in the .bash_profile. Not sure how it got there.

DISPLAY=hostname:0.0; export DISPLAY

I commented it out. Now its all good. Thanks a lot again
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
   Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
--
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
Darren Tucker
2010-12-07 20:55:59 UTC
Permalink
Post by Asif Iqbal
Last login: Tue Dec 7 17:33:46 2010 from jp2.example.net
_X11TransSocketINETConnect() can't get address for hostname:6000: Name
or service not known
xterm Xt error: Can't open display: hostname:0.0
Most likely something in your shell startup scripts is (re)setting
$DISPLAY to the wrong value. sshd will set display numbers of 10 and up
(by default, this can be changed in sshd_config via X11DisplayOffset).
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
Continue reading on narkive:
Loading...