Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display redirect question

Status
Not open for further replies.

f0rmat

IS-IT--Management
Jun 2, 2004
102
US
This is kind of a weird scenerio so here goes...

We're in a development environment, and we need to(from a cron job, or command line(ssh session) be able to start a gui test, that will display output, locally via cron, or rlogin(ssh) whatever..

the issue is, if we allow all xhost connections, login, start the test, it complains that it cant output the display to localhost.. if I start an xserver(exceed) on my laptop, output the display there, itll work.

Thoughts
 
Yep, sorry about the vague post, threw it up in a rush.

One of our engineers is testing one of our products on a build machine and apparently since it's a gui test.. it needs to be able to display locally to the machine. Only problem is, this build machine(from now on called sketty) is in the US, and the engineer is in canada.

What needs to be done is, he needs to be able to log into the machine as a build account(login = buildacct) and become root, then create a cronjob to kick off this test(most likely some perl script that calls a bunch of other stuff) This machine(sketty) is a headless unit, and it's erroring out when it's trying to draw windows etc from within the test. It also errors out if you run xclock

-bash-3.00$ export DISPLAY=localhost:0.0
-bash-3.00$ xclock
Error: Can't open display: localhost:0.0
-bash-3.00$

The error above is what he's getting(even after doing the redirect steps and doing xhost + )

however, if he(or anyone) runs exceed(or some other xserve) locally on their machines, and exports the display there(export DISPLAY=avernus(my machine):0.0) and run xclock(or any gui command) itll work.

The only problem is, the display HAS to get redirected locally(but be able to get called remotely(via cron or ssh) because it is a very intensive gui test and the latency with the redirect(especially over the wan) will kill the perf data.

Make more sense what I'm trying to accomplish :) Sorry for the lack of detail before

 
Have you tried 'ssh -X' (xforwarding through ssh) so that the GUI output will be on his monitor instead of the sketty's displite sketty running the program? Then no export or xhost should be needed, as long as sketty has a X server running locally and he's connecting from a machine that understands X11 (read: cygwin's X11, another Linux box, and X11 for OSX).

If Sketty is headless, why us it running GUI apps on it?


[plug=shameless]
[/plug]
 
It sounds as if you do not have an Xserver running on your "headless" machine. Makes perfect sense, but you would not be able to run your test without it. Post the output of "lsof -i" or "netstat -na" to see if you are actually running an Xserver.

I would suggest that you do something more like installing the Xserver (so you can run Xclients like xclock) and having the developer use VNC to run their GUI test. At that point you can use "xhost +localhost" to allow the cron job to open a connection to the Xserver. You never want to use "xhost +" because that opens the Xserver to connections from anyone in the world. Theoretically VNC would not slow GUI repaints, and would give the Xclients a DISPLAY to which they can attach.


pansophic
 
Pasted below is the output from lsof -i. The output from netstat -na was massive.. so I don't want to post that unless necesarry.
I also posted the output of rpm -qa | grep X to see if Xserver was installed, and it looks like(silly me) it may not be.. can someone confirm if this is correct? If it was correct, wouldn't that mean that I shouldn't have been able to redirect the output to my local workstation??
[root@sharesrv2 dmurphy]# lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
portmap 2235 rpc 3u IPv4 5457 UDP *:sunrpc
portmap 2235 rpc 4u IPv4 5458 TCP *:sunrpc (LISTEN)
rpc.statd 2255 rpcuser 4u IPv4 5498 UDP *:32769
rpc.statd 2255 rpcuser 5u IPv4 5486 UDP *:735
rpc.statd 2255 rpcuser 6u IPv4 5501 TCP *:32769 (LISTEN)
ypbind 2333 root 4u IPv4 5698 UDP *:817
ypbind 2333 root 5u IPv4 5703 TCP *:820 (LISTEN)
ypbind 2333 root 6u IPv4 9132349 UDP *:915
sshd 2511 root 3u IPv6 5968 TCP *:ssh (LISTEN)
xinetd 2526 root 5u IPv4 6377 TCP *:exec (LISTEN)
xinetd 2526 root 6u IPv4 6378 TCP *:login (LISTEN)
xinetd 2526 root 8u IPv4 6379 TCP *:shell (LISTEN)
xinetd 2526 root 9u IPv4 6380 TCP *:telnet (LISTEN)
xinetd 2526 root 10u IPv4 6381 TCP *:vmware-authd (LISTEN)
ntpd 2542 ntp 4u IPv4 6049 UDP *:ntp
ntpd 2542 ntp 5u IPv6 6089 UDP *:ntp
ntpd 2542 ntp 6u IPv4 6104 UDP localhost.localdomain:ntp
ntpd 2542 ntp 7u IPv4 6157 UDP sharesrv2.boston.amer.iona.com:ntp
rpc.rquot 2556 root 3u IPv4 6074 UDP *:629
rpc.rquot 2556 root 4u IPv4 6097 TCP *:649 (LISTEN)
rpc.mount 2578 root 6u IPv4 6165 UDP *:647
rpc.mount 2578 root 7u IPv4 6180 TCP *:662 (LISTEN)
amd 2605 root 4u IPv4 6382 UDP *:1023
amd 2605 root 5u IPv4 6383 TCP *:663 (LISTEN)
amd 2605 root 6u IPv4 6384 UDP *:664
amd 2605 root 7u IPv4 6385 UDP *:1022
cupsd 13621 root 0u IPv4 8696534 TCP localhost.localdomain:ipp (LISTEN)
cupsd 13621 root 2u IPv4 8696535 UDP *:ipp
sendmail 27210 root 4u IPv4 7255890 TCP localhost.localdomain:smtp (LISTEN)
in.telnet 31383 root 0u IPv4 9132383 TCP sharesrv2.boston.amer.iona.com:telnet->meepo.boston.amer.iona.com:50950 (ESTABLISHED)
in.telnet 31383 root 1u IPv4 9132383 TCP sharesrv2.boston.amer.iona.com:telnet->meepo.boston.amer.iona.com:50950 (ESTABLISHED)
in.telnet 31383 root 2u IPv4 9132383 TCP sharesrv2.boston.amer.iona.com:telnet->meepo.boston.amer.iona.com:50950 (ESTABLISHED)
[root@sharesrv2 dmurphy]#

[root@sharesrv2 dmurphy]# rpm -qa | grep X
PyXML-0.8.3-6
perl-XML-Grove-0.46alpha-27
perl-XML-Twig-3.13-6
perl-XML-Dumper-0.71-2
Xaw3d-devel-1.5-24
perl-XML-Encoding-1.01-26
Xaw3d-1.5-24
perl-XML-LibXML-Common-0.13-7
perl-XML-Parser-2.34-5
Xaw3d-1.5-24
perl-XML-SAX-0.12-7
perl-XML-LibXML-1.58-1
perl-XML-NamespaceSupport-1.08-6
[root@sharesrv2 dmurphy]#
 
Xservers normally open port 6000, which doesn't appear to be open. I can't recall whether the Xserver is Xserver or xserver in the RPM, but I would suspect that it was not even installed. You could verify by typing "startx" and seeing if the script even exists.

After you install the Xserver, you'd need to have it running by default, which means runlevel 5 (you should be at 3 currently).


pansophic
 
Xserver is installed.

[root@sharesrv2 dmurphy]# startx


Fatal server error:
Server is already active for display 0
If this server is no longer running, remove /tmp/.X0-lock
and start again.


Please consult the The X.Org Foundation support
at for help.
 
If the xserver is installed and running, then ssh -X should work, given that you want the person running the application to be able to see the GUI.

This offers three advantages over connecting to the xserver directly:
1. No hard configurations need to be made.
2. Secure and encrypted, where as the X protocols are not.
3. No need to open extra ports.

SSH supports tunneling the X connection through the ssh port, so no playing with export, xhost or VNC. For the record, VNC is more insecure than ssh with X forwarding. And the rsh family (rlogin, rsh, et al.) are also unencrypted by default where SSH uses SSL (which uses RSA in both directions).

After you install the Xserver, you'd need to have it running by default, which means runlevel 5 (you should be at 3 currently).
Most runlevels are actually arbitrary. I can set X not to start until runlevel 7 or any runlevel I want. Typically it is 5, but that isn't forced to always be the case. some live distros have only 2 runlevels one graphical one not, and RHEL has X starting in at runlevel 7.

[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top