LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-02-2007, 05:54 AM   #1
Enselic
LQ Newbie
 
Registered: Feb 2007
Posts: 8

Rep: Reputation: 0
Why does simple secondary X-server script only work on tty[1-6], not tty7?


Hello,

My script looks like this:
Code:
#!/bin/bash
X :1 vt8 &
export DISPLAY=:1
sleep 5
metacity &
gimp &
xterm &
When I try to run it from a console emulator under X, the X server will start, but metacity and friends will not find the X server.

However, when I run it from a real console, it will work fine!

I see no logic in this, does anyone else?

(I have changed /etc/Xwrapper.config, so anybody is allowed to start the server)
 
Old 03-02-2007, 07:38 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
I tried your script only with xterm and it works (debian sid). Useless for you I know

Quote:
but metacity and friends will not find the X server.
So you get an error message from the starting shell?

What happens if you remove vt8 ?

And with this:
Code:
xinit /usr/bin/xterm -- :1 vt8
?
 
Old 03-02-2007, 10:33 AM   #3
Enselic
LQ Newbie
 
Registered: Feb 2007
Posts: 8

Original Poster
Rep: Reputation: 0
This is what I get with my script:

Code:
martin@martin-laptop:~$ cat bin/gimpdebug
#!/bin/bash
sleep 1
X :1 &
export DISPLAY=:1
sleep 5
metacity &
gimp &
xterm &
martin@martin-laptop:~$ gimpdebug 

X Window System Version 7.1.1
Release Date: 12 May 2006
X Protocol Version 11, Revision 0, Release 7.1.1
Build Operating System: Linux 2.6.15.7 i686 
Current Operating System: Linux martin-laptop 2.6.17-11-generic #2 SMP Thu Feb 1 19:52:28 UTC 2007 i686
Build Date: 07 July 2006
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Fri Mar  2 17:29:24 2007
(==) Using config file: "/etc/X11/xorg.conf"
(WW) I810: No matching Device section for instance (BusID PCI:0:2:1) found
(EE) I810(0): [dri] DRIScreenInit failed. Disabling DRI.
(EE) AIGLX: Screen 0 is not DRI capable
error opening security policy file /usr/lib/xserver/SecurityPolicy
    xkb_keycodes             { include "xfree86+aliases(qwerty)" };
    xkb_types                { include "complete" };
    xkb_compatibility        { include "complete" };
    xkb_symbols              { include "pc(pc105)+us+level3(ralt_switch)" };
    xkb_geometry             { include "pc(pc105)" };
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Type "ONE_LEVEL" has 1 levels, but <RALT> has 2 symbols
>                   Ignoring extra symbols
Errors from xkbcomp are not fatal to the X server
Synaptics DeviceInit called
SynapticsCtrl called.
Synaptics DeviceOn called
Could not init font path element /usr/share/fonts/X11/TTF/, removing from list!
Could not init font path element /usr/share/fonts/X11/OTF, removing from list!
Could not init font path element /usr/share/fonts/X11/CID/, removing from list!
AUDIT: Fri Mar  2 17:29:29 2007: 25774 X: client 1 rejected from local host
Xlib: connection to ":1.0" refused by server
Xlib: No protocol specified

xterm Xt error: Can't open display: :1
martin@martin-laptop:~$ AUDIT: Fri Mar  2 17:29:29 2007: 25774 X: client 1 rejected from local host
Xlib: connection to ":1.0" refused by server
Xlib: No protocol specified

Fönsterhanterarfel: Unable to open X display :1
AUDIT: Fri Mar  2 17:29:29 2007: 25774 X: client 1 rejected from local host
Xlib: connection to ":1.0" refused by server
Xlib: No protocol specified

cannot open display: 
Synaptics DeviceOff called
FreeFontPath: FPE "/usr/share/fonts/X11/misc" refcount is 2, should be 1; fixing.
This is what I get with xinit /usr/bin/xterm -- :1 vt8:

Code:
martin@martin-laptop:~$ sleep 1 && xinit /usr/bin/xterm -- :1 vt8

X Window System Version 7.1.1
Release Date: 12 May 2006
X Protocol Version 11, Revision 0, Release 7.1.1
Build Operating System: Linux 2.6.15.7 i686 
Current Operating System: Linux martin-laptop 2.6.17-11-generic #2 SMP Thu Feb 1 19:52:28 UTC 2007 i686
Build Date: 07 July 2006
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Fri Mar  2 17:32:24 2007
(==) Using config file: "/etc/X11/xorg.conf"

(WW) I810: No matching Device section for instance (BusID PCI:0:2:1) found
(EE) I810(0): [dri] DRIScreenInit failed. Disabling DRI.
(EE) AIGLX: Screen 0 is not DRI capable
error opening security policy file /usr/lib/xserver/SecurityPolicy
    xkb_keycodes             { include "xfree86+aliases(qwerty)" };
    xkb_types                { include "complete" };
    xkb_compatibility        { include "complete" };
    xkb_symbols              { include "pc(pc105)+us+level3(ralt_switch)" };
    xkb_geometry             { include "pc(pc105)" };
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Type "ONE_LEVEL" has 1 levels, but <RALT> has 2 symbols
>                   Ignoring extra symbols
Errors from xkbcomp are not fatal to the X server
Synaptics DeviceInit called
SynapticsCtrl called.
Synaptics DeviceOn called
Could not init font path element /usr/share/fonts/X11/TTF/, removing from list!
Could not init font path element /usr/share/fonts/X11/OTF, removing from list!
Could not init font path element /usr/share/fonts/X11/CID/, removing from list!
AUDIT: Fri Mar  2 17:32:27 2007: 25973 X: client 1 rejected from local host
Xlib: connection to ":1.0" refused by server
Xlib: No protocol specified


waiting for X server to begin accepting connections .
AUDIT: Fri Mar  2 17:32:29 2007: 25973 X: client 1 rejected from local host
Xlib: connection to ":1.0" refused by server
Xlib: No protocol specified

..
AUDIT: Fri Mar  2 17:32:31 2007: 25973 X: client 1 rejected from local host
Xlib: connection to ":1.0" refused by server
Xlib: No protocol specified

..Synaptics DeviceOff called
FreeFontPath: FPE "/usr/share/fonts/X11/misc" refcount is 2, should be 1; fixing.

giving up.
xinit:  Connection refused (errno 111):  unable to connect to X server
xinit:  No such process (errno 3):  Server error.
(Prefixed with sleep to prevent <RETURN> from getting "stuck")

Neither work :/
 
Old 03-02-2007, 11:32 AM   #4
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Random ideas (sorry I don't have better..)

1)Did you try to run the script as root?

2)As another user that has started :0 ?

3)You could replace xterm by xterm -display :1 eventhough I don't see why it would work better?

You could try running
4)xinit /usr/bin/xterm -- :1 vt8 -ac
This will disable the security mechanism of X. I'm wondering if it's a X security problem.

5) ls -la /dev/tty[0-9]

That's what I get with xinit:

Quote:
_XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
_XSERVTransOpen: transport open failed for inet6/debian:1
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6

X Window System Version 7.1.1
Release Date: 12 May 2006
X Protocol Version 11, Revision 0, Release 7.1.1
Build Operating System: UNKNOWN
Current Operating System: Linux debian 2.6.20.1+antio+nopreempt+1000 #1 Sun Feb 25 18:55:55 CET 2007 i686
Build Date: 01 March 2007
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Fri Mar 2 18:21:02 2007
(==) Using config file: "/etc/X11/xorg.conf"
(EE) Failed to load module "synaptics" (module does not exist, 0)
(EE) I810(0): [dri] DRIScreenInit failed. Disabling DRI.
(EE) AIGLX: Screen 0 is not DRI capable
(EE) No Input driver matching `synaptics'
xkb_keycodes { include "xfree86+aliases(azerty)" };
xkb_types { include "complete" };
xkb_compatibility { include "complete" };
xkb_symbols { include "pc(pc105)+fr(oss)" };
xkb_geometry { include "pc(pc105)" };
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning: Type "ONE_LEVEL" has 1 levels, but <RALT> has 2 symbols
> Ignoring extra symbols
Errors from xkbcomp are not fatal to the X server

Last edited by nx5000; 03-02-2007 at 11:35 AM.
 
Old 03-02-2007, 01:44 PM   #5
Enselic
LQ Newbie
 
Registered: Feb 2007
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by nx5000
Random ideas (sorry I don't have better..)

1)Did you try to run the script as root?
Nope, and I should not have to (since it runs fine in a normal terminal)

Quote:
2)As another user that has started :0 ?
The initial X session is started at boot time (I use Ubuntu), so no.

Quote:
3)You could replace xterm by xterm -display :1 eventhough I don't see why it would work better?
Same shit

Quote:
You could try running
4)xinit /usr/bin/xterm -- :1 vt8 -ac
This will disable the security mechanism of X. I'm wondering if it's a X security problem.
Hey, great idea

It worked!!! So it's a security problem then.

*tries to run as root*

Hmm, same errors as root.

Quote:
5) ls -la /dev/tty[0-9]
Sure, but I don't follow why?

Results
Code:
martin@martin-laptop:~$ ls -la /dev/tty[0-9]
crw-rw---- 1 root   root 4, 0 2007-03-02 11:44 /dev/tty0
crw------- 1 martin tty  4, 1 2007-03-02 14:46 /dev/tty1
crw------- 1 root   root 4, 2 2007-03-02 11:45 /dev/tty2
crw------- 1 root   root 4, 3 2007-03-02 11:45 /dev/tty3
crw------- 1 root   root 4, 4 2007-03-02 11:45 /dev/tty4
crw------- 1 root   root 4, 5 2007-03-02 11:45 /dev/tty5
crw------- 1 root   root 4, 6 2007-03-02 11:45 /dev/tty6
crw-rw---- 1 root   root 4, 7 2007-03-02 11:44 /dev/tty7
crw-rw---- 1 root   root 4, 8 2007-03-02 11:45 /dev/tty8
crw-rw---- 1 root   root 4, 9 2007-03-02 11:44 /dev/tty9

Ok, but X security, I guess I could read up on this, but before I do, do you happen to know how to fix this?

Thank you for your time so far!
 
Old 03-05-2007, 02:17 PM   #6
Enselic
LQ Newbie
 
Registered: Feb 2007
Posts: 8

Original Poster
Rep: Reputation: 0
The solution was to specify an X authority files and use xauth add :1 . `mcookie` on that file, and setting the XAUTHORITY env var to that file. The X Server only allows programs that have the right MCOOKIE to connect, and the programs get that magic cookie by looking in the provided X authority file.
 
Old 03-06-2007, 05:20 AM   #7
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Yeah that was my idea here:
Quote:
2)As another user that has started :0 ?

The initial X session is started at boot time (I use Ubuntu), so no.
So that there is a user per Xserver and thus a seperate XAUTHORITY (~user1/.Xauthority and ~user2/.Xauthority)

Still I don't understand why the user that launches the Xserver is not allowed to connect to it...
And XAUTHORITY is automatically so there shouldn't be anything to do. There would just be a cookie per server.
And that you have to do this only for vt8 only also makes me wonder..

Humm
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple script won't work compused Linux - Newbie 4 11-22-2006 06:52 AM
linux server as a secondary server in windows envoirement tulip4heaven Linux - Networking 1 03-28-2006 04:34 PM
newbie, getting simple python script to work Monjawi Programming 6 10-03-2005 11:51 AM
X: can't switch from tty7 to ttyx to tty7 again: blank screen DaneM Slackware 11 08-26-2005 08:36 AM
Why doesnt my simple html post to cgi script work? ginda Linux - Networking 10 03-15-2005 03:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:33 AM.

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