嵌入式Linux中的busybox显示“找不到小程序”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19043700/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 00:56:54  来源:igfitidea点击:

busybox in embedded linux shows "applet not found"

linuxembeddedbusyboxramdisk

提问by Ezio

I compiled busybox myself,and I put it in our embedded linux. But I have some questions.

我自己编译了busybox,放在我们的嵌入式linux中。但我有一些问题。

Question 1:When I try to use some command such as gzip,it prints "gzip: applet not found".While I checked the menuconfig of busybox,I make sure that I've selected "gzip".

问题 1:当我尝试使用某些命令(例如 gzip)时,它会打印“gzip: applet not found”。当我检查了 busybox 的 menuconfig 时,我确保我选择了“gzip”。

Question 2:I used to work with VIM,but busybox just provide VI.So I make a link VIM to VI,but when I typed vim and run it,it also show "vim: applet not found".

问题2:我以前用过vim,但是busybox只提供vi,所以我做了一个vim到vi的链接,但是当我输入vim并运行它时,它也显示“vim: applet not found”。

Anybody can help me with this problem that "applet not found"? Thank you very much.

任何人都可以帮助我解决“未找到小程序”的问题?非常感谢。

PS:I'm confused with the "applet" of busybox,what it is? Like "applet" in java?

PS:我对busybox的“小程序”感到困惑,它是什么?像Java中的“小程序”?

回答by Luis Lavaire

The answer to questions 1 and 2 is: you must set your PATHvariable first or compile busybox with FEATURE_PREFER_APPLETSenabled. You can set the PATHvariable with:

问题 1 和问题 2 的答案是:您必须先设置PATH变量或在FEATURE_PREFER_APPLETS启用时编译 busybox 。您可以使用以下方法设置PATH变量:

$ export PATH=/bin:/sbin:/usr/bin:/usr/sbin

A busybox applet is a small application that is usually found in the UNIX common utilities (defined in the POSIX standard). This applets are compiled into a single executable: busybox.

busybox 小程序是一个小应用程序,通常可以在 UNIX 通用实用程序(在 POSIX 标准中定义)中找到。这个小程序被编译成一个单一的可执行文件:busybox.

回答by KEINOS

[F.Y.I.] Shebang's typo caused me the same applet not founderror.

[FYI] Shebang 的拼写错误导致了我同样的applet not found错误。

$ # The '!' was forgotten in shebang
$ cat sample.sh
#/bin/sh

echo 'hello world'

$ ./sample.sh
sample.sh: applet not found

In docker-compose, running the above script gives me the blow error:

在 docker-compose 中,运行上面的脚本给了我一个打击错误:

standard_init_linux.go:211: exec user process caused "exec format error"