今天在64服务器上:发现好像bash 坏了,用户名前边   用-bash 显示,,前几天就发现这个问题,,,但是当时忙没有解决,,,,,今天来看看到底是怎么回事!

File Exists but... "-bash: No such file or directory"

网上找到一篇文章,是说ubuntu系统的,我现在使用的是RHEL6.1 ,先不说其他的,先实践再说,完了看效果!!

-----------------粘贴网上原文---------原文地址:http://superuser.com/questions/344533/no-such-file-or-directory-error-in-bash-but-the-file-exists

On Ubuntu, I get a 'No such file or directory' error when I try to execute a command.

I have checked with ls -la , the file adb is there and it has 'x' flag So why I am getting a 'No such file or directory'?

~/Programs/android-sdk-linux_x86/platform-tools$ ./adb
bash: ./adb: No such file or directory
~/Programs/android-sdk-linux_x86/platform-tools$ ls -la
total 34120
drwxrwxr-x 3 silverstri silverstri 4096 2011-10-08 18:50 .
drwxrwxr-x 8 silverstri silverstri 4096 2011-10-08 18:51 ..
-rwxrwxr-x 1 silverstri silverstri 3764858 2011-10-08 18:50 aapt
-rwxrwxr-x 1 silverstri silverstri 366661 2011-10-08 18:50 adb
-rwxrwxr-x 1 silverstri silverstri 906346 2011-10-08 18:50 aidl
-rwxrwxr-x 1 silverstri silverstri 328445 2011-10-08 18:50 dexdump
-rwxrwxr-x 1 silverstri silverstri 2603 2011-10-08 18:50 dx
drwxrwxr-x 2 silverstri silverstri 4096 2011-10-08 18:50 lib
-rwxrwxr-x 1 silverstri silverstri 14269620 2011-10-08 18:50 llvm-rs-cc
-rwxrwxr-x 1 silverstri silverstri 14929076 2011-10-08 18:50 llvm-rs-cc-2
-rw-rw-r-- 1 silverstri silverstri 241 2011-10-08 18:50 llvm-rs-cc.txt
-rw-rw-r-- 1 silverstri silverstri 332494 2011-10-08 18:50 NOTICE.txt
-rw-rw-r-- 1 silverstri silverstri 291 2011-10-08 18:50 source.properties
asked Oct 9 '11 at 2:52
michael

1,631133760
 
    
what do you get if you run file adb – jdigital Oct 9 '11 at 5:43
    
i get this '$ file adb adb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, not stripped ' – michael Oct 13 '11 at 3:56

7 Answers

It's an executable file that misses required libraries. Use ldd to see what it needs, then provide these files.

answered Oct 9 '11 at 9:39
Daniel Beck

80.3k9191252
 
10  
i get this '$ ldd ./adb not a dynamic executable' – michael Oct 11 '11 at 0:36

Android SDK requires 32-bit libraries. You probably are on 64-bit and need the 32-bit libs. Here are the troubleshooting directions from developer.android.com

For Ubuntu 13.10 (Saucy Salamander) and above, install the libncurses5:i386libstdc++6:i386, and zlib1g:i386 packages using apt-get:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

For earlier versions of Ubuntu, install the ia32-libs package using apt-get:

apt-get install ia32-libs
answered Nov 22 '11 at 19:15
hoffmanc

621144
 
2  
damn that installs a lot of stuff. But it works. – Travis R May 1 '12 at 2:43
1  
Like michael, "file" told me it was a 32 bit ELF binary and ldd told me it was not a dynamic executable. Installing these 32 bit libraries fixed the problem. – Eponymous Sep 10 '12 at 19:06
2  
Most misleading error message EVER! o_O – MathematicalOrchid Apr 23 '14 at 16:46
    
re:{Here are the troubleshooting directions from developer.android.com} I don't see any troubleshooting directions there... – ruslo May 18 at 12:58
sudo apt-get install --reinstall libc6-i386

is also need for me.

answered Apr 12 '12 at 14:55
Shawe

411
 
3  
Did you mean that helped? Any idea why? Where did you get this from? – Tom Wijsman Apr 12 '12 at 15:56

I was also seeing the same after switching my machine from 32 bit ubuntu to 64 bit. Bash would report 'No such file or directory' of files that clearly existed with the execute attribute.

sudo apt-get install --reinstall libc6-i386

Fixed the problem. These are the "GNU C Library: 32-bit shared libraries for AMD64"

Seems like this is a bug in bash. Note that I also changed the default shell from dash to bash using

sudo dpkg-reconfigure dash

before I tried running the 32 bit executable. So I'm not sure if the problem would have happened with the default dash shell

answered Jul 24 '13 at 19:01
 

On a fresh Xubuntu 13.10 x64 install I got adb to run with:

sudo apt-get install --reinstall libc6-i386
sudo apt-get install libstdc++6:i386

And also zlib1g:i386 to make aapt work.

and if you still miss something use:

lld adb
answered Oct 21 '13 at 1:49
Stéphane

1536
 
    
This worked great for me, but I had to call sudo dpkg --add-architecture i386; sudo apt-get updateto make libstdc++6:i386 available – nicopico Feb 12 '14 at 15:53

For adb make sure you have the SDK unpacked and have run the SDK Manager to fully populate the SDK. Additionally make sure you have the following installed: A.) JDK 6 or better B.) lib32stdc++6 C.) lib32ncurses5

hoffmanc was the closest to getting it right, I don't really understand why the answer from Daniel Beck is marked as correct when it's not even close and has nothing to do with the problem.

Incidentally, if you try to run a truly non-existant command (i.e.:

# fakecommand

you'll get: fakecommand: command not found, whereas in your situation the output you are seeing is actually coming from adb even though it's not very clear that is the case.

answered Apr 14 '12 at 18:00
Justin Buser

809911
 

Ubunto seems to have some issues with LSB compatibility, so try this if you are on Ubunto

apt-get install lsb

Note that ldd will sort of show that all the libraries are there, but they are not.

usmp-vm-lamp01$ ldd lmgrd
linux-vdso.so.1 => (0x00007fffb33fe000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f10b0a48000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f10b074c000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f10b0535000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f10b0175000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f10aff71000)
/lib64/ld-lsb-x86-64.so.3 => /lib64/ld-linux-x86-64.so.2 (0x00007f10b0c67000)
usmp-vm-lamp01$ locate libpthread.so.0
/lib/x86_64-linux-gnu/libpthread.so.0
usmp-vm-lamp01$ locate libm.so.6
/lib/x86_64-linux-gnu/libm.so.6
usmp-vm-lamp01$ locate /lib64/ld-lsb-x86-64.so.3
usmp-vm-lamp01$
answered Jun 9 '14 at 21:26
Mark Lakata

697614
 
    
I was having this problem with a speech recognition package called Julius. This is what fixed it for me. – Fireandlight27 Oct 16 '14 at 14:16

----------------- -------------------------------------------------

我的操作步骤!

 

702 find / | grep rhel6.1                               找到yum的安装包目录 
703 cd /home/mdsoss/rhel6.1_x64               cd 到该目录 
704 ls
705 cd Packages/                                                                       -----------------------
706 ls                                                                                                        |
707 ls libncurse*                                                                                         |
708 ls *ncurse*                                 |
709 rpm -ivh ncurses-devel-5.7-3.20090208.el6.i686.rpm                               |
710 rpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpm                          |
711 ls                                                                                     -----------------------------无用
712 ls *stdc++*
713 rpm -ivh libstdc++-devel-4.4.5-6.el6.x86_64.rpm
714 rpm -ivh compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
715 rpm -ivh libstdc++-4.4.5-6.el6.x86_64.rpm
716 rpm -ivh libstdc++-docs-4.4.5-6.el6.x86_64.rpm                                安装所有的相关包
717 rpm -ivh libstdc++-4.4.5-6.el6.i686.rpm
718 rpm -ivh libstdc++-devel-4.4.5-6.el6.i686.rpm
719* ls
720 ls *ncurse*
721 rpm -ivh ncurses-devel-5.7-3.20090208.el6.i686.rpm
722 rpm -ivh ncurses-libs-5.7-3.20090208.el6.i686.rpm
723 rpm -ivh ncurses-libs-5.7-3.20090208.el6.x86_64.rpm
724 rpm -ivh ncurses-term-5.7-3.20090208.el6.x86_64.rpm                      安装所有的相关包
725 rpm -ivh ncurses-5.7-3.20090208.el6.x86_64.rpm
726 rpm -ivh ncurses-base-5.7-3.20090208.el6.x86_64.rpm
727 rpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpm
728 rpm -ivh ncurses-devel-5.7-3.20090208.el6.i686.rpm
729 ls *zlib*
730 rpm -ivh zlib-1.2.3-25.el6.x86_64.rpm
731 rpm -ivh zlib-1.2.3-25.el6.i686.rpm
732 rpm -ivh zlib-devel-1.2.3-25.el6.i686.rpm
733 rpm -ivh zlib-devel-1.2.3-25.el6.x86_64.rpm                                安装所有的相关包
734 rpm -ivh jzlib-1.0.7-7.5.el6.x86_64.rpm
735 ls *ia*
736 rpm -ivh yum-plugin-aliases-1.1.30-6.el6.noarch.rpm
737 rpm -ivh libpciaccess-0.10.9-4.el6.x86_64.rpm                        安装所有的相关包------ia相关包没找见  安装pci相关包
738 rpm -ivh libpciaccess-0.10.9-4.el6.i686.rpm
739 ls *libc6*
740 ls *c6*
741 ls *libc*
742 rpm -ivh glibc-2.12-1.25.el6.x86_64.rpm
743 rpm -ivh glibc-devel-2.12-1.25.el6.x86_64.rpm
744 rpm -ivh glibc-2.12-1.25.el6.i686.rpm
745 rpm -ivh glibc-common-2.12-1.25.el6.x86_64.rpm                   安装libc所有的相关包
746 rpm -ivh glibc-devel-2.12-1.25.el6.x86_64.rpm
747 rpm -ivh glibc-devel-2.12-1.25.el6.i686.rpm
748 rpm -ivh glibc-headers-2.12-1.25.el6.x86_64.rpm
749 rpm -ivh glibc-utils-2.12-1.25.el6.x86_64.rpm
750 yum install glibc-utils
751 ls
752 ls *lsb*
753 rpm -ivh redhat-lsb-4.0-3.el6.x86_64.rpm
754 rpm -ivh redhat-lsb-graphics-4.0-3.el6.x86_64.rpm                   安装lsb所有的相关包,怕有一些LSB兼容性的问题
755 rpm -ivh redhat-lsb-printing-4.0-3.el6.x86_64.rpm
756 rpm -ivh redhat-lsb-4.0-3.el6.i686.rpm
757 yum install redhat-lsb-4.0-3.el6.i686
758 ls
759 su - wgj1                                                                                   切换到之前的用户,,一切都变得正常了!!

 

感觉今天有点小成就,又解决了一个问题,积硅步至千里!!!

------------------追更:现在我可能找到了根源,,,之前我在该用户下使用的是 默认的 bash   ----之后在这个环境下我启动了 zookeeper和kafka集群  ,,,之后又在该用户下编译了公司的代码,,,修改为csh,,,,,可能当时是这个原因照成上述情况,,,,之后我在该目录下 安装了flume  在该用户的  .bashrc 里边增加了java的环境变量!后边执行了  flume 或者 kafka bin下边的其他依赖java环境的脚本  命令,,,之后报的这个错,,,建议看完这边文章的朋友,先检查一下自己的 shell   看是不是 shell  引起的冲突!!!

今天又学了一招,牛逼!!!解决"-bash:No such file or directory"问题的更多相关文章

  1. 没必要看源码。。把文档学通就已经牛逼了(我们大多还是在应用层,还达不到研究的程度。附class与examples大全链接)

    [学霸]深圳-鑫 2017/7/11 13:54:07只是学习怎么用QT的话,不用看源码.看帮助文档就很好要学习编码风格与思路,就看看源码 [学神]武汉-朝菌 2017/7/11 13:54:39没必 ...

  2. 感觉还是要学点c才牛逼

    2019-04-06 $gcc -o hello hello.c  //-o选项用来指定输出文件的文件名. gcc *.c -o hello  //使用通配符编译当前目录下的所有c文件 $ gcc - ...

  3. 我喜欢ASP.NET的MVC因为它牛逼的9大理由(转载)

    我很早就关注ASP.NET的mvc的,因为最开始是学了Java的MVC,由于工作的原因一直在做.Net开发,最近的几个新项目我采用了MVC做了,我个一直都非常喜欢.Net的MVC.我们为什么使用MVC ...

  4. 从苦逼到牛逼,详解Linux运维工程师的打怪升级之路

    做运维也快四年多了,就像游戏打怪升级,升级后知识体系和运维体系也相对变化挺大,学习了很多新的知识点. 运维工程师是从一个呆逼进化为苦逼再成长为牛逼的过程,前提在于你要能忍能干能拼,还要具有敏锐的嗅觉感 ...

  5. UVA10200-Prime Time/HDU2161-Primes,例题讲解,牛逼的费马小定理和欧拉函数判素数。

                                                    10200 - Prime Time 此题极坑(本菜太弱),鉴定完毕,9遍过. 题意:很简单的求一个区间 ...

  6. 不用 Notepad++,还有更牛逼的选择!

    来源:oschina.net/news/110987/no-notepad-plus-plus 这两天 Notepad++ 牛逼了,然后引发了大家的关注,具体事件内容请大家自行百度,其实作为文本编辑工 ...

  7. Windows 必备——cmder 一款比cmd牛逼的Win软件

    Windows 必备--cmder 一款比cmd牛逼的Win软件一款Windows环境下的命令行替换工具:cmder这款工具简洁美观易用,支持大部分的linux命令,支持ssh连接Linux,比起自带 ...

  8. 为什么我会认为SAP是世界上最好用最牛逼的ERP系统,没有之一?

    为什么我认为SAP是世界上最好用最牛逼的ERP系统,没有之一?玩过QAD.Tiptop.用友等产品,深深觉得SAP是贵的有道理! 一套好的ERP系统,不仅能够最大程度承接适配企业的管理和业务流程,在技 ...

  9. 最牛逼android上的图表库MpChart(三) 条形图

    最牛逼android上的图表库MpChart三 条形图 BarChart条形图介绍 BarChart条形图实例 BarChart效果 最牛逼android上的图表库MpChart(三) 条形图 最近工 ...

随机推荐

  1. 断言(Assert)与异常(Exception)

    断言是被用来检查非法情况而不是错误情况,即在该程序正常工作时绝不应该发生的非法情况,用来帮助开发人员对问题的快速定位.异常处理用于对程序发生异常情况的处理,增强程序的健壮性.容错性,减少程序使用中对用 ...

  2. 漫谈C++11 Thread库之原子操作

    我在之前一篇博文<漫谈C++11 Thread库之使写多线程程序>中,着重介绍了<thread>头文件中的std::thread类以及其上的一些基本操作,至此我们动手写多线程程 ...

  3. mysql查询优化建议(百度)

    1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引.   2.应尽量避免在 where 子句中使用!=或<>操作符,否则将引擎放弃使 ...

  4. 【问题&解决】fonts/fontawesome-webfont.woff2 404 (Not Found)

    问题: 虽然网页正常显示和运行,但是有2个字体文件出现404错误.像笔者这种强迫症是接受不了的. 解决: 因为笔者的服务器是虚拟主机,只需要在主机控制器平台添加对应的MIME类型即可. 这样服务器就支 ...

  5. ZBrush该如何通过结合KeyShot制作逼真玉佩

    玉在中国的文明史上有着特殊的地位,古人的很多生活器具都是玉雕成的,能常戴在身上的惟有玉佩,古语有云"君子无故,玉不去身".即便到了现代,仍有很多人佩戴玉,倒不一定是因为它有多彰显地 ...

  6. HDU 1848 Fibonacci again and again【SG函数】

    对于Nim博弈,任何奇异局势(a,b,c)都有a^b^c=0. 延伸: 任何奇异局势(a1, a2,… an)都满足 a1^a2^…^an=0 首先定义mex(minimal excludant)运算 ...

  7. 激活windows7 企业版小记

    问题:状态不可用 1)控制面板->管理工具->服务,启动SPP Notification Service和Software Protection两项服务后 重启计算机,仍然提示状态不可用. ...

  8. jquery工具方法swap

    swap : css交换(内部) 详细内容请点击 -> 当元素的样式为display:none时获取他的宽高

  9. Fullscreen API 全屏显示网页

    可参考文档:http://blog.csdn.net/tywali/article/details/8623938 脚本代码 <script type="text/javascript ...

  10. C#.NET 大型企业信息化系统集成快速开发平台 4.2 版本 - 访问频率限制功能实现、防止黑客扫描、防止恶意刷屏

    很多软件组件,大家都能想到了,大家也能做出来,但是成熟稳定.可靠.易用.功能全面,可信任,可相信,可开源就不是很容易,需要树立良好的口碑才可以. 1:往往会有黑客,进行撞库挖掘漏洞,很多系统的账户有可 ...