Motivation:
I would like a containerized development environment that fully emulates the Raspbian Buster operating system. As far as developing our client/server software using Node.js goes, I'm set - but our end-product depends on SystemD services and it would be nice develop those from the comfort of my own laptop without needing to fire up a Pi connected to a touchscreen or VNC server, etc.
Background (with steps to reproduce):
I am using the following shell script to build a container with the latest Raspbian distro modified with qemu-arm-static to emulate armv7l on x86-64 machines:
#!/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
I want to run systemd inside this container, and came across podman (was previously using Docker). Attempting to run the container with podman run -ti --rm localhost/spidercatnat/raspbian-full-for-x86_64:podman /sbin/init
fails, even if running as 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...
I don't understand why this is happening or how I can trace this error further. Why the downvote? How can I run this image with systemd enabled?