Bash 无法启动已存在且具有所有正确权限的程序

Ama*_*rus 4 linux bash architecture gentoo executable

这是一个gentoo服务器。有一个程序prog无法执行。(是的,执行权限已设置)

关于文件

$ ls
prog
$ ./prog
bash: ./prog: No such file or directory
$ file prog
prog: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
$ pwd
/usr/local/bin
$ /usr/local/bin/prog
bash: /usr/local/bin/prog: No such file or directory
$ less prog | head
ELF Header:
Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
Class:                             ELF32
Data:                              2's complement, little endian
Version:                           1 (current)
OS/ABI:                            UNIX - System V
ABI Version:                       0
Type:                              EXEC (Executable file)
Machine:                           Intel 80386
Version:                           0x1
Run Code Online (Sandbox Code Playgroud)

我有一个花哨的,为了表明它是一个实际的可执行文件,这里有一些更多的数据:

$ xxd prog |head
0000000: 7f45 4c46 0101 0100 0000 0000 0000 0000  .ELF............
0000010: 0200 0300 0100 0000 c092 0408 3400 0000  ............4...
0000020: 0401 0a00 0000 0000 3400 2000 0700 2800  ........4. ...(.
0000030: 2600 2300 0600 0000 3400 0000 3480 0408  &.#.....4...4...
0000040: 3480 0408 e000 0000 e000 0000 0500 0000  4...............
0000050: 0400 0000 0300 0000 1401 0000 1481 0408  ................
0000060: 1481 0408 1300 0000 1300 0000 0400 0000  ................
0000070: 0100 0000 0100 0000 0000 0000 0080 0408  ................
0000080: 0080 0408 21f1 0500 21f1 0500 0500 0000  ....!...!.......
0000090: 0010 0000 0100 0000 40f1 0500 4081 0a08  ........@...@...
Run Code Online (Sandbox Code Playgroud)

$ ls -l prog
-rwxrwxr-x 1 1000 devs 725706 Aug  6  2007 prog

$ ldd prog
      not a dynamic executable

$ strace ./prog
1249403877.639076 execve("./prog", ["./prog"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
1249403877.640645 dup(2)                = 3
1249403877.640875 fcntl(3, F_GETFL)     = 0x8002 (flags O_RDWR|O_LARGEFILE)
1249403877.641143 fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
1249403877.641484 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b3b8954a000
1249403877.641747 lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
1249403877.642045 write(3, "strace: exec: No such file or dir"..., 40strace: exec: No such file or directory
) = 40
1249403877.642324 close(3)              = 0
1249403877.642531 munmap(0x2b3b8954a000, 4096) = 0
1249403877.642735 exit_group(1)         = ?
Run Code Online (Sandbox Code Playgroud)

关于服务器

FTR服务器是一个xen domU,程序是一个闭源linux应用程序。这个虚拟机是另一个具有相同根文件系统(包括这个程序)的虚拟机的副本,运行良好。

我已经尝试了以上所有作为 root 和同样的问题。

我有没有提到根文件系统是通过 NFS 挂载的。但是它安装了“defaults,nosuid”,其中应该包括执行。我还可以从该安装的驱动器运行许多其他程序

/proc/cpuinfo:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 15
model       : 4
model name  :                   Intel(R) Xeon(TM) CPU 3.00GHz
stepping    : 1
cpu MHz     : 2992.692
cache size  : 1024 KB
fpu     : yes
fpu_exception   : yes
cpuid level : 5
wp      : yes
flags       : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl cid cx16 xtpr
bogmips : 5989.55
clflush size    : 64
cache_alignment : 128
address sizes   : 36 bits physical, 48 bits virtual
power management:
Run Code Online (Sandbox Code Playgroud)

我可以运行的文件示例

我可以在该服务器上安装的文件系统上运行其他程序。例如:

$ ls -l ls
-rwxr-xr-x 1 root root 105576 Jul 25 17:14 ls
$ file ls
ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), stripped
$ ./ls
attr        cat    cut        echo        getfacl   ln    more       
... (you get the idea) ...
rmdir       sort       tty
$ less ls | head
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
Run Code Online (Sandbox Code Playgroud)

Tob*_*ord 10

lm您中的标志/proc/cpuinfo表示您的服务器具有 64 位 CPU。

来自的信息file prog表明该程序是为 32 位体系结构编译的。尝试安装 32 个库。我不熟悉如何在 Gentoo 中执行此操作,但也许这篇Gentoo wiki 文章可以提供帮助。

我在尝试在 64 位 Ubuntu 安装上运行 Android 调试桥时遇到了一个类似的问题(bash 报告找不到文件),因为它是为 32 位编译的。

  • 我无法在关于 lm 标志的回答中包含此链接:http://www.linuxquestions.org/questions/linux-general-1/proccpuinfo-flag-lm-358563/ (2认同)