Skip to content

Fix machine run ENOEXEC for amd64 machines on arm64 host#1847

Draft
iamvirul wants to merge 3 commits into
apple:mainfrom
iamvirul:fix/amd64-machine-run-exec-format-error
Draft

Fix machine run ENOEXEC for amd64 machines on arm64 host#1847
iamvirul wants to merge 3 commits into
apple:mainfrom
iamvirul:fix/amd64-machine-run-exec-format-error

Conversation

@iamvirul

Copy link
Copy Markdown

Type of Change

  • Bug fix

Motivation and Context

Fixes #1843.

MachinesService.boot() calls ClientKernel.getDefaultKernel(for: .current) when no custom kernel path is configured. On Apple Silicon, .current resolves to .linuxArm, so AMD64 machines boot with the default-arm64 kernel binary instead of default-amd64.

The two are distinct binaries. The default-amd64 kernel is compiled with the Rosetta and binfmt_misc support required to run AMD64 userspace on ARM64 hosts. Without it, non-root exec processes fail with ENOEXEC (errno=8) when attempting to run AMD64 binaries through the binfmt_misc handler.

This is why the machine itself boots (PID 1 runs as root, unaffected) but container machine run -n ubuntu uname fails (uses the host user uid, which is non-root).

The custom kernel path branch in the same function already handled this correctly via self.systemPlatform(from: state.snapshot.configuration.platform). The default kernel path branch was inconsistent with it.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Reproduced with the steps in #1843 and confirmed container machine run -n ubuntu uname -a succeeds after the fix.

@iamvirul iamvirul marked this pull request as draft June 27, 2026 14:07
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

Successfully merging this pull request may close these issues.

[Bug]: Can't run amd64 container machine on Apple Silicon

1 participant