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)
  • 2
    Please run strace ls and post the last few lines before the segfault in your question. – Giovanni Tirloni Aug 31 '14 at 1:28
  • 1
    Server is likely hacked. Who's the administrator? – ewwhite Aug 31 '14 at 1:42
  • Now I realize all commands, except pwd is returned Segmentation fault, for example ls, java, python, strace, sh and more. It only happens when current directory is $HOME/.local/lib – Tuan Anh Hoang-Vu Aug 31 '14 at 5:30
  • Does the good old echo * work in that directory? – Janne Pikkarainen Aug 31 '14 at 11:25
  • 1
    Call your administrator or whoever is responsible for the server. – ewwhite Aug 31 '14 at 11:36

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.

| improve this answer | |
  • Yes I've updated my question. Please take a look, thank you! – Tuan Anh Hoang-Vu Sep 1 '14 at 1:38
  • Do you have LD_LIBRARY_PATH environment variable set? If yes, what is its value? echo $LD_LIBRARY_PATH. – Florin Asăvoaie Sep 1 '14 at 1: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 1 '14 at 2:47
  • 1
    Do you have any idea how to find with lib causes problem? – Tuan Anh Hoang-Vu Sep 1 '14 at 2: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 1 '14 at 2:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.