没有这样的文件或目录:无法执行,但对ls,文件和制表符完成可见 [英] No such file or directory: Cannot execute but is visible to ls, file and tab-completion

查看:128
本文介绍了没有这样的文件或目录:无法执行,但对ls,文件和制表符完成可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在Amazon Lightail实例上安装flexnet.我只是将内容提取到/opt,并尝试运行任何lm *命令.使用ls,我可以看到我拥有执行的所有权和权限.我可以在文件夹的任何内容上运行file,它会告诉我它是什么.

I'm installing flexnet on an amazon lightsail instance. I've just extracted the contents to /opt and in trying to run any lm* command. With ls I can see I have ownership and permission to execute. I can run file on any of the contents of the folder and it will tell me what it is.

但是当我尝试执行任何操作时,bash会抱怨没有这样的文件或目录.示例:

But when I try to execute anything, bash will complain with No such file or directory. Example:

jabozzo@ICUC_services:/opt/flexnet/bin$ ls -all
total 4684
drwxr-xr-x 2 jabozzo jabozzo    4096 Nov  8  2016 .
drwxr-xr-x 6 jabozzo jabozzo    4096 Dec 19 15:46 ..
lrwxrwxrwx 1 jabozzo jabozzo       6 Dec 14  2016 lmcksum -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo       6 Dec 14  2016 lmdown -> lmutil
-rwxr-xr-x 1 jabozzo jabozzo 1551536 Nov  8  2016 lmgrd
lrwxrwxrwx 1 jabozzo jabozzo       6 Dec 14  2016 lmhostid -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo       6 Dec 14  2016 lmnewlog -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo       6 Dec 14  2016 lmpath -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo       6 Dec 14  2016 lmremove -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo       6 Dec 14  2016 lmreread -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo       6 Dec 14  2016 lmstat -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo       6 Dec 14  2016 lmswitchr -> lmutil
-rwxr-xr-x 1 jabozzo jabozzo 1362736 Nov  8  2016 lmutil
lrwxrwxrwx 1 jabozzo jabozzo       6 Dec 14  2016 lmver -> lmutil
-rwxr-xr-x 1 jabozzo jabozzo 1701200 Nov  8  2016 mgcld
-rwxr-xr-x 1 jabozzo jabozzo   49088 Nov  8  2016 mgls_admin
-rwxr-xr-x 1 jabozzo jabozzo    1593 Nov  8  2016 mgls_child_ver
-rwxr-xr-x 1 jabozzo jabozzo  112736 Nov  8  2016 mgls_ok
jabozzo@ICUC_services:/opt/flexnet/bin$ file lmutil 
lmutil: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-lsb-x86-64.so.3, for GNU/Linux 2.6.9, stripped
jabozzo@ICUC_services:/opt/flexnet/bin$ ./lmutil
-bash: ./lmutil: No such file or directory
jabozzo@ICUC_services:/opt/flexnet/bin$ /opt/flexnet/bin/lmutil 
-bash: /opt/flexnet/bin/lmutil: No such file or directory

在示例中,如果我键入./lmu并使用制表符完成,则它将作为./lmutils完成.使用绝对路径也无济于事.我还检查了是否存在所需的共享库:

In the example, if I type ./lmu and tab complete, it is completed as ./lmutils. Using absolute path doesn't help either. I've also checked for the presence of needed shared libraries:

jabozzo@ICUC_services:/opt/flexnet/bin$ ldd lmutil 
    linux-vdso.so.1 =>  (0x00007ffe09bb1000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7e75ab4000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7e757ab000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7e75595000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7e751cb000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7e74fc7000)
    /lib64/ld-lsb-x86-64.so.3 => /lib64/ld-linux-x86-64.so.2 (0x00007f7e75cd1000)

推荐答案

如果尝试运行可执行文件,但收到无此文件或目录"错误,则通常意味着该可执行文件无法找到正确的动态文件.装载机.如果查看file命令的输出,则会看到:

If you try to run an executable and you get the "no such file or directory" error, this often means that the executable is unable to find the correct dynamic loader. If you look at the output from the file command, you see:

...interpreter /lib64/ld-lsb-x86-64.so.3...

您的系统是否有/lib64/ld-lsb-x86-64.so.3?如果不是,则表明这些二进制文件是为不同的体系结构(例如64位与32位)或为C版本的其他版本(glibc)而构建的.

Does your system have /lib64/ld-lsb-x86-64.so.3? If not, that suggests that these binaries were built for a different architecture (e.g., 64 bit vs 32 bit) or for a different version of the C library (glibc).

解决方案包括:

  • 安装包含必要解释程序的软件包.

  • Install packages that contain the necessary interpreter.

查找为系统上安装的C库版本编译的一组可执行文件.

Find a set of executables that have been compiled for the version of the C library installed on your system.

在已安装适当C库的Docker容器或chroot环境中运行事情.

Run things inside a Docker container or chroot environment that has the appropriate C library installed.

一个有问题的解决方案是使用 patchelf 命令更改嵌入在二进制文件中的解释器路径.根据您的环境,这可能会起作用,或者可能会使所有崩溃.

A hacky solution would be to use the patchelf command to change the interpreter path embedded in the binaries. Depending on your environment, that might work or it just may make everything crash.

此外,仅从.so.2.so.3的符号链接可能会起作用.

Also, just symlinking from the .so.2 to .so.3 might work.

这篇关于没有这样的文件或目录:无法执行,但对ls,文件和制表符完成可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆