6

I used $HOME/.local as prefix to install some applications without root access. There is one directory inside $HOME/.local that I can't execute ls command:

[tuananh@server lib]$ ls
Segmentation fault
[tuananh@server lib]$ cd ..
[tuananh@server .local]$ ls lib
audit                    libform.a         
libncurses.a             libopenblas.so.0
...
[tuananh@server .local]$ 

What could posibly be the reason for that? uname -a for my server:

Linux server 2.6.32-358.2.1.el6.x86_64 #1 SMP Tue Mar 12 14:18:09 CDT 2013 x86_64 x86_64 x86_64 GNU/Linux

EDIT: Output of LD_TRACE_LOADED_OBJECTS=1 ls. I found some libraries loaded from this directory. So now what should I do to find the one that cause the problem?

linux-vdso.so.1 =>  (0x00007fff831b8000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003d94800000)
librt.so.1 (0x00007fdcde5a3000)
libcap.so.2 => /lib64/libcap.so.2 (0x0000003d95c00000)
libacl.so.1 => /lib64/libacl.so.1 (0x0000003d97c00000)
libc.so.6 (0x00007fdcde1f5000)
libdl.so.2 (0x00007fdcddff1000)
/lib64/ld-linux-x86-64.so.2 (0x0000003d92c00000)
libpthread.so.0 (0x00007fdcdddd3000)
libattr.so.1 => /lib64/libattr.so.1 (0x0000003d96800000)

1 Answers1

9

Most likely you have some library installed in there that gets loaded instead of the system ones when you execute a command in there and it is binary incompatible with the commands in your system. It's probably something related to glibc or so.

You can confirm this by running LD_TRACE_LOADED_OBJECTS=1 ls and examining the output to see if it includes any of the files in the current directory.

aecolley
  • 943
  • 4
  • 15
Florin Asăvoaie
  • 6,932
  • 22
  • 35
  • Yes I've updated my question. Please take a look, thank you! – Tuan Anh Hoang-Vu Sep 01 '14 at 01:38
  • Do you have LD_LIBRARY_PATH environment variable set? If yes, what is its value? `echo $LD_LIBRARY_PATH`. – Florin Asăvoaie Sep 01 '14 at 01:56
  • 1
    It was set to `some_non_related_dir:` I guess the culprit is the trailing `:` since it will include current directory, correct? The reason for the trailing `:` is this line in `.bash_profile`: `export LD_LIBRARY_PATH= some_non_related_dir:$LD_LIBRARY_PATH`. I `unset LD_LIBRARY_PATH` and now can `ls` any directory without problem! So now problem is definitely some library in my custom `lib` directory. – Tuan Anh Hoang-Vu Sep 01 '14 at 02:47
  • 1
    Do you have any idea how to find with lib causes problem? – Tuan Anh Hoang-Vu Sep 01 '14 at 02:47
  • 2
    You can install debugging packages for libs and coreutils and use gdb. Not sure. There may be some easier way but if it were me, I would create a bash loop that takes the libraries one by one and sees when the problem is fixed. Note that there may be multiple ones so you may need to recursively loop multiple times through the libraries to see exactly. – Florin Asăvoaie Sep 01 '14 at 02:52