【问题标题】:Failure running podman with systemd on containerized emulated Raspbian distro在容器化的模拟 Raspbian 发行版上使用 systemd 运行 podman 失败
【发布时间】:2020-05-27 11:08:56
【问题描述】:

动机:

我想要一个完全模拟 Raspbian Buster 操作系统的容器化开发环境。就使用 Node.js 开发我们的客户端/服务器软件而言,我已经准备好了 - 但我们的最终产品依赖于 SystemD 服务,如果不需要启动 Pi,就可以在我自己的笔记本电脑上舒适地开发这些服务连接到触摸屏或 VNC 服务器等。

背景(带有重现步骤):

我正在使用以下 shell 脚本构建一个容器,其中包含使用 qemu-arm-static 修改的最新 Raspbian 发行版,以在 x86-64 机器上模拟 armv7l:

#!/bin/bash
#
#  Modified script
#  Original by jguiraudet
#  Create a podman image raspbian distribution image for raspberry-pi
#
# Change the SRC path if needed:
SRC=https://downloads.raspberrypi.org/raspbian_full_latest

set -e
sudo echo Info: Need root access to mount the image to extract the content
mkdir raspbian-tmp
cd raspbian-tmp
echo Download image...
wget --trust-server-names $SRC
unzip *.zip && rm *.zip
DISK_IMG=$(ls *.img | sed 's/.img$//')
OFFSET=$(fdisk -lu $DISK_IMG.img | sed -n "s/\(^[^ ]*img2\)\s*\([0-9]*\)\s*\([0-9]*\)\s*\([0-9]*\).*/\2/p")
mkdir root
sudo mount -o loop,offset=$(($OFFSET * 512)) $DISK_IMG.img root
# Disable preloaded shared library to get everything including networking to work on x86
sudo mv root/etc/ld.so.preload root/etc/ld.so.preload.bak

# Copy qemu-arm-static in the image be able to interpret arm elf on x86
if /usr/bin/qemu-arm-static -version | grep 4.2.0; then
    # Fix crash with `tcg.c:1693: tcg fatal error` by using a more recent version
    wget https://github.com/multiarch/qemu-user-static/releases/download/v4.2.0-4/qemu-arm-static
    chmod 755 ./qemu-arm-static
    sudo cp ./qemu-arm-static root/usr/bin
else
    sudo cp /usr/bin/qemu-arm-static root/usr/bin
fi

# Create podman images
cd root
sudo tar -c . | sudo podman import - localhost/spidercatnat/raspbian-full-for-x86_64:podman
cd ..

# Clean-up
sudo umount root
rmdir root
rm $DISK_IMG.img
sudo podman images | grep raspbian

我想在这个容器中运行 systemd,遇到了 podman(之前使用的是 Docker)。尝试使用 podman run -ti --rm localhost/spidercatnat/raspbian-full-for-x86_64:podman /sbin/init 运行容器失败,即使以 root 身份运行:

systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
Detected virtualization container-other.
Detected architecture arm.

Welcome to Raspbian GNU/Linux 10 (buster)!

Set hostname to <07472ad095c9>.
Initializing machine ID from random generator.
Failed to enqueue loopback interface start request: Operation not supported
Caught <ILL>, dumped core as pid 8.
Exiting PID 1...

我不明白为什么会发生这种情况,也不明白如何进一步追踪这个错误。为什么投反对票?如何在启用 systemd 的情况下运行此映像?

【问题讨论】:

    标签: linux bash docker containers podman


    【解决方案1】:

    请在https://github.com/containers/libpod/ 上打开一个问题,以便我们在那里查看。

    【讨论】:

      猜你喜欢
      • 2016-12-09
      • 2020-06-15
      • 2021-11-30
      • 2017-01-05
      • 2017-12-08
      • 1970-01-01
      • 2021-11-01
      • 1970-01-01
      • 2018-10-09
      相关资源
      最近更新 更多