man*_*ake 5 linux debian 64-bit 32-bit
我的新 VPS 运行的是 Debian 5.0 (bash 3.2.29),并且似乎缺少一些命令。例如ps命令不在这里,也不在这里ls(但 dir 有效)。是否缺少包裹或有什么交易?
:~# type ps
ps is hashed (/bin/ps)
:~# ps
-bash: /bin/ps: No such file or directory
:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
:~# /bin/ps
-bash: /bin/ps: No such file or directory
Run Code Online (Sandbox Code Playgroud)
编辑:来自评论的更多信息请求:
/bin/ps和/bin/ls是 32 位。而且没有 32bit /lib/ld-linux-so.2。那是怎么发生的?安装错误还是什么?为了完成:
# file /bin/ps
/bin/ps: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.0.0, stripped
# file /bin/ls
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.0.0, stripped
# uname -mrvs
Linux 2.6.18-028stab069.6 #1 SMP Wed May 26 18:10:06 MSD 2010 x86_64
# readelf -l /bin/ps
Elf file type is EXEC (Executable file)
Entry point 0x8049040
There are 6 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000034 0x08048034 0x08048034 0x000c0 0x000c0 R E 0x4
INTERP 0x0000f4 0x080480f4 0x080480f4 0x00013 0x00013 R 0x1
[Requesting program interpreter: /lib/ld-linux.so.2]
LOAD 0x000000 0x08048000 0x08048000 0x071fa 0x071fa R E 0x1000
LOAD 0x007200 0x08050200 0x08050200 0x005a0 0x01e5c RW 0x1000
DYNAMIC 0x0076f8 0x080506f8 0x080506f8 0x000a8 0x000a8 RW 0x4
NOTE 0x000108 0x08048108 0x08048108 0x00020 0x00020 R 0x4
Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.ABI-tag .hash .dynsym .dynstr
.gnu.version .gnu.version_r .rel.got .rel.bss .rel.plt
.init .plt .text .fini .rodata
03 .data .got .dynamic .bss
04 .dynamic
05 .note.ABI-tag
Run Code Online (Sandbox Code Playgroud)
当exec*回报-ENOENT,无论是二进制丢失或解释缺失。
显然,/bin/ps存在,否则它不会在shell中散列。但是它所依赖的动态链接器可能不存在于您的系统中。如果安装了 GNU binutils,您可以轻松确定是否是这种情况。
$ readelf -l /bin/ps
…
INTERP 0x0000000000000270 0x0000000000400270 0x0000000000400270
0x000000000000001c 0x000000000000001c R 1
[请求程序解释器:/lib64/ld-linux-x86-64.so.2]
…
/lib64/ld-linux-x86-64.so.2 存在于我的 Debian Squeeze/Sid 混合测试机上。
一种可能性是您以某种方式安装了 32 位软件包,而没有必要的 32 位库。例如,如果我尝试在仅 64 位系统上运行 32 位二进制文件,
# 在另一个系统上进行 32 位开发
$ echo 'int main(){}' > 32bit.c
$ cc -m32 -o 32bit 32bit.c
# 在没有 32 位库的 64 位系统上
$ ./32 位
-bash: ./32bit: 没有那个文件或目录
$ readelf -l 32位
…
插入 0x000154 0x08048154 0x08048154 0x00013 0x00013 R 0x1
[请求程序解释器:/lib/ld-linux.so.2]
…
$ ls /lib/ld-linux.so.2
ls: 无法访问 /lib/ld-linux.so.2: 没有那个文件或目录
另一种可能性是您尝试在未安装 LSB 基础库的系统上运行 LSB 二进制文件,例如/sf/ask/109345001/ 之类的场景,或尝试在仅支持 µClibc 的系统上使用基于 Glibc 的软件包,或许多其他类似的情况。
我不得不问——这个系统是如何安装的?默认情况下,这一切都不是真的,有人不得不把事情搞砸。