So you’re trying to run a program on your Linux machine, and BAM… you get the dreaded message:
“Cannot execute binary file: Exec format error”
Yikes. What does that even mean?
Relax! It sounds technical, but it actually boils down to something pretty simple.
What Does That Error Mean?
This error usually means your system is trying to run a file that it doesn’t understand. It’s like handing a Blu-ray disc to a cassette player. Wrong format. Doesn’t compute.
Your operating system sees that file as a program, but when it tries to run it, it finds out…
- It’s the wrong type for your CPU
- It might be corrupted
- It’s not even a runnable file to begin with
Let’s break it down into fun-size chunks so your brain doesn’t want to run away.
Why This Happens
There are three main reasons this error pops up:
- Wrong architecture. You’re trying to run a file made for a different CPU type. For example, an ARM program on an x86 machine.
- No execute permission. The file isn’t marked as “executable.” Your system stops it from running.
- Corrupted or wrong file. You downloaded the wrong thing or it got messed up somehow.

Common Mistake: Mixing Up Platforms
One day, you might download an app for a Raspberry Pi that you try to run on your laptop. That’s a classic setup for this error.
Your laptop’s processor is probably x86_64. The Raspberry Pi uses ARM. They speak different machine languages.
Trying to run a binary meant for another platform is like feeding your dog a cat instruction manual. That’s not how any of this works.
Let’s Find the Problem
Time for a little detective work. Use the file
command to sniff out what kind of binary you’re trying to run:
file ./your-program
You’ll get something like:
your-program: ELF 64-bit LSB executable, ARM, version 1 ...
If your computer isn’t ARM-based, you’ve already solved the mystery.
Solutions — The Fun Part!
Let’s go step by step through fixing this baby.
1. Check the Architecture
Use this to check your system’s CPU type:
uname -m
Common outputs:
- x86_64 — You’ve got a 64-bit Intel/AMD
- armv7l or aarch64 — You’re on an ARM machine
Now compare that with your binary using the file
command from earlier.
If they don’t match, that’s your issue!
Fix It:
- Download the correct version of the program. Make sure the binary matches your CPU.
- Try using an emulator. For example, on x86 you can use
qemu
to run ARM binaries.
Example using QEMU:
sudo apt install qemu-user
qemu-arm ./your-program
2. Check If the File Is a Script (and Not a Binary!)
Maybe the file is a shell script or Python script and doesn’t have a proper shebang line (#!/bin/bash
or #!/usr/bin/python3
).
Open it in a text editor:
nano ./your-program
If you see readable text with no path at the top, add the right shebang at the top and try again.
Fix It:
Add a line like this at the top of the file:
#!/bin/bash
Then save it and make it executable:
chmod +x ./your-program
Now try to run it again.
3. Make Sure It’s Executable
Maybe the file is just shy and doesn’t want to run. Check permissions!
ls -l ./your-program
Look for that little “x” in the permission line. If it’s not there, run:
chmod +x ./your-program
Now it should have no excuse to not run (unless there’s still a format mismatch).
4. It Might Not Even Be a Runnable File 😅
If you’re trying to run, say, a JPEG or a PDF file as a binary… um. Don’t.
Use the file
command again to be sure. If it says “JPEG image data” instead of “ELF executable,” you’ve found your problem.
Tip: Not every file can be run. Make sure you’re not asking a piece of music to solve a math equation.
More Weird Scenarios
Trying to Run 32-bit on a Modern System?
Some newer Linux systems don’t come with 32-bit support by default. If your binary is 32-bit and your OS is 64-bit, you’ll need support packages.
sudo apt install libc6-i386
This will let you run lots of older or small binaries.
Using Docker or a Virtual Machine?
Docker containers must match the CPU architecture of the host machine. If you’re downloading a prebuilt container, make sure it’s for the right platform.
You can use the --platform
flag with Docker if need be:
docker run --platform linux/arm64 mycontainer
Worst Case: Rebuild from Source
If you absolutely must run a file on your platform and the binary doesn’t match, you may need to compile it from the source code.
Look for instructions like:
./configure
make
sudo make install
This allows your system to compile a version of the software that it understands—your perfect match!
Warning: You’ll need all the developer tools installed, like build-essential or gcc.
Bonus Tip: Use a VM to Emulate Another System
Pretending to be another system? Virtual Machines are your friend!
Apps like VirtualBox or Vagrant let you set up a totally different machine on your PC. Build it exactly how the binary wants it.
Still easier than shouting at your screen.
Wrap Up
To sum it up: this error is trying to stop you from doing something silly—or something the computer physically can’t do.
Here’s your checklist:
- Check architecture with
uname -m
- Scan the file with
file <filename>
- Confirm the file is actually executable
- Make sure it’s not a script missing a shebang
- Download the right version for your platform
And remember… some problems are just a chmod +x
away!
Happy coding!