View previous topic :: View next topic |
Author |
Message |
jdbattin n00b
Joined: 27 May 2005 Posts: 3
|
Posted: Sun May 29, 2005 1:33 am Post subject: DISPLAY variable weirdness |
|
|
I recently changed my network configuration after getting a different wireless router. I can still get into X both as root and as a normal user. The problem occurs when I try to launch an X application from the command line as root.
Here's a session that I recorded when debugging this issue, while running X/KDE.
[quote]
script
Script started, file is typescript
/root> hostname
knobi
/root> dnsdomainname
velleitas.com
/root> echo $DISPLAY
:0.0
/root> xterm
/root> exit
exit
Script done, file is typescript
/root> echo $DISPLAY
root pts/10 May 27 04:0.0
/root> script
Script started, file is typescript
/root> echo $DISPLAY
:0.0
/root> xterm
/root> exit
exit
Script done, file is typescript
/root>
[/quote]
What I don't understand is how the DISPLAY variable is getting set to "root pts/10 May 27 04:0.0". Also, why does this error clear up if I'm running script. |
|
Back to top |
|
|
gentsquash l33t
Joined: 03 Nov 2004 Posts: 753 Location: Still a Gentoo beginner.
|
Posted: Sun May 29, 2005 2:13 am Post subject: |
|
|
In the section
Code: | /root> echo $DISPLAY
:0.0
/root> xterm
/root> exit
exit
Script done, file is typescript
/root> echo $DISPLAY
root pts/10 May 27 04:0.0
|
did the xterm run? If it did, what was the value of DISPLAY in that xterm?
Does the same "weirdness" happen if you run `konsole' rather than `xterm'?
================
What happens to DISPLAY if you run, then immediately exit,
`script' (i.e, withOUT having run `xterm')?
jdbattin wrote: | Also, why does this error clear up if I'm running script. |
Are you running the Bash shell?
I ask because I think that tcsh can have both a local and global
("environment") version of a variable, and the local masks the
global. I believe that `script' forks a subshell, which probably
takes its value of DISPLAY from the environment-value in the
invoking shell. _________________ Your thread resolved? Putting [SOLVED] in its title helps all Gentooers. (Button "edit" , first post)
Prof. Jonathan LF King, Mathematics dept., University of Florida |
|
Back to top |
|
|
jdbattin n00b
Joined: 27 May 2005 Posts: 3
|
Posted: Sun May 29, 2005 6:56 am Post subject: |
|
|
I've been periodically debugging this failure for several months. I first noticed that the xterm would work when run during the script program tonight.
1.) The xterm did run.
2.) Under the script shell, the DISPLAY variable is ":0.0".
3.) In previous sessions I've tried to set the DISPLAY variable to ":0.0", localhost:0.0, or the IP address without success.
4.) I am running the Bash shell.
5.) Konsole works when run during script but not before or after.
6.) The shell of script is /bin/bash
7.) I spawned a new shell by typing "bash" and get the same failures.
I have searched these forums several times for hints to solutions. This interaction with script is completely unexpected. I was simply using script to capture the steps I've gone through and was surprised when xterm actually worked.
Based upon your questions, I went back and retried some of my attempts to set the DISPLAY variable. Setting DISPLAY to ":0.0" works. So, I'm out of the woods and will be able to continue on, however I still would like to understand why DISPLAY is initially set to "[b]root pts/10 May 27 04:0.0[/b][/u]"!
Thanks. |
|
Back to top |
|
|
jdbattin n00b
Joined: 27 May 2005 Posts: 3
|
Posted: Tue May 31, 2005 4:18 am Post subject: [SOLVED] DISPLAY variable weirdness |
|
|
So call me stupid. I found the problem.
I use a simple shell scriptlet to set the DISPLAY variable on my HP-UX systems.
Code: |
export DISPLAY=`who am i | cut -d\( -f2 | sed s/\)// | cut -d: -f1`":0.0"
|
Unfortunately, this doesn't work under Linux and was causing the problem. I've commented this crap out and the DISPLAY is getting set correctly.
Thanks |
|
Back to top |
|
|
gentsquash l33t
Joined: 03 Nov 2004 Posts: 753 Location: Still a Gentoo beginner.
|
Posted: Thu Jun 02, 2005 9:11 pm Post subject: |
|
|
Good catch, jdbattin.
If you feel that your problem is [SOLVED],
would you consider marking it as such? (Only you can edit the
title of the first post in the thread.) _________________ Your thread resolved? Putting [SOLVED] in its title helps all Gentooers. (Button "edit" , first post)
Prof. Jonathan LF King, Mathematics dept., University of Florida |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|