building custom iso’s with kiwi-ng using WSL2

Soo I had the fun to get this running in a full fletched openSuse VM,
but then my client wanted me to transfer this into a WSL instance - because reasons…
Context: not only suse images but ubunut as well

Since this was not running at all, here is what I fixed:

debootstrap error

Since the 15.4 openSuse version did come with debootstrap 1.24xxxx it had no support for ubuntu jammy.
TLDR: use the devel_tools repo and install 1.28
https://software.opensuse.org/download/package?package=debootstrap&project=devel%3Atools

missing debootstrap.log aka. debootstrap can not work out the architecture

[ ERROR   ]: 14:22:12 | KiwiBootStrapPhaseFailed: Bootstrap package installation failed: : logfile '/kiwi_workspace/mobios/build/image-root/debootstrap/debootstrap.log' does not exist[ INFO    ]: 14:22:12 | Cleaning up SystemPrepare instance

Running debootstrap manually to get to the error builder:/kiwi_workspace # debootstrap stable /stable-chroot http://deb.debian.org/debian/ E: Couldn’t work out current architecture now we’re getting somewhere
turns out it tries 3 things as of today.
See lines 538 and following

if in_path dpkg && \
    dpkg --print-architecture >/dev/null 2>&1; then
        HOST_ARCH=$(/usr/bin/dpkg --print-architecture)
elif in_path udpkg && \
    udpkg --print-architecture >/dev/null 2>&1; then
        HOST_ARCH=$(/usr/bin/udpkg --print-architecture)
elif [ -e "$DEBOOTSTRAP_DIR/arch" ]; then
        HOST_ARCH=$(cat "$DEBOOTSTRAP_DIR/arch")
fi
HOST_OS="$HOST_ARCH"

turns out the wsl2 openSuse didn’t had dpkg -> installed that -> works

missing package “ar”

/usr/share/debootstrap/functions: line 1011: ar: command not found

TLDR: “ar” is provided by binutils -> guess what was missing in the WSL2 instance

Read the logs.

I’ll aggregate all the relevant log lines even though they came from multiple reruns

bootstrap phase fails

[target-dir]/build/image-root.log

[ DEBUG   ]: 15:00:29 | bootstrap: E: Extracting .//var/cache/apt/archives/base-files_12ubuntu4_amd64.deb requires the zstdcat command, which is not available
[ DEBUG   ]: 15:05:00 | bootstrap: E: Extracting .//var/cache/apt/archives/dpkg_1.21.1ubuntu2_amd64.deb requires the xzcat command, which is not available

yay more missing stuff

zypper install zstd xz permissions

image build fails

[ ERROR   ]: 15:27:06 | KiwiCommandNotFound: Command "qemu-img" not found in the environment
[ ERROR   ]: 15:44:56 | KiwiCommandNotFound: Command "sgdisk" not found in the environment
[ ERROR   ]: 15:55:27 | KiwiCommandNotFound: Command "mkdosfs" not found in the environment
[ ERROR   ]: 16:10:52 | KiwiCommandNotFound: Command "mkfs.ext4" not found in the environment
[ ERROR   ]: 16:19:36 | KiwiCommandNotFound: Command "mksquashfs" not found in the environment
[ ERROR   ]: 16:39:19 | KiwiIsoToolError: xorriso tool not found

are resolved by

zypper install qemu-tools gptfdisk dosfstools  util-linux e2fsprogs squashfs xorriso