Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading configuration: fork/exec /build/packer-plugin-arm-image: exec format error #124

Closed
mikemorris opened this issue Dec 28, 2021 · 5 comments

Comments

@mikemorris
Copy link

mikemorris commented Dec 28, 2021

I'm trying to get this plugin to run on macOS, and I'm hitting the following error on both the Vagrant and Docker build options documented in the README.

    default:  Error loading configuration:
    default:
    default: fork/exec /root/.packer.d/plugins/packer-plugin-arm-image: exec format error
docker run \
        --rm \
        --privileged \
        -v /dev:/dev \
        -v {$PWD}:/build:ro \
        -v {$PWD}/packer_cache:/build/packer_cache \
        -v {$PWD}/output-arm-image:/build/output-arm-image \
        -e PACKER_CACHE_DIR=/build/packer_cache \
        packer-builder-arm build samples/raspbian_golang.json
running /bin/packer
 Error loading configuration:

fork/exec /build/packer-plugin-arm-image: exec format error

The standalone build no longer works due to the switch from kpartx to losetup in #115. Is this perhaps an issue with a newer version of Packer config syntax, or a need to upgrade these plugins to use the new plugin SDK for Packer v1.7 and later?

@yuval-k
Copy link
Member

yuval-k commented Dec 28, 2021

do you have the new M1 mac? that might explain the difference in the exec format

@yuval-k
Copy link
Member

yuval-k commented Dec 28, 2021

if your mac is indeed M1 the solution might be to publish multi-arch docker images

@mikemorris
Copy link
Author

Nope, I'm on an Intel Mac running macOS Monterey 12.1 with Packer 1.7.8

@mikemorris
Copy link
Author

mikemorris commented Feb 12, 2022

This appears to actually just be an issue with where the binary built with go build is placed (not sure if it's a change in a newer version of Go and/or specific to macOS).

COPY --from=builder /build/packer-plugin-arm-image /bin/packer-plugin-arm-image
assumes the binary will be placed into ./build but on my machine it's instead placed into the repo root, not a subfolder. Moving the binary into the expected directory before building the Docker image avoids this issue.

mkdir build
mv packer-plugin-arm-image ./build
docker build -t packer-builder-arm .

@nfx
Copy link

nfx commented Jan 7, 2023

@mikemorris for fun i'm trying to enable native macOS support in #155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants