bash: ./program: cannot execute binary file: Exec format error
Solution 1:
You're trying to run an executable compiled for an ARM architecture on an x86-64 architecture, which is much like asking your processor who only speaks English to take directions in Chinese.
If you need to run that executable you have two choices:
Get an x86-64 version of the executable (by any mean; if you're unable to get an x86-64 version of the executable but you're able to get its source code, you can try to recompile it on the virtual machine);
Install Ubuntu Server for ARM in place of Ubuntu 14.04.2 (amd64). This requires either a physical machine running on an ARM architecture or a virtualization software that can emulate it.
Solution 2:
This can also occur if you attempt to run an x86-64 executable on a 32-bit platform.
In one specific instance, I downloaded Visual Studio Code and tried to run it on my Ubuntu installation, but I hadn't realized that I had installed 32-bit Ubuntu in this VM. I got this error, but after downloading the 32-bit version, it ran without issue.
Solution 3:
It is often possible to run an ARM executable image on an amd64 system if you install the binfmt-support , qemu , and qemu-user-static packages:
sudo apt install binfmt-support qemu qemu-user-static
qemu
will then perform syscall emulation when you run the executable. This works for most ARM binaries but there are a few that may not run correctly.
Solution 4:
Such error may occur if all of the following are true:
- Executable is not a file but a link
- You run run it inside VM
- File is located in shared folder
- Your host is Windows.
If you got that file, let's say, in archive - try to unpack it inside VM, in some directory inside virtual drive, not folder mapped to your host machine hard drive, for example /myNewDir/