6

We are using linux on an embedded system that has busybox 1.20.2 for the various shell commands. We are having a very strange problem in that env does now show the value of LD_LIBRARY_PATH:

$ export LD_LIBRARY_PAT=/usr/bin
$ export LD_LIBRARY_PATH=/usr/bin
$ export LD_LIBRARY_PATH1=/usr/bin
$ env | sort
ENV=/etc/profile.environment
HISTFILE=/tmp/.ash_history.debug.357
HOME=/home/debug
LD_LIBRARY_PAT=/usr/bin
LD_LIBRARY_PATH1=/usr/bin
LOGNAME=debug
MAIL=/var/mail/debug
PATH=/home/debug/bin:/usr/bin:/bin:/usr/sbin:/sbin
PWD=/home/debug
PYTHONPATH=:/home/debug/tools/tools-0.0.0/common
SHELL=/bin/bash
SHLVL=1
SSH_CLIENT=10.10.10.22 58307 22
SSH_CONNECTION=10.10.10.22 58307 10.10.12.23 22
SSH_TTY=/dev/pts/0
TERM=xterm
USER=debug
_=/usr/bin/env
$ 
$ echo $LD_LIBRARY_PAT
/usr/bin
$ echo $LD_LIBRARY_PATH
/usr/bin
$ echo $LD_LIBRARY_PATH1
/usr/bin

As you can see, LD_LIBRARY_PATH is set, but it just doesn't show up in the output of env. AFAIK, it is the only environment variable that this happens.

Can anyone explain why this is happening? Thanks!

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148
David
  • 61
  • 3
  • Weird question... Does it work as root? – ErlVolton Oct 28 '14 at 19:05
  • Can you test with something other than `env`? python or perl or something to see if that inherits `LD_LIBRARY_PATH` correctly? Could busybox be explicitly disallowing export of `LD_LIBRARY_PATH` for some reason? – Etan Reisner Oct 28 '14 at 19:15

1 Answers1

6

Linux won't let you mess with the LD_LIBRARY_PATH because busybox (probably) has its setuid bit turned on. Busybox has a bunch of common linux commands built into its binary, so it needs setuid.

Community
  • 1
  • 1
ErlVolton
  • 6,714
  • 2
  • 15
  • 26