X.Org session start (via xinit) loses LD_LIBRARY_PATH

Bug #380360 reported by Nicolai Hähnle
44
This bug affects 8 people
Affects Status Importance Assigned to Milestone
xorg (Ubuntu)
Triaged
Wishlist
Unassigned

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:
  STARTUP="/usr/bin/env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ${STARTUP}"
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
ProcEnviron:
 LANGUAGE=
 LANG=en_US.UTF-8
 SHELL=/bin/bash
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

[lspci]
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]

Revision history for this message
Nicolai Hähnle (nha) wrote :
Revision history for this message
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)
affects: xorg (Ubuntu) → xserver-xorg-video-intel (Ubuntu)
Bryce Harrington (bryce)
affects: xserver-xorg-video-intel (Ubuntu) → xorg (Ubuntu)
Changed in xorg (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
Bryce Harrington (bryce)
description: updated
Revision history for this message
Martin Bartlett (martin-j-bartlett) 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!

Revision history for this message
Oliver Dungey (oliver-dungey) wrote : Re: [Bug 380360] Re: X.Org session start (via xinit) loses LD_LIBRARY_PATH

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

Revision history for this message
Oliver Dungey (oliver-dungey) wrote :

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

Revision history for this message
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...

Revision history for this message
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.

Revision history for this message
Hibou57 (Yannick Duchêne) (yannick-duchene) wrote :

For people seeking for a workaround, there is one in message #21 of this other similar bug report:
https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/366728

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.