简体   繁体   English

是什么可能导致Linux“ ls”命令返回段错误?

[英]What could possibly cause a Linux “ls” command to return a seg fault?

I am installing some new software. 我正在安装一些新软件。 It contains several libraries in a "Lib" directory. 它在“ Lib”目录中包含几个库。 If I ls Lib from another directory, I get the usual list of files. 如果我从另一个目录访问ls Lib得到通常的文件列表。 I can issue dir and file commands and get reasonable results too. 我可以发出dirfile命令,也可以获得合理的结果。 I can even copy files out of this directory to other directories. 我什至可以将文件从该目录复制到其他目录。 But if I cd to "Lib", it appears that any linux command I give returns a seg fault. 但是,如果我将CD切换为“ Lib”,则似乎我给出的任何 Linux命令都将返回seg错误。 I can't run ls , file , or dir in that directory. 我无法在该目录中运行lsfiledir I can't even run date there without a seg fault. 我什至不能在没有段错误的情况下在那里date Much obliged if anyone can help me clear up this mystery. 如果有人能帮助我澄清这个谜团,我将承担很多责任。

Probably your LD_LIBRARY_PATH includes a dot / . 您的LD_LIBRARY_PATH可能包含一个点/ . and that Lib directory contains standard libraries like libc, so what ever command you issue, system picks a library from that path and something goes wrong. 而且该Lib目录包含标准库(如libc),因此无论您发出什么命令,系统都会从该路径中选择一个库,并且出现了问题。

On my rpi I observed today the same issue: 今天在我的rpi上,我观察到相同的问题:

$ ls
Segmentation fault

What it solved for me was: 它为我解决的是:

sudo apt-get dist-upgrade

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM