Thanks to Apple’s Virtualization framework it is possible to use Rosetta 2 inside a Linux VM to run x86_64 applications.
All the videos and resources I’ve found online only explain how to install x86 applications using the apt package manager by appending :amd64
to the application name.
For example:
sudo apt install libx11-6:amd64
You also need to add the amd64 apt repositories such as described in the Github repository macOS-Linux-VM-with-Rosetta.
But I’m wondering, and I haven’t found an answer yet, how to execute x86_64 binaries that I have manually downloaded somewhere or compiled on my own, not through the apt registry.
I’m using Parallels 20.1.1 on an M1 Mac Pro running macOS 15.0.1, I have created a Ubuntu 22.04.2 VM with the Parallels Rosetta setting enabled.
I have also enabled Rosetta in my VM using the script provided by Parallels as described in Using Rosetta to run x86-64 Docker Containers and Binaries in Linux virtual machines with Parallels Desktop.
$ sudo ./rosetta_x86_sources.sh enable
$ sudo apt update
But when I execute a x86 binary inside this VM I get an error indicating that I’m running the wrong platform.
cannot execute binary file: Exec format error
how can I execute x86_64 binaries on a Linux VM with Rosetta 2?