Author Topic: Curious FreeBSD quirk...  (Read 1417 times)

pdm

  • Sheffield hills? Nah... Just potholes.
Curious FreeBSD quirk...
« on: 03 June, 2008, 01:34:47 pm »
I am playing with FreeBSD 7.0 to experiment with zfs.
Have set up a box as a minimal install server with only the facilities I need. AMP, NFS, Samba and a few nice utilities and shells (mc and bash).
However,  I have come up with a little problem that has me stumped.
The utilities I installed using the ports system, including the bash shell, work fine logged in as root but fail to work when logged in as a user complaining of missing libraries.
If I copy or link the libraries to /lib or /usr/lib (they are usually installed in /usr/local/lib for add on utilities) then they work fine.
In other words, root will run utilities with libraries in /usr/local/lib but a user will not...
There are no access restrictions on /usr/local/lib or permission problems on the executables.
Any ideas??

Zipperhead

  • The cyclist formerly known as Big Helga
Re: Curious FreeBSD quirk...
« Reply #1 on: 03 June, 2008, 01:37:03 pm »
Does FreeBSD have an equivalent to truss/ptrace that you could run it under to see what is happening?
Won't somebody think of the hamsters!

Re: Curious FreeBSD quirk...
« Reply #2 on: 03 June, 2008, 02:49:26 pm »
at which point I would check the environment variables for the user and se if /usr/local/lib is in the paths for executables.

Which reminds me I must get round to adding ./ to the paths available on my Suse box again.

Matthew

Re: Curious FreeBSD quirk...
« Reply #3 on: 03 June, 2008, 06:50:34 pm »
What do you get when you run ldd on any of the binaries that don't work (as the non-root user)?

Is there a BSD equivalent of ld.config?

Isn't it just a case of adding /usr/local/lib to LD_LIBRARY_PATH in whatever .rc file is read by the non-root users?
"Yes please" said Squirrel "biscuits are our favourite things."

Maladict

Re: Curious FreeBSD quirk...
« Reply #4 on: 03 June, 2008, 09:36:29 pm »
For comparison here is what I get for bash:

/usr/local/bin/bash:
        libncurses.so.7 => /lib/libncurses.so.7 (0x8006d2000)
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x80082e000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x800937000)
        libc.so.7 => /lib/libc.so.7 (0x800b30000)

FreeBSD uses ldconfig so it might be worth running that; also check that the hints file is accessible.

pdm

  • Sheffield hills? Nah... Just potholes.
Re: Curious FreeBSD quirk...
« Reply #5 on: 03 June, 2008, 09:43:00 pm »
Well, I still do not understand it all...
Thanks for the suggestions...
I cannot see how some executables find libraries under root and not under a user.
I have checked permissions, environment variables, library "hints" files, re-ran ldconfig, etc...
Curiously SOME executables linked to libraries in /usr/local/lib worked both as root and user but SOME did not!
Specifically adding a LD_LIBRARY_PATH pointing to /usr/local/lib worked but the font used by mc was screwed.

In the end, I uninstalled the offending utilities (which I had installed using the "ports" system by compiling them) and then restored them using the "pkg_add" system which downloads and installs binary packages from the FreeBSD archives. Automagically, they now work....  ???

FWIW: FreeBSD does not have a linux style "/etc/ld.config" file. It does have a "hints" file buried away in the /etc/ directory but this already contained /usr/local/lib. Compared with Linux there are a few quirky goings on! However, compared with Opensolaris,  :sick:  it is sweetness and light!