Getting the error: bash: ./program: cannot execute binary file: Exec format error

You have a 64-bit x86 CPU (indicated by the lm flag in /proc/cpuinfo), but you’re running a 32-bit kernel. The program you’re trying to run requires a 64-bit runtime, so it won’t work as-is.

If you can find a 32-bit build of the program (or build it yourself), use that.

Alternatively, you can install a 64-bit kernel, reboot, and then install the 64-bit libraries required by your program.

To install a 64-bit kernel, run

sudo dpkg --add-architecture amd64
sudo apt-get update
sudo apt-get install linux-image-generic:amd64

This will install the latest 64-bit Xenial kernel, along with various supporting 64-bit packages. Once you reboot, you should find that uname -a shows x86_64 rather than i686. If you attempt to run your program again, it might just work, or you’ll get an error because of missing libraries; in the latter case, install the corresponding packages (use apt-file to find them) to get the program working.

Tags:

Linux

Bash

Ubuntu