Hi, I also have an issue with libguestfs incorrectly detecting the host CPU architecture in Debian, when using the virt-customize command on a aarch64 machine.
E.g.: neyron@digarm:~/scm/environments-recipes/build/debian-buster-arm64$ virt-customize -a base_debian-buster-arm64.qcow2 --run-command "mkdir /test" [ 0.0] Examining the guest ... [ 11.1] Setting a random seed virt-customize: warning: random seed could not be set for this type of guest [ 11.2] Running: mkdir /test virt-customize: error: host cpu (x86_64) and guest arch (aarch64) are not compatible, so you cannot use command line options that involve running commands in the guest. Use --firstboot scripts instead. If reporting bugs, run virt-customize with debugging enabled and include the complete output: virt-customize -v -x [...] This seems due to the fact that the package is built with the ocaml mlstdutils/guestfs_config host_cpu set to "X86_64", whatever the actual system architechure is. Indeed, when rebuilding the arm64 package with the following patch included, virt-customize works as expected. --- libguestfs-1.40.2.orig/common/mlstdutils/guestfs_config.ml +++ libguestfs-1.40.2/common/mlstdutils/guestfs_config.ml @@ -22,4 +22,4 @@ let package_version = "1.40.2" let package_version_full = "1.40.2" let prefix = "/usr" let datadir = prefix ^ "/share" -let host_cpu = "x86_64" +let host_cpu = "aarch64" However this patch of course will break virt-customize on other archs !. My understanding is that this should be fixed in the packages rules, so that "@host_cpu@" is correctly set with regard to the target arch. But I did not find out how to do that for now. -- System Information: Debian Release: 10.1 APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable') Architecture: arm64 (aarch64) Kernel: Linux 4.19.0-6-arm64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8), LANGUAGE=en_US:en (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8) Shell: /bin/sh linked to /usr/bin/bash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages libguestfs-tools depends on: ii curl 7.64.0-4 ii libc6 2.29-3 ii libconfig9 1.5-0.4 ii libfuse2 2.9.9-1 ii libguestfs-perl 1:1.40.2-2+b12 ii libguestfs0 1:1.40.2-2+b12 ii libintl-perl 1.26-2 ii libjansson4 2.12-1 ii liblzma5 5.2.4-1 ii libpcre3 2:8.39-12 ii libreadline8 8.0-3 ii libstring-shellquote-perl 1.04-1 ii libsys-virt-perl 5.6.0-1+b1 ii libtinfo6 6.1+20181013-2+deb10u2 ii libvirt0 5.6.0-2 ii libwin-hivex-perl 1.3.18-2 ii libxml2 2.9.4+dfsg1-7+b3 Versions of packages libguestfs-tools recommends: ii gnupg 2.2.12-1+deb10u1 libguestfs-tools suggests no packages. -- no debconf information