Sha*_*off 40 embedded router command-not-found
我正在尝试将 ebtables 添加到一个小路由器盒中。我去为正确的架构编译了一个二进制文件,然后把它放在/sbin/. 当我这样做时/sbin/ebtables,外壳会说/bin/sh: /sbin/ebtables: not found,但我可以这样做ls -l /sbin/ebtables并且它完美地显示出来:
-rwxr-xr-x 1 admin admin 4808 Aug 4 10:36 /sbin/ebtables
Run Code Online (Sandbox Code Playgroud)
关于这里发生了什么的任何想法?
Mat*_*Mat 44
它可能是缺少的依赖项。值得注意的是,如果ELF您的系统上不存在标头中设置的运行时链接器(“程序解释器”),您将收到这种类型的消息。
要检查它,请运行:
readelf -l your_executable|grep "program interpreter"
Run Code Online (Sandbox Code Playgroud)
如果它给你的东西在你的系统上不存在,或者缺少依赖项(检查ldd),你会收到那个奇怪的错误消息。
演示:
$ gcc -o test t.c
$ readelf -l test|grep "program interpreter"
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
$ ./test
hello!
$ gcc -Wl,--dynamic-linker -Wl,/i/dont/exist.so -o test t.c
$ readelf -l test|grep "program interpreter"
[Requesting program interpreter: /i/dont/exist.so]
$ ./test
bash: ./test: No such file or directory
Run Code Online (Sandbox Code Playgroud)