我只是想构建 Kali Linux 的 arm64 映像,但遇到了 qemu 问题。在为 armv7l 构建该映像时,一切似乎都运行良好,但在 arm64 上则不然。
我刚刚安装,qemu-user-static所以它运行的是最新版本。这是我的Dockerfile样子(仅用于测试目的):
FROM kalilinux/kali-rolling
# Set environment variable for non-interactive install
ARG DEBIAN_FRONTEND=noninteractive
# Run basic commands to update the image and install basic stuff.
RUN apt update && \
apt dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
Run Code Online (Sandbox Code Playgroud)
这是我的docker版本:
ubuntu@ip-10-20-38-44:~$ docker -v
Docker version 20.10.6, build 370c289
Run Code Online (Sandbox Code Playgroud)
这是我为重现此错误而运行的命令:
ubuntu@ip-10-20-38-44:~$ sudo docker buildx build -t [myusername]/test:latest --platform linux/arm64 .
Run Code Online (Sandbox Code Playgroud)
这是运行上面的命令时得到的错误输出:
[+] Building 39.9s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 418B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/kalilinux/kali-rolling:latest 0.4s
=> CACHED [1/2] FROM docker.io/kalilinux/kali-rolling@sha256:bd098f211b325a7872c224a7eae755bb38332ea2d375376c75f10c0f194b8d8d 0.0s
=> => resolve docker.io/kalilinux/kali-rolling@sha256:bd098f211b325a7872c224a7eae755bb38332ea2d375376c75f10c0f194b8d8d 0.0s
=> ERROR [2/2] RUN apt update && apt dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" 39.5s
------
> [2/2] RUN apt update && apt dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold":
#5 0.187
#5 0.189 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#5 0.189
#5 1.245 Get:1 http://mirrors.ocf.berkeley.edu/kali kali-rolling InRelease [30.5 kB]
#5 3.537 Get:2 http://mirrors.ocf.berkeley.edu/kali kali-rolling/contrib arm64 Packages [87.6 kB]
#5 3.732 Get:3 http://mirrors.ocf.berkeley.edu/kali kali-rolling/main arm64 Packages [17.5 MB]
#5 13.00 Get:4 http://mirrors.ocf.berkeley.edu/kali kali-rolling/non-free arm64 Packages [157 kB]
#5 17.95 Fetched 17.8 MB in 18s (1008 kB/s)
#5 17.95 Reading package lists...
#5 24.55 Building dependency tree...
#5 25.32 Reading state information...
#5 25.37 3 packages can be upgraded. Run 'apt list --upgradable' to see them.
#5 25.45
#5 25.45 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#5 25.45
#5 25.54 Reading package lists...
#5 31.98 Building dependency tree...
#5 32.76 Reading state information...
#5 32.84 Calculating upgrade...
#5 34.15 The following packages will be upgraded:
#5 34.15 kali-defaults libcrypt1 sysvinit-utils
#5 34.78 3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
#5 34.78 Need to get 593 kB of archives.
#5 34.78 After this operation, 1024 B of additional disk space will be used.
#5 34.78 Get:1 http://mirrors.ocf.berkeley.edu/kali kali-rolling/main arm64 sysvinit-utils arm64 2.96-7 [25.1 kB]
#5 34.90 Get:2 http://mirrors.ocf.berkeley.edu/kali kali-rolling/main arm64 libcrypt1 arm64 1:4.4.18-2 [89.4 kB]
#5 34.98 Get:3 http://mirrors.ocf.berkeley.edu/kali kali-rolling/main arm64 kali-defaults all 2021.2.3 [479 kB]
#5 36.16 debconf: delaying package configuration, since apt-utils is not installed
#5 36.34 Fetched 593 kB in 1s (536 kB/s)
(Reading database ... 6748 files and directories currently installed.)
#5 36.53 Preparing to unpack .../sysvinit-utils_2.96-7_arm64.deb ...
#5 36.55 Unpacking sysvinit-utils (2.96-7) over (2.96-6) ...
#5 36.76 Setting up sysvinit-utils (2.96-7) ...
(Reading database ... 6748 files and directories currently installed.)
#5 37.00 Preparing to unpack .../libcrypt1_1%3a4.4.18-2_arm64.deb ...
#5 37.03 Unpacking libcrypt1:arm64 (1:4.4.18-2) over (1:4.4.17-1) ...
#5 37.23 Setting up libcrypt1:arm64 (1:4.4.18-2) ...
(Reading database ... 6748 files and directories currently installed.)
#5 37.47 Preparing to unpack .../kali-defaults_2021.2.3_all.deb ...
#5 37.89 Unpacking kali-defaults (2021.2.3) over (2021.2.2) ...
#5 38.28 Setting up kali-defaults (2021.2.3) ...
#5 38.58 Configuring /etc/environment
#5 38.75 Processing triggers for libc-bin (2.31-9) ...
#5 38.81 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#5 39.02 Segmentation fault (core dumped)
#5 39.04 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#5 39.25 Segmentation fault (core dumped)
#5 39.26 dpkg: error processing package libc-bin (--configure):
#5 39.26 installed libc-bin package post-installation script subprocess returned error exit status 139
#5 39.27 Errors were encountered while processing:
#5 39.27 libc-bin
#5 39.34 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
Dockerfile:7
Run Code Online (Sandbox Code Playgroud)
如果我切换arm64到arm/v7. 我尝试从正在运行且没有任何问题的 Raspberry Pi 构建相同的 Dockerfile arm64,因此它肯定与 qemu 有关,但只是不确定是什么。
看来这与内核中的一个错误有关。我能找到的最好的解释是https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1928075。在这次讨论中引用克里斯蒂安·埃尔哈特的话:
我见过类似的问题,例如由于较新的 glibc(可能是任何其他程序甚至客户内核)使用较新的指令,从而触发仿真中存在的问题。
我不确定,但这让我想到内核可能是相关的。嗯,这不是系统虚拟化,它是一种模拟,因此机会比平常低得多,但可能值得一试。
我遇到了同样的问题,并尝试了很多不同的用户空间组合(即不同版本的 Qemu、不同的 Debian 容器),但均无济于事。解决这个问题的唯一方法确实是运行一个足够新的内核。5.10.0-8-amd64我现在使用的是 Debian 内核并且它可以工作。
你尝试过什么内核?
| 归档时间: |
|
| 查看次数: |
4979 次 |
| 最近记录: |