[英]Running Yocto in Docker, "make menuconfig" fails
Running Yocto in a Docker container, I can't execute "make menuconfig"在 Docker 容器中运行 Yocto,我无法执行“make menuconfig”
$ MACHINE=varsomam33 bitbake -c menuconfig linux-ti-variscite
ERROR: No valid terminal found, unable to open devshell
ERROR: Function failed: do_menuconfig
Solution: gnu "screen" command
Bitbake tries to spawn a number of terminal programs, most of which fail
because A) they're not installed or B) they require X Windows. We can't
execute X terminals in the docker command-line (no X support).
So the most viable terminal is gnu screen.
In my ubuntu docker container:
$ sudo apt-get install screen
$ tty // Shows "not a tty", we're trying to fix that
Get in the docker containter as root (something like: docker exec -it $(docker ps -q) /bin/bash )
# agetty tty // This will present you with a login prompt, login as your regular yocto user
$ tty // Should show a valid tty
$ screen // Start a screen session
$ cd build // Got to Yocto build dir
$ source conf/setenv
$ MACHINE=varsomam33 bitbake -c menuconfig linux-ti-variscite // Will spawn a new "screen" terminal, using ncurses for menuconfig
We use the same setup (yocto in a docker container), but tty
does show a valid tty (maybe because we use --tty
with docker exec
?).我们使用相同的设置(docker 容器中的 yocto),但
tty
确实显示了一个有效的 tty(可能是因为我们将--tty
与 docker docker exec
一起使用?)。
We are still missing a terminal emulator in our image, though.不过,我们的图像中仍然缺少终端仿真器。 When using newer versions of yocto, you will be provided with a list of commands yocto tried to spawn the development shell, like this:
当使用较新版本的 yocto 时,您将获得 yocto 尝试生成开发 shell 的命令列表,如下所示:
ERROR: busybox-1.24.1-r0 do_menuconfig: No valid terminal found, unable to open devshell.
Tried the following commands:
tmux split-window "do_terminal"
[...]
screen -D -m -t "busybox Configuration" -S devshell do_terminal
When using older versions of yocto, you might want to apply the commit implementing the output of the list of tried commands.使用旧版本的 yocto 时,您可能希望应用提交来实现已尝试命令列表的输出。
The solution is now obvious: Install a (non-windowed) terminal emulator, eg, tmux ( apt-get install tmux
).解决方案现在很明显:安装一个(非窗口)终端仿真器,例如 tmux (
apt-get install tmux
)。
Brad's answer is correct (rep too low to even +1 or comment back)布拉德的回答是正确的(代表太低,甚至不能 +1 或评论)
I have a Docker image (Dockerfile includes FROM ubuntu:trusty and created a builduser account) and did the following:我有一个 Docker 映像(Dockerfile 包括 FROM ubuntu:trusty 并创建了一个 builduser 帐户)并执行了以下操作:
From my local PC terminal #1:从我的本地 PC 终端 #1:
// my Dockerfile will default into USER builduser account, use 'sudo' if you need to here
$ docker run -it <my image name from 'docker images'> /bin/bash
$ tty
/dev/console
With the image loaded into a container, I'll open another PC terminal #2 and execute Brad's suggestion of installing 'screen' as root (root password is disabled by default on Ubuntu images, so this is a workaround):将图像加载到容器中后,我将打开另一个 PC 终端 #2 并执行 Brad 建议的以 root 身份安装“screen”(Ubuntu 图像默认禁用 root 密码,因此这是一种解决方法):
// -u parameter is <user id> and root's uid is 0
$ docker exec -u 0 -it <my temporary container id from 'docker ps -q'> /bin/bash
// notice command prompt went to '#' indicating root
# apt-get install screen
# tty
not a tty
Going back to PC terminal #1, start your build within a 'screen' session:回到 PC 终端 #1,在“屏幕”会话中开始构建:
$ which screen
/usr/bin/screen
$ tty
/dev/console
// start 'screen' session, will launch /bin/sh by default
$ screen
$ cd <build directory> # your Yocto build dir
$ source <config file> # (optional) your Yocto build env config file>
// will launch ncurses menuconfig after a build
$ MACHINE=varsomam33 bitbake -c menuconfig linux-ti-variscite
apt-get install screen
if the docker container is debian or ubuntu.如果 docker 容器是 debian 或 ubuntu,则
apt-get install screen
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.