X.Org session start (via xinit) loses LD_LIBRARY_PATH

Bug #380360 reported by Nicolai Hähnle on 2009-05-25
This bug affects 7 people
Affects Status Importance Assigned to Milestone
xorg (Ubuntu)

Bug Description

Binary package hint: x11-common

Some background:
I am working on the Mesa Radeon driver. When testing out Git-based X.Org and Mesa, I keep self-compiled things in their own prefix (contained in my home directory) because I want to keep Ubuntu-supplied packages clean. To test things, I shutdown GDM and start X manually. However, I want to keep as much of the default Ubuntu *client* aspects the default, so I start via xinit (passing a sudo-wrapper for the X server and setting environment variables as appropriate).

In particular, I need to set LD_LIBRARY_PATH, as otherwise clients will not find the right libGL.so.

Expected behaviour would be that the environment with which I call xinit is the environment that clients in the session will see.

However, this is not the case, because ssh-agent (which is setuid) is indirectly a parent of all clients.

I worked around this by adding a small script to /etc/X11/Xsession.d, which essentially is just:
before the script that adds the ssh-agent (I guess it would make more sense to put this into the script that adds the ssh-agent to $STARTUP, but I didn't want to change any files installed by packages).

I realize that I'm as fringe a usecase as you can be, but since this is *really* surprising behaviour, took me about two hours to figure out (just digging to what happens at X session startup takes a long time if you've never done it), and is quite simple to fix,so I'd appreciate it if you considered fixing this.

ProblemType: Bug
Architecture: i386
DistroRelease: Ubuntu 9.04
Package: xorg 1:7.4~5ubuntu18
ProcVersion: Linux version 2.6.28-11-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009
SourcePackage: xorg
Uname: Linux 2.6.28-11-generic i686

00:00.0 Host bridge [0600]: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub [8086:27a0] (rev 03)
     Subsystem: Lenovo Device [17aa:2017]
00:02.0 VGA compatible controller [0300]: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller [8086:27a2] (rev 03)
     Subsystem: Lenovo Device [17aa:201a]

Nicolai Hähnle (nha) wrote :
Tormod Volden (tormodvolden) wrote :

Another reasonable workaround for your case would be to not run ssh-agent, for instance by disabling it in /etc/X11/Xsession.options

For a proper fix, please report a bug in Debian. I don't think Ubuntu wants to divert from Debian in order to accommodate this unusual usage pattern.

Bryce Harrington (bryce) on 2009-06-02
affects: xorg (Ubuntu) → xserver-xorg-video-intel (Ubuntu)
Bryce Harrington (bryce) on 2009-06-02
affects: xserver-xorg-video-intel (Ubuntu) → xorg (Ubuntu)
Changed in xorg (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
Bryce Harrington (bryce) on 2009-06-17
description: updated


Good god, this is a standard capability in other UNIX systems - even bloody Windows will keep env settings after you log on!!

Come on - it's a pretty darn serious BUG!

Yeah, not great. Severity? I think my first reaction was the same as yours
but somehow I have mellowed having managed to work around it.

On 25 October 2010 14:00, Martin Bartlett <email address hidden> wrote:

> Wishlist???????????
> Good god, this is a standard capability in other UNIX systems - even
> bloody Windows will keep env settings after you log on!!
> Come on - it's a pretty darn serious BUG!
> --
> X.Org session start (via xinit) loses LD_LIBRARY_PATH
> https://bugs.launchpad.net/bugs/380360
> You received this bug notification because you are a direct subscriber
> of the bug.


For above ground swimming pools, hot tubs and spas with expert advice and
great prices: http://www.woodspringpools.co.uk

Oliver Dungey (oliver-dungey) wrote :

Ooops, apologies, please ignore my response sent by accident: Is there a way to edit/remove responses?

James Spencer (james-s-spencer) wrote :

I noticed another workaround: https://bugs.launchpad.net/ubuntu/+bug/366728/comments/21.

It doesn't seem to make sense to initialise ssh-agent twice...

Marcus Letzel (letzel-marcus) wrote :

Happy to confirm that the workaround from comment #6 (https://bugs.launchpad.net/ubuntu/+bug/366728/comments/21) is working for Ubuntu 10.04.

It would be good to know whether LD_LIBRARY_PATH is ignored in $HOME/.profile, /etc/profile, and /etc/environment since Ubuntu 9.04 a) with intention or b) by accident.
In case of a), which intention? https://help.ubuntu.com/community/EnvironmentVariables lacks an explanation, and https://edge.launchpad.net/ubuntu/+bug/366728 doesn't explain it either.
In case of b), it is a bug that I would consider serious.

For people seeking for a workaround, there is one in message #21 of this other similar bug report:

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers