Package: vmdb2 Version: 0.26-1 Severity: normal Tags: patch X-Debbugs-CC: l...@liw.fi
Dear Maintainer, I was trying to create an arm64 image with GRUB and UEFI from my amd64 laptop, using the attached definition. It would fail at the GRUB install phase, and the error message was saying that it was trying to install grub-efi-amd64 even though I was creating an arm64 image. I then noticed that the debootstrap plugin was not setting the architecture globally, what caused the grub plugin to not use the correct architecture. The attached patch fixes this. -- System Information: Debian Release: bookworm/sid APT prefers testing-debug APT policy: (900, 'testing-debug'), (900, 'testing'), (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 5.19.0-2-amd64 (SMP w/4 CPU threads; PREEMPT) Kernel taint flags: TAINT_WARN Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8), LANGUAGE=pt_BR:pt:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages vmdb2 depends on: ii cmdtest 0.32.14.gcdfe14e-4 ii debootstrap 1.0.127+nmu1 ii e2fsprogs 1.46.6~rc1-1 ii kpartx 0.9.0-4 ii parted 3.5-2 ii python3 3.10.6-1 ii python3-jinja2 3.0.3-2 ii python3-yaml 5.4.1-1+b2 ii qemu-utils 1:7.1+dfsg-2 Versions of packages vmdb2 recommends: ii ansible 6.4.0+dfsg-1 ii dosfstools 4.2-1 ii qemu-user-static 1:7.1+dfsg-2 vmdb2 suggests no packages. -- no debconf information
# This is a sample VMDB2 input file that specifies a simple system for # an arm64 machine that boots with UEFI. steps: - mkimg: "{{ output }}" size: 1G - mklabel: gpt device: "{{ output }}" - mkpart: primary device: "{{ output }}" start: 0% end: 20M tag: efi - mkpart: primary device: "{{ output }}" start: 20M end: 100% tag: / - kpartx: "{{ output }}" - mkfs: vfat partition: efi - mkfs: ext4 partition: / - mount: / - unpack-rootfs: / - debootstrap: bullseye variant: minbase arch: arm64 mirror: http://deb.debian.org/debian target: / unless: rootfs_unpacked - chroot: / shell: apt-get clean - apt: install packages: - wget - iproute2 - linux-image-arm64 - systemd-sysv fs-tag: / unless: rootfs_unpacked - copy-file: /etc/systemd/network/eth0.network src: eth0.network unless: rootfs_unpacked - chroot: / shell: systemctl enable systemd-networkd unless: rootfs_unpacked - cache-rootfs: / unless: rootfs_unpacked - chroot: / shell: | sed -i '/^root:[^:]*:/s//root::/' /etc/passwd echo arm64-uefi-vmdb2 > /etc/hostname - grub: uefi tag: / efi: efi console: serial # vim: ft=yaml
From 27aeb5717d0a12bb7660ff9ae54f122f22999250 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro <terce...@debian.org> Date: Fri, 14 Oct 2022 19:24:45 -0300 Subject: [PATCH] fix(debootstrap plugin): set architecture for later stages debootstrap takes an architecture argument, but does not propagate that to later stages of the image build. This causes, for example, the GRUB plugin to fail to install the correct packages when creating an images for a foreign archiecture. The call to dpkg --print-architecture to discover the native architecture is already done when state is first populated, so there is no need to do it again in the grub plugin. --- vmdb/plugins/debootstrap_plugin.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py index a28bf94..c96ed01 100644 --- a/vmdb/plugins/debootstrap_plugin.py +++ b/vmdb/plugins/debootstrap_plugin.py @@ -51,10 +51,8 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): install_keyring = values["install_keyring"] include = values["include"] require_empty = values["require_empty_target"] - arch = ( - values["arch"] - or subprocess.check_output(["dpkg", "--print-architecture"]).strip() - ) + arch = values["arch"] or state.arch + state.arch = arch variant = values["variant"] components = values["components"] @@ -113,3 +111,7 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): ] + remove_pkgs, ) + + def run_even_if_skipped(self, values, settings, state): + if values["arch"]: + state.arch = values["arch"] -- 2.35.1
signature.asc
Description: PGP signature