加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

sh – Schr?dinger的档案

发布时间:2020-12-13 23:07:45 所属栏目:Linux 来源:网络整理
导读:我对以下命令序列感到困惑. sh-4.2$pwd/home/willardsh-4.2$ls -l f-rwxr-xr-x 1 willard users 59116 Jan 23 14:54 fsh-4.2$file ff: ELF 32-bit LSB executable,Intel 80386,version 1 (SYSV),dynamically linked (uses shared libs),for GNU/Linux 2.6.15
我对以下命令序列感到困惑.

sh-4.2$pwd
/home/willard
sh-4.2$ls -l f
-rwxr-xr-x 1 willard users 59116 Jan 23 14:54 f
sh-4.2$file f
f: ELF 32-bit LSB executable,Intel 80386,version 1 (SYSV),dynamically linked (uses shared libs),for GNU/Linux 2.6.15,BuildID[sha1]=0xea0e08ff2b5a062698d45b78177acdd6bf140d1f,stripped
sh-4.2$./f
sh: ./f: No such file or directory
sh-4.2$strace ./f
execve("./f",["./f"],[/* 32 vars */]) = -1 ENOENT (No such file or directory)
write(2,"strace: exec: No such file or di"...,40strace: exec: No such file or directory
) = 40
exit_group(1)                           = ?
+++ exited with 1 +++
sh-4.2$ls -l f
-rwxr-xr-x 1 willard users 59116 Jan 23 14:54 f
sh-4.2$uname -a
Linux xdat10 3.6.2-1-ARCH #1 SMP PREEMPT Fri Oct 12 23:58:58 CEST 2012 x86_64 GNU/Linux

这怎么可能?

解决方法

我发现有人有同样的问题(有相关解释)

Running 32bit binary on a 64bit system

引用最重要的句子:

This situation often arises when you try to run a binary for the right
system (or family of systems) and superarchitecture but the wrong
subarchitecture. Here you have ELF binaries on a system that expects
ELF binaries,so the kernel loads them just fine. They are i386
binaries running on an x86_64 processor,so the instructions make
sense and get the program to the point where it can look for its
loader. But the program is a 32-bit program (as the file output
indicates),looking for the 32-bit loader /lib/ld-linux.so.2,and
you’ve presumably only installed the 64-bit loader
/lib64/ld-linux-x86-64.so.2 in the chroot.

You need to install the 32-bit runtime system in the chroot: the
loader,and all the libraries the programs need. On Debian amd64,the
32-bit loader is in the libc6-i386 package. You can install a bigger
set of 32-bit libraries by installing ia32-libs.

我打赌有更好的方法来验证这一点,但我会尝试执行

ldd ./f

并在输出中搜索需要加载器的exec’it

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读