LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-23-2009, 12:22 AM   #1
prushik
Member
 
Registered: Mar 2009
Location: Pennsylvania
Distribution: gentoo
Posts: 372

Rep: Reputation: 29
Connecting to an unknown X display/server


I have an armeb-linux box running Montavista linux. I spent weeks trying to build a cross compiler and finally succeeded. Then I spent another week trying to cross compile libX11, which I did successfully earlier today. Then I cross compiled and linked my simple test program using xlib. I moved it to the target armeb-linux box and executed it. Although the screen is not attached, I expected that X would still be running. but the output from my program was as follows:
Code:
Xlib: connection to "ubuntu:0.0" refused by server
Xlib: No protocol specified
The same code runs fine on my x86 ubuntu laptop.

What does this error mean? Is X not running? Is X using a different display? How do I find out? I can't seem to find any X log files.
The results of "ps -lA" are:
Code:
  F S   UID   PID  PPID  C PRI  NI ADDR SZ  WCHAN TTY          TIME CMD
100 S     0     1     0  0  68   0 -   324  5c0a8 ?        00:00:03 init
040 S     0     2     1  0  69   0 -     0  340b4 ?        00:00:00 keventd
040 S     0     3     0  0  79  19 -     0  2b1f4 ?        00:00:00 ksoftirqd_CP
040 S     0     4     0  0  69   0 -     0  42700 ?        00:00:00 kswapd
040 S     0     5     0  0  69   0 -     0  4f6d8 ?        00:00:00 bdflush
040 S     0     6     0  0  69   0 -     0  4f7f8 ?        00:00:00 kupdated
040 S     0     7     1  0  69   0 -     0  c6e8c ?        00:00:04 mtdblockd
040 S     0    28     1  0  75  10 -     0  a2bc0 ?        00:00:00 jffs2_gcd_mt
040 S     0    43     1  0  75  10 -     0  a2bc0 ?        00:00:00 jffs2_gcd_mt
040 S     0    53     1  0  75  10 -     0  a2bc0 ?        00:00:00 jffs2_gcd_mt
040 S     0    65     1  0  69   0 -   380  5c0a8 ?        00:00:00 syslogd
040 S     0    67     1  0  69   0 -   339  251ec ?        00:00:00 klogd
040 D     0   139     1  0  69   0 -     0  19e78 ?        00:00:00 ixp425_csr
040 D     0   142     1  0  69   0 -     0  19e78 ?        00:00:00 ixp425_eth i
040 S     0   152     1  0  69   0 -     0 8a5ae8 ?        00:00:00 ixp425_eth i
040 S     0   154     1  0  69   0 -   327  2ef0c ?        00:00:00 dhcpcd-bin
140 S     1   165     1  0  69   0 -   365  5c6b0 ?        00:00:00 portmap
000 S     0   183     1  0  69   0 -   573  2974c ?        00:00:00 startx
000 S     0   184     1  0  69   0 -   573  2974c ?        00:00:00 start_ctrliu
000 S     0   185     1  0  69   0 -   573  2974c ?        00:00:00 start_sip_cl
100 S     0   186   183  0  69   0 -   568  2974c ?        00:00:00 xinit
000 S     0   188   186  0  69  -1 -  3227  5c0a8 ?        00:00:05 Xvnc
000 S     0   189   184  0  69   0 -   351  5c0a8 ?        00:00:00 ctrliu
000 S     0   190     1  0  69   0 -   573  2974c ?        00:00:00 start_sip_pr
100 S 65534   193   190  0  69   0 -   406  5c0a8 ?        00:00:00 siproxd
140 S     0   201     1  0  69   0 -   426  5c0a8 ?        00:00:00 rpc.statd
040 S     0   205     1  0  69   0 -   467  5c0a8 ?        00:00:00 dhcpd
140 S     0   210     1  0  69   0 -   342  5c0a8 ?        00:00:00 inetd
140 S     0   213     1  0  69   0 -  1135  5c0a8 ?        00:00:00 ntpd
040 S     0   216     1  0  69   0 -   440  5c6b0 ?        00:00:00 rpc.nfsd
040 S     0   218   213  0  69   0 -  1135  5c6b0 ?        00:00:00 ntpd
040 S     0   219     1  0  69   0 -   446  5c6b0 ?        00:00:00 rpc.mountd
040 S     0   220   218  0  69   0 -  1135  2ef0c ?        00:00:00 ntpd
040 S     0   226     1  0  69   0 -   428  2ef0c ?        00:00:00 cron
100 S     0   228     1  0  69   0 -   386  b1d64 ?        00:00:00 getty
100 S     0   229   186  0  69   0 -   571  2974c ?        00:00:00 xinitrc
000 S     0   230   229  0  69   0 -  1460  5c6b0 ?        00:00:02 gui
000 S     0   233   210  0  70   0 -   401  5c0a8 ?        00:00:01 in.telnetd
100 S     0   234   233  0  70   0 -   621  2974c pts/0    00:00:00 bash
040 S     0   240     1  0  69   0 -     0 133e58 ?        00:00:00 rpciod
040 S     0   241     1  0  69   0 -     0 137654 ?        00:00:00 lockd
000 S     0   292   185  0  69   0 -   397  2ef0c ?        00:00:00 sleep
000 R     0   293   234 15  76   0 -   666      - pts/0    00:00:00 ps
xinit and startx are both there, so shouldn't I assume X is also?

How should I proceed?
 
Old 05-23-2009, 11:59 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

1. Let's assume your armeb-linux host is called "montavista", and let's assume you want to write GUI apps that run on it. Then you need to build an Xlib that will work with your toolchain, and you probably need Xlib shared libraries installed on "monavista". It sounds like you've successfully done all this.

2. Let's assume you want to run these GUI apps. As you're probably aware, you do *not* necessarily need X Windows running on "montavista". All you need is an X server *somewhere*: for example, your "ubuntu" host.

3. To do this, all you need to do is:
a) log in to "montavista"
b) export DISPLAY=ubuntu:0.0
c) <<run your app>>

4. But for this to succeed, "ubuntu" must be able to accept remote connections:
a) log in to "ubuntu"
b) xhost + (note: this *eliminates* X security. Do *not* do this unless you're on a local, completely trusted LAN)

5. Additionally, make sure "ubuntu's" X server was *not* started with "--nolisten" (which disallows any remote connections):
a) log in to "ubuntu"
b) ps -eaf|grep listen
<= Make sure ubuntu's X server was *not* started with "--nolisten"

'Hope that helps .. PSM
 
Old 05-24-2009, 11:53 PM   #3
prushik
Member
 
Registered: Mar 2009
Location: Pennsylvania
Distribution: gentoo
Posts: 372

Original Poster
Rep: Reputation: 29
Thank you. That was a very useful post.

1. Yes, I have done all that. It was no easy task, but I did manage to cross compile Xlib, X11R7 to be exact. Some people said it wasn't possible, but it isn't and I have done it. If anyone is interested in doing this as well, I would love to help.

2. I was aware, yes, but I didn't think to try connecting to my build machine's xserver. I may try it, but I believe I may not need to. After trying to run my compiled program on a different armeb-linux/montavista box which has the display module attached, I did not receive the connection refused error. Instead my program seg faulted. Im pretty sure I know why, Ill explain in a bit.

3. So Xlib uses an environment variable to determine which display to connect to? In the line: export DISPLAY=ubuntu:0.0, I assume "ubuntu" is a hostname? Can I substitute that for an IP address, like "export DISPLAY=14.14.14.1:0.0"? (Weird IP, I know, but 14 is my favorite number).

4. Thats very nice to know. I love being able to disable all security. I don't like it when my computer tells me I can't do something for security reasons. Thats for me to decide, not my computer.

5.
Code:
ubuntu:~$ ps -eaf|grep listen
105       3319  3240  0 May22 ?        00:00:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
prushik  17212 17180  0 00:52 pts/1    00:00:00 grep listen
So I should assume that it is listening, right?

Again, thank you for your reply it is very very helpful.
 
Old 05-25-2009, 12:04 AM   #4
prushik
Member
 
Registered: Mar 2009
Location: Pennsylvania
Distribution: gentoo
Posts: 372

Original Poster
Rep: Reputation: 29
So anyway. I think my program is seg faulting because I am using the libX11 libraries that are already install on the montavista box. Which is a horrible thing to do I know, I think they would work if my program was not compiled with X11 release 7 instead of the X11 release 6 libraries which are already on the target. I would install my cross compiled X11R7 libraries, but I'm working with flash memory here and I've only tried to reflash twice, and both times I bricked the target. The /usr directory is stored in a flash partition in a cramfs filesystem, so its read only, and its a big endian target, and cramfs is endian-specific. plus if I dont reinstall telnet or ssh or something I lose access to the target, I haven't succeeded in cross compiling any ssh servers yet. I'll keep working on it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No DISPLAY variable when connecting via SSH ciphyre Linux - General 3 09-12-2008 02:36 PM
Unknown PIN for directory server jnojr Red Hat 1 06-13-2008 03:01 PM
unknown server trouble Taelor Linux - Networking 3 04-12-2006 09:50 AM
DNS Server: UnKnown cccc Linux - Networking 5 03-11-2006 07:16 AM
Unknown IP in NIS server hardian_97 Linux - Security 5 07-31-2005 08:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration