DISPLAY is not exported, sometimes

Mikkel L. Ellertson mellertson at gmail.com
Sat Jul 23 19:31:57 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/23/2011 02:17 PM, David A. De Graaf wrote:
> Since doing fresh installs of Fedora 15 on two computers, I've found
> that the DISPLAY environment variable is not exported in some cases,
> despite being declared "exported".
> 
> This seems to be a clear violation of the EXPORT rules in /bin/bash.
> It is a severe handicap in a root window, since most of the GUI
> commands in the system-config-* group will not run.
> 
> The problem initially arose with the command
>     /usr/bin/xterm -e /bin/su -
> which opens a new root window, prompting for the passwd. 
> I found that system-config-network failed to open the customary GUI panel,
> but reverted to a semi-useless curses-based substitute.  This was quickly
> traced to a missing DISPLAY definition in the root xterm.
> 
> However, this error occurs on only one of two laptops.  Although the
> hardware is different - an IBM T30 vs an ASUS N10 - the packages
> installed differ only in that nvidia drives are installed on the ASUS.
> Both laptops usually run XFCE4;  the DISPLAY error occurs only on the
> IBM T30.
> 
> To simplify the issue, and remove any potential security issues about
> switching to root, I used su only to switch user, and only to myself,
> ie:
>    /bin/su - dad
>    Passwd: 
> No new xterm window was opened; I only changed user (to myself).
> 
> Before and after, I listed the exported variables:
>    export -p > /tmp/exp.before
> and compared the lists.
> 
> To my surprise, there is a great number of variables that should have
> been exported, but were not.  Here's the list of variable names that
> are NOT exported:
> 
>     IBM T30			ASUS N10
> 
>     DBUS_SESSION_BUS_ADDRESS=	DBUS_SESSION_BUS_ADDRESS=
>     DESKTOP_SESSION=		DESKTOP_SESSION=
>     DISPLAY=			
>     GLADE_CATALOG_PATH=		GLADE_CATALOG_PATH=
>     GLADE_MODULE_PATH=		GLADE_MODULE_PATH=
>     GLADE_PIXMAP_PATH=		GLADE_PIXMAP_PATH=
>     GNOME_KEYRING_CONTROL=
>     GNOME_KEYRING_PID=
>     GPG_AGENT_INFO=		GPG_AGENT_INFO=
>     LIBGLADE_MODULE_PATH=	LIBGLADE_MODULE_PATH=
>     				OLDPWD=
>     ORBIT_SOCKETDIR=
>     SESSION_MANAGER=		SESSION_MANAGER=
>     SHLVL=			SHLVL=
>     SSH_AGENT_PID=		SSH_AGENT_PID=
>     SSH_AUTH_SOCK=		SSH_AUTH_SOCK=
>     WINDOWID=			WINDOWID=
>     WINDOWPATH=			WINDOWPATH=
>     XDG_CONFIG_DIRS=		XDG_CONFIG_DIRS=
>     XDG_DATA_DIRS=		XDG_DATA_DIRS=
>     XDG_MENU_PREFIX=		XDG_MENU_PREFIX=
>     XDG_SESSION_COOKIE=		XDG_SESSION_COOKIE=
>     XTERM_LOCALE=		XTERM_LOCALE=
>     XTERM_SHELL=		XTERM_SHELL=
>     XTERM_VERSION=		XTERM_VERSION=
> 
> What's going on here?  I would expect the exported environment variables
> to be identical in this experiment, but they are vastly different.
> Is someone playing fast and loose with the rules?
> In particular, why is DISPLAY not exported on the IBM T30, but is exported
> on the ASUS N10?
> 
> 
> As a further experiment, I fired up gnome 3 on each machine and reran
> the comparison.  To be brief, DISPLAY is exported properly on BOTH
> machines.  There are many different exported variables between xfce4
> and gnome, which is not surprising, but why should DISPLAY be treated
> differently?
> 
> I also tried different terminal emulators, Terminal, lxterminal,
> xfterm4, etc.  I created a new user with a brand new $HOME.
> None of these had any effect.
> 
> Who can duplicate this failure to export?
> Why are variables, marked for export, not exported?
> Who can explain it?
> How can it be fixed?
> 
> I've filed BZ 722703 against xfce4, but
> a)  I doubt that xfce4 is culpable, and
> b)  The only responder seems to have run out of ideas.
> 
> Can anyone help?
> 
I would expect the list of variable names to be different with the
root shell invoked with su -. When you use - or -l, things are set
just like you had logged in as that user. Because of /etc/pam.d/su,
DISPLAY and the "cookie" that lets you access X are carried over.
You may want to compare these 2 files, and see if they are the same
on both machines. You may also want to check /etc/pam.d/system-auth
to see if they point to the same file, and the files are the same.

I am not sure, but it looks like a PAM problem to me.

Mikkel
- -- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk4rIaYACgkQqbQrVW3JyMS50ACgg2e7sJ1Q7JBXHkPDVwV/XIxD
5BMAn2P3+45IFJaEccH5hTAXwvEukr1w
=gi1Y
-----END PGP SIGNATURE-----


More information about the users mailing list