Skip to content

MacOS M4 having difficulty with building arm architecture with 4096M (works with 3000) and accel=tcg need to use hvf #1627

@BuhtigithuB

Description

@BuhtigithuB

Version

packer 1.14.0

qemu :

qemu-system-aarch64 --version
QEMU emulator version 10.0.3
Copyright (c) 2003-2025 Fabrice Bellard and the QEMU Project developers

We an older version
"[unreleased] (2024-05-23)"

But I just test with
Bento 4.2 latest does the same

Environment

MacOS M4

Scenario

packer is launch like this :

build -only=qemu.vm -var-file=os_pkrvars/rockylinux/rockylinux-9-aarch64.pkrvars.hcl ./packer_templates

packer generates this command :

2025/08/25 17:28:35 packer-plugin-qemu_v1.1.4_x5.0_darwin_arm64 plugin: 2025/08/25 17:28:35 Executing /opt/homebrew/bin/qemu-system-aarch64: []string{"-device", "virtio-net,netdev=user.0", "-smp", "2", "-boot", "strict=off", "-vnc", "127.0.0.1:82", "-cpu", "host", "-name", "rockylinux-9.6-aarch64", "-machine", "type=virt,accel=tcg", "-netdev", "user,id=user.0,hostfwd=tcp::2637-:22", "-m", "4096M", "-drive", "file=builds/build_files/packer-rockylinux-9.6-aarch64-qemu/rockylinux-9.6-aarch64,if=virtio,cache=writeback,discard=ignore,format=qcow2", "-drive", "file=./packer_templates/../builds/iso/rockylinux-9.6-aarch64-55927350.iso,media=cdrom", "-drive", "file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,if=pflash,unit=0,format=raw,readonly=on", "-drive", "file=builds/build_files/packer-rockylinux-9.6-aarch64-qemu/efivars.fd,if=pflash,unit=1,format=raw"}

2025/08/25 17:28:35 packer-plugin-qemu_v1.1.4_x5.0_darwin_arm64 plugin: 2025/08/25 17:28:35 Qemu stderr: qemu-system-aarch64: Addressing limited to 32 bits, but memory exceeds it by 1073741824 bytes

[What you are trying to achieve and you can't?]

Steps to Reproduce

Download the latest version unzip it and run :

build -only=qemu.vm -var-file=os_pkrvars/rockylinux/rockylinux-9-aarch64.pkrvars.hcl ./packer_templates

Expected Result

With these commands we get qemu starts but it hang there we connected with vnc to the qemu and it waits for following instructions, I think we lack the proper efi intialization that bento does to get further than that...

mkdir -p builds/build_files/packer-rockylinux-9.6-aarch64-qemu/

qemu-img create -f qcow2 builds/build_files/packer-rockylinux-9.6-aarch64-qemu/rockylinux-9.6-aarch64 65536M

qemu-system-aarch64
-netdev user,id=user.0,hostfwd=tcp::2847-:22
-cpu host
-name rockylinux-9.6-aarch64
-device virtio-net,netdev=user.0
-drive file=builds/build_files/packer-rockylinux-9.6-aarch64-qemu/rockylinux-9.6-aarch64,if=virtio,cache=writeback,discard=ignore,format=qcow2
-drive file=./packer_templates/../builds/iso/rockylinux-9.6-aarch64.iso,media=cdrom
-bios /opt/homebrew/share/qemu/edk2-aarch64-code.fd
-machine type=virt,accel=hvf
-vnc 127.0.0.1:97
-m 3000
-smp 2
-boot strict=off

Actual Result

pkr-source.pkr.hcl

Replacing line 181 4096 by 3000 lead us to the same stage than the previous CLI commands

I think it needs to use accel=hvf acceleration to work, but there is no trace of that parameters in the code base and the acceleration is set to accel=tcg

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UntriagedAn issue that has yet to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions