hashipi

Raspberry Pi Test Cluster for HashiCorp Vault, Nomad and Consul
git clone https://git.in0rdr.ch/hashipi.git
Log | Files | Refs | Pull requests |Archive | README

commit 3117d70f396289164ff7f714d2d688ff576b6e1b
parent 24b5830126bf3795a86def2535e5dfc3ba8d796a
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Fri, 19 Sep 2025 21:54:38 +0200

fix: build on NixOS with preferStaticEmulators

* https://wiki.nixos.org/wiki/Podman#Run_cross-architecture_containers_with_binfmt/qemu
* https://github.com/NixOS/nixpkgs/issues/160300

Diffstat:
MREADME.md | 8+++++++-
Mhashi-pi.pkr.hcl | 6+++---
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md @@ -200,6 +200,7 @@ On NixOS, it is sufficient to [enable the binfmt wrapper in the configuration](https://wiki.nixos.org/wiki/NixOS_on_ARM/Building_Images): ``` boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; +boot.binfmt.preferStaticEmulators = true; ``` The wrapper on NixOS can be checked on this path: @@ -208,11 +209,16 @@ cat /proc/sys/fs/binfmt_misc/aarch64-linux ``` On NixOS, the interpreter is on this path (`hashi-pi.pkr.hcl`): -```bash +``` "qemu_binary_source_path": "/run/binfmt/aarch64-linux", "qemu_binary_destination_path": "/run/binfmt/aarch64-linux" ``` +Also, set the chroot env appropriately: +``` +image_chroot_env = ["PATH=/run/current-system/sw/bin:/run/current-system/sw/sbin:/usr/bin:/bin"] +``` + ## Run Packer Initialize required packer plugins: ```bash diff --git a/hashi-pi.pkr.hcl b/hashi-pi.pkr.hcl @@ -164,7 +164,7 @@ source "cross" "hashipi" { file_unarchive_cmd = ["xz", "-d", "$ARCHIVE_PATH"] file_urls = ["${var.img_url}"] image_build_method = "resize" - image_chroot_env = ["PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"] + image_chroot_env = ["PATH=/run/current-system/sw/bin:/run/current-system/sw/sbin:/usr/bin:/bin"] image_partitions { filesystem = "vfat" mountpoint = "/boot" @@ -184,8 +184,8 @@ source "cross" "hashipi" { image_path = "${var.img_name}" image_size = "${var.img_size}" image_type = "dos" - qemu_binary_destination_path = "/usr/bin/qemu-aarch64-static" - qemu_binary_source_path = "/usr/bin/qemu-aarch64-static" + qemu_binary_destination_path = "/run/binfmt/aarch64-linux" + qemu_binary_source_path = "/run/binfmt/aarch64-linux" } source "qemu" "hashiintel" {