I’m trying to run a program, but it gives an error:
bash: ./program: cannot execute binary file: Exec format error
The result of file program
was:
program: ELF-32-bit LSB executable, ARM, EABI4 version 1 (SYSV), dynamically linked (uses share libs), for GNU/LINUX 2.6.16, not stripped
How can I fix this?
I’m using Ubuntu 14.04.2 (amd64) with VMware. I also tried using Ubuntu i386, but the result was the same.
asked Jul 15, 2015 at 5:30
Soongeun HwangSoongeun Hwang
1,5012 gold badges9 silver badges4 bronze badges
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.
answered Jul 15, 2015 at 5:39
1
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.
answered Sep 10, 2015 at 23:44
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.
answered Oct 27, 2016 at 6:41
Nathan OsmanNathan Osman
31.7k40 gold badges176 silver badges259 bronze badges
2
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/
wjandrea
13.8k4 gold badges46 silver badges95 bronze badges
answered Nov 13, 2015 at 22:22
PavelPavel
3531 gold badge3 silver badges10 bronze badges
1
If more than one java
is installed on the system this might happen and not set as default. On Ubuntu14.04 LTS I could get it resolved by executing following and choosing the java
I needed.
sudo update-alternatives --config java
[sudo] password for user:
update-alternatives: warning: /etc/alternatives/java has been changed (manually or by a script); switching to manual updates only
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode
I choose 2 and set openjdk-8
as a default. Which did not show the Exec format error
.
Videonauth
32.7k16 gold badges103 silver badges119 bronze badges
answered Jun 6, 2016 at 13:43
You must compile your file using an appropriate CPU architecture (x86 for example) and copy the .exe file on your linux machine. Then you can install mono on your linux machine and issue the following command:
mono myprogram.exe
muru
189k52 gold badges460 silver badges711 bronze badges
answered Feb 28, 2016 at 19:49
1
This can also happen if the binary uses a libc implementation which is not libc, such as musl. These days this specific problem is most likely encountered when trying to run a binary with libc in a Docker container with an image based on alpine. There is nothing that can be done to the binary itself to support both environments, because the libc implementation must always be linked statically, i.e. built directly into the binary, for reasons.
answered Jul 16, 2019 at 16:44
I got this error trying to run a zip file containing an executable rather than extracting it and running the executable itself xD
In addition to the other answers offered here, I suppose there would be a lot of file types that aren’t intended to be executable which could cause this error.
answered May 19, 2020 at 6:05
1
This is another special case: WSL (Windows Subsystem for Linux) by default(!) only supports 64bit executables. I think this is a rather unusual behaviour, as normally there is a backwards compatibility.
(Even more special is that selecting 64bit in a formerly 32bit project of Windev won’t fix your issue. You need to start a new project, selecting 64bit right in the beginning. Tested on Windev 26. This IDE sucks, forced to use it because of working legacy code.)
answered Jul 21, 2022 at 23:23
PythoNicPythoNic
6761 gold badge5 silver badges15 bronze badges
2
Содержание
- How to Fix ‘cannot execute binary file: Exec format error’ on Ubuntu
- Method 1: Using the arch Command
- Method 2: Using the file Command
- Решение проблемы с ошибкой «bash: не удаётся запустить бинарный файл: Ошибка формата выполняемого файла»
- О разрядности дистрибутивов Linux и о программ
- Запуск ARM файлов в Linux
- Заключение
- 🛠️ Исправление ошибки «Exec format» при запуске скриптов командой run-parts
- Решение ошибки «Exec format» при запуске скриптов командой run-parts
- How to fix Cannot execute binary file: exec format error?
- Check the architecture
- Check the file
- Install GCC and Gfortran
- Uncompress the file
- Check file permissions
- Use Dos2unix
How to Fix ‘cannot execute binary file: Exec format error’ on Ubuntu
While it shouldn’t happen when using the official apt-get repositories, if you download software off the Internet and run it then there’s a chance that you’ll see the dreaded bash: ./nameOfProgram: cannot execute binary file: Exec format error. This error, which is usually followed by bash: ./nameOfProgram.sh: Permission denied or something like it, indicates that Ubuntu wasn’t able to interface correctly with the binary you downloaded. This is because while it’s apparently a valid Linux binary, it’s designed for a different chipset than your kernel currently supports.
Most people using Ubuntu are on 32-bit or 64-bit processors based around a standard architecture that Intel released, regardless of who actually made their microchips. It’s important to remember that 64-bit processors can run in 32-bit mode, so if you’re getting this error even though you have a 64-bit processor there’s a chance you’re running a 32-bit version of Ubuntu. A few simple commands are all it takes to tell what your chip is operating as.
Method 1: Using the arch Command
If you’re not familiar with the type of microprocessor that you have installed on your machine, then you’ll first want to use the arch command from the command line. You’ll only see a single line of output returned to you after running this command. In many cases, you’ll see i686, which means that you’re on a 32-bit processor and therefore can’t run x86_64 binaries. If you instead see amd64 or something similar, then you’re on an x86_64 processor, and should at least theoretically be able to run most 32-bit and 64-bit binaries. Unlike Microsoft Windows, Ubuntu Linux actually contains the proper tools to permit users of 644-bit chipsets to run 16-bit Windows programs in their operating system in many cases as well.
These terms are still true even if you’re not actually using that particular model of microchip. For instance, i686 is how Linux refers to many 32-bit processors even if they aren’t actually Intel 80686 chips. Even if you’re using 64-bit Intel technology, arch might still call your processor an amd64 chip. This doesn’t indicate an error, and can be safely ignored. You can use cat /proc/cpuinfo or more /proc/cpuinfo to find out the exact type of processor you’re using. Since the lines in this file are long, you might want to push F11 before issuing it if you’re using a graphical terminal window. Users of a virtual console, especially those working with Ubuntu server, won’t have to worry quite as much.
You may see some other types of output, which might further restrict your options when it comes to running software. Ubuntu supported PowerPC architecture for the longest time, which is found in some workstations as well as many Classic Macintosh and older OS X Macintosh machines. You can actually still find Ubuntu repositories for these architectures, though they receive little support today. However, you more than likely won’t be able to run many Linux binaries you download from the Internet outside of the official repositories in this case. That doesn’t mean that Ubuntu doesn’t work on these machines, though you may want to look at the lighter Lubuntu distribution.
Method 2: Using the file Command
The file command identifies what different files contain, and it’s usually very accurate. Try identifying the file in question by typing file nameOfProgram to see if you get ELF 32-bit or ELF 64-bit as output. If it tells you that it’s an ELF 64-bit binary and you received i686 as output from the arch command, then there’s no way you can reasonably run it on your machine. If you’re on a 64-bit microprocessor running 32-bit Ubuntu, then you could technically reinstall the operating system, though this is a bit of an extreme step in order to run a single program.
There is also the very real possibility, however slight, that you might instead come across a binary that when you attempt to run it spews out junk characters to the terminal even if you’ve run a malware scan on it. These characters usually take the form of either lozenge-shaped blocks, or alternatively rectangular cubes that have numerical values in them. Some computer scientists call the latter tofu, and represent the Unicode values of characters that your currently installed typefaces won’t be able to display. If the terminal is displaying them like this, then you can rest assured that this is neither a font error nor anything having to do with malware. Rather, this is simply because the compiled microprocessor opcode inside of the binary is so alien to your system that it doesn’t know how to interpret some of the code.
The best way to fix this is to install the proper package for your architecture. If you’re installing packages from inside Ubuntu, then the apt-get system or the graphical Synaptic manager has you covered without any problems. If you’re downloading packages from another distribution, then you’ll need to find the right one for your architecture. Take, for example, Arch Linux’s listing of the gvim package. While the default package features the x86_64 architecture, there’s also one for the i686 chipset. This one will work on 32-bit machines that work with the Intel interrupt structure, but remember that the terms i686 and 32-bit are not mutually inclusive all the time since other chipsets Linux supports actually do feature their own 32-bit implementations.
Users exploring the whole GNU/Linux scene might come across binaries compiled for far more exotic technologies than these. Linux is truly a cross-platform code scene, so you’ll see OpenRISC, MIPS, SPARC, M32R, MN103, ARM, ARC, Alpha and many other standards binaries are compiled to work with. More than likely, you won’t be able to run any of these, though ARM is an extremely popular tablet and smartphone platform. It’s also the platform that the Raspberry Pi is based around, which means if you’re actually running Ubuntu on a mobile device or the Ubuntu MATE distribution for Raspberry Pi you’ll actually need these instead of Intel 32-bit or x86_64 binaries.
Источник
Решение проблемы с ошибкой «bash: не удаётся запустить бинарный файл: Ошибка формата выполняемого файла»
В операционной системе Linux при запуске скаченного файла, либо при запуске самостоятельно скомпилированного файла вы можете столкнуться с ошибкой:
Если у вас англоязычная локаль, то ошибка будет примерно такой:
bash: ./program: cannot execute binary file: Exec format error
В самой ошибке вместо /путь/до/файла и ./program будет указан путь до файла программы, который вы хотите запустить.
- Причинами данной ошибки могут быть:
- попытка запустить 64-битный файл на 32-битной системе
- файл скомпилирован для другой архитектуры (например, для ARM, а вы пытаетесь запустить его на ПК)
- вы пытаетесь выполнить не исполнимый файл, а ссылку
- файл размещён в совместной (shared) папке
Чтобы получить информацию о файле, который вы пытаетесь запустить, можно использовать утилиту file, после которой укажите путь до файла:
Здесь мы видим, что файл предназначен для 64-битной системы, об этом говорит запись 64-bit, для процессора с архитектурой x86-64.
Ещё один пример:
Этот файл для 32-битных систем, для процессора с архитектурой ARM EABI4.
Если вы не знаете, какой битности ваша система, то выполните команду:
Для 64-битных систем будет выведено x86_64, а для 32-битных – x86.
О разрядности дистрибутивов Linux и о программ
На компьютер с 32-битным процессором вы можете установить только 32-битную операционную систему и в ней запускать только 32-битные программы.
На компьютер с 64-битным процессором вы можете установить как 64-битную ОС, так и 32-битный Linux. В случае, если вы установили 64-битный дистрибутив Linux, то в нём вы можете запускать и 64-битные программы и 32-битные. А если вы установили 32-битный дистрибутив, то в нём возможно запускать только 32-битные программы.
Итак, если у вас 32-битная система, а файл для 64-битной системы или даже для ARM архитектуры, то у вас следующие варианты:
- скачать файл подходящей для вас битности и архитектуры
- если вы самостоятельно компилировали файл из исходного кода, то заново скомпилируйте для процессора вашей архитектуры
Запуск ARM файлов в Linux
Часто можно запустить исполнимые образы ARM на amd64 системах если установить пакеты binfmt-support, qemu, и qemu-user-static:
sudo apt install binfmt-support qemu qemu-user-static
Заключение
Итак, ошибка формата выполняемого файла с невозможностью запустить бинарный файл возникает из-за несоответствия программы операционной системе или архитектуре процессора. Эта проблема не должна возникать, если вы установили программу из исходных репозиториев (кроме случаев неправильной настройки источников репозитория). При возникновении этой проблемы поищите файл, подходящий для вашей архитектуры или скомпилируйте файл из исходных кодов под архитектуру вашей операционной системы.
Источник
🛠️ Исправление ошибки «Exec format» при запуске скриптов командой run-parts
Решение ошибки «Exec format» при запуске скриптов командой run-parts
Чтобы запустить все скрипты в папке «Documents», я запустил:
Я получил следующее сообщение об ошибке:
Bourne shell, или совместимый шеллl:
Bash:
Perl:
Python 2.x:
Python 3.x:
Это то, что мы называем шебанг.
Теперь вернемся к теме.
Отредактируйте ваши скрипты, используя ваш любимый редактор:
Добавьте шебанг в начале скрипта:
Теперь вы можете без проблем запускать скрипты с помощью команды run-parts, используя команду run-parts.
Вы также можете использовать утилиту ShellCheck для поиска проблем в своих скриптах оболочки.
- Аудит ИБ (49)
- Вакансии (12)
- Закрытие уязвимостей (105)
- Книги (27)
- Мануал (2 234)
- Медиа (66)
- Мероприятия (39)
- Мошенники (23)
- Обзоры (800)
- Обход запретов (34)
- Опросы (3)
- Скрипты (109)
- Статьи (336)
- Философия (99)
- Юмор (18)
Anything in here will be replaced on browsers that support the canvas element
Источник
How to fix Cannot execute binary file: exec format error?
Photo by Jivacore/Shutterstock.com
Linux has been reworked heavily since it first came out to the point that it’s no longer an OS for terminal kings. Just about everyone can use it now thanks to the much better user interfaces that we see in modern Linux distros. However, that doesn’t mean it can’t be frustrating at times.
In this article, we’re taking a look at the “cannot execute binary file: exec format error” issue and giving you a few solutions on how to get rid of the problem.
Check the architecture
The first thing you should do is ensure you’ve got the right bin file. Binary files made for 32-bit systems won’t work on 64-bit systems and vice-versa. You can check the architecture of any file by using the command below.
If the architecture doesn’t match between your file and the PC you’re running it on, try running the corresponding binary file for the matching architecture.
Check the file
Binary files can be run on Windows, Linux and macOS. However, binaries made for one OS won’t run on the others. Generally, these files have different file formats to help users distinguish between them. If you’re trying to run a binary file made for Windows on a Linux distro, it’s obviously not going to work.
If you must run the binary on Linux however, we recommend downloading Wine and using it to run the file. Wine is a compatibility layer capable of running Windows applications on POSIX-compliant operating systems, including Linux and macOS.
Install GCC and Gfortran
GCC and Gfortran are required for several binary files to compile and execute properly. You can install them by typing the command below in your terminal.
Now try running your binary file again and it should run without a problem — fixing the ‘cannot execute binary file’ error.
Uncompress the file
Sometimes binary files are compressed to make them easier to share over the internet. Try uncompressing the file to see if that helps you run it fine. Run the following commands on at a time.
Check file permissions
Another potential reason for your binary file not running could be that the user doesn’t have permission to change or read the file. You can fix this by typing the following command in the terminal.
Once the permissions are set, you can run the file by typing this.
Use Dos2unix
The Dos2unix command can sometimes help binaries made for DOS to run on UNIX systems. Try using the following command to see if your file runs or not.
If we’ve missed out on any fixes that helped you solve the ‘cannot execute binary file’ error, please comment down below with the fix.
Someone who writes/edits/shoots/hosts all things tech and when he’s not, streams himself racing virtual cars.
You can contact him here: [email protected]
Источник
Photo by Jivacore/Shutterstock.com
Linux has been reworked heavily since it first came out to the point that it’s no longer an OS for terminal kings. Just about everyone can use it now thanks to the much better user interfaces that we see in modern Linux distros. However, that doesn’t mean it can’t be frustrating at times.
In this article, we’re taking a look at the “cannot execute binary file: exec format error” issue and giving you a few solutions on how to get rid of the problem.
Also read: How to make a file executable in Linux?
Check the architecture
The first thing you should do is ensure you’ve got the right bin file. Binary files made for 32-bit systems won’t work on 64-bit systems and vice-versa. You can check the architecture of any file by using the command below.
file filename
If the architecture doesn’t match between your file and the PC you’re running it on, try running the corresponding binary file for the matching architecture.
Check the file
Binary files can be run on Windows, Linux and macOS. However, binaries made for one OS won’t run on the others. Generally, these files have different file formats to help users distinguish between them. If you’re trying to run a binary file made for Windows on a Linux distro, it’s obviously not going to work.
If you must run the binary on Linux however, we recommend downloading Wine and using it to run the file. Wine is a compatibility layer capable of running Windows applications on POSIX-compliant operating systems, including Linux and macOS.
Install GCC and Gfortran
GCC and Gfortran are required for several binary files to compile and execute properly. You can install them by typing the command below in your terminal.
sudo apt-get install gfortran && sudo apt-get install build-essential
Now try running your binary file again and it should run without a problem — fixing the ‘cannot execute binary file’ error.
Uncompress the file
Sometimes binary files are compressed to make them easier to share over the internet. Try uncompressing the file to see if that helps you run it fine. Run the following commands on at a time.
xz -d ./filename
chmod +x ./filename
./filename
Check file permissions
Another potential reason for your binary file not running could be that the user doesn’t have permission to change or read the file. You can fix this by typing the following command in the terminal.
chmod +x filename
Once the permissions are set, you can run the file by typing this.
./filename
Use Dos2unix
The Dos2unix command can sometimes help binaries made for DOS to run on UNIX systems. Try using the following command to see if your file runs or not.
dos2unix filename.bin
If we’ve missed out on any fixes that helped you solve the ‘cannot execute binary file’ error, please comment down below with the fix.
Also read: What does ./ mean in Linux?
Someone who writes/edits/shoots/hosts all things tech and when he’s not, streams himself racing virtual cars.
You can contact him here: [email protected]
An error while executing a binary file. It could mean something is wrong with the file. The most common cause of this error is an invalid format for the file. The most common error when trying to execute a binary file is the “exec format error.” It means that the computer does not recognize the file’s format.
There are many reasons why you might not execute a binary correctly. Still, the most common cause is if the file is not properly formatted. Suppose you’re having trouble executing a binary file. In that case, it’s best to consult an experienced software developer or computer technician for help. Executing a binary file can cause an exec format error. This error prevents the program from continuing execution and may require the user to delete or edit the binary file.
What is an exec format error?
The “cannot execute binary file exec format error” message is a warning that indicates that the file you are trying to open may not be executable. It is due to various issues, including incorrect file permissions or incomplete installation. If you experience this message, check the file’s properties to determine its status and try again if necessary.
Suppose you get an error when trying to execute a binary file in the exec format. In that case, there’s a good chance that the file is incompatible with your operating system. Here are four common reasons why a binary file might not work:
- They compile it for a different version of your OS.
- They create it with another compiler.
- The file is corrupt.
- The operating system doesn’t support executables in that format.
A binary file exec format error is a runtime error that can occur when trying to execute a binary file using the exec format. This error occurs when the binary file does not have the correct execution permissions or when it is corrupt.
Cannot execute binary file exec format error Chromebook
Chromebooks are known for their stability and ease of use. Still, a recent issue with binaries has caused some users to experience an “exec format error” on their devices. According to reports, this error prevents the Chromebook from executing specific binaries, including ones necessary for tasks such as accessing the internet and using software that requires a browser. While the error is not yet widespread, if you’re experiencing it, there are steps you can take to fix the problem.
Suppose you encounter a “cannot execute binary file exec format error” message when trying to open a file on your Chromebook. In that case, there are a few things you can try:
- Make sure the file is binary.
- Verify that your Chromebook’s execution environment is compatible with the file’s format.
- Check to see if the file is missing specific required files.
- After that, try using a different browser or operating system to open the file.
Chromebooks have a built-in file explorer that you can use to browse and open files. When you try to execute a binary file with the exec format, Chromebooks may give you a cannot execute binary file error. To solve this problem, you can use the built-in file explorer to open the file in a text editor, or you can use an external application.
Cannot execute binary file exec format error ubuntu on windows
Installing and using Ubuntu on a Windows computer can be daunting for even the most experienced computer user. Additionally, the installation process can be difficult if you encounter errors. One common error that users experience when installing Ubuntu is an “exec format error.” This error typically occurs when trying to execute a binary file using the exec format command. Unfortunately, this error is often difficult to troubleshoot and can prevent Ubuntu from installing on a Windows computer.
Windows users report an error when trying to execute a binary file in the exec format. According to Microsoft, this is a known issue, and they are investigating it. Until they find a resolution, Windows users can use the command line instead. If you are getting an error message like “Cannot execute binary file exec format error ubuntu on windows,” there is likely a problem with your installation. To solve this issue, follow these steps:
- Make sure you install the executable file on your system.
- Ensure that the path to the executable file is correct.
- Check to see if there are any compatibility issues with the executable file.
Adb cannot execute binary file exec format error.
This error can occur when you try to use the “adb exec” command to execute a binary file. The error occurs due to an incompatibility between your Android device and the binary file. To fix the problem, you need to upgrade your Android device or install a compatible version of the ADB tool.
This could be related to permissions or a missing dependency. If you are using adb on a device, ensure that you have the correct permissions and install any missing dependencies. This may be due to an incompatibility between your operating system and the binary. If you cannot fix the issue, you may need to find a different program to use for this specific task.
Final Words
Suppose you are getting an exec format error when trying to execute a binary file. In that case, there may be something preventing the program from running. Ensure the file is properly formatted and the program they install correctly. If all of those things are correct, you may need to consult your computer’s operating system documentation or search online for help resolving the issue.
В операционной системе Linux при запуске скаченного файла, либо при запуске самостоятельно скомпилированного файла вы можете столкнуться с ошибкой:
bash: /путь/до/файла: не удаётся запустить бинарный файл: Ошибка формата выполняемого файла
Если у вас англоязычная локаль, то ошибка будет примерно такой:
bash: ./program: cannot execute binary file: Exec format error
В самой ошибке вместо /путь/до/файла и ./program будет указан путь до файла программы, который вы хотите запустить.
- Причинами данной ошибки могут быть:
- попытка запустить 64-битный файл на 32-битной системе
- файл скомпилирован для другой архитектуры (например, для ARM, а вы пытаетесь запустить его на ПК)
- вы пытаетесь выполнить не исполнимый файл, а ссылку
- файл размещён в совместной (shared) папке
Чтобы получить информацию о файле, который вы пытаетесь запустить, можно использовать утилиту file, после которой укажите путь до файла:
file /путь/до/программы
Пример вывода:
program: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=03ada11d91d298913990bfc074ccc3a380d26b69, with debug_info, not stripped
Здесь мы видим, что файл предназначен для 64-битной системы, об этом говорит запись 64-bit, для процессора с архитектурой x86-64.
Ещё один пример:
program: ELF-32-bit LSB executable, ARM, EABI4 version 1 (SYSV), dynamically linked(uses share libs), for GNU/LINUX 2.6.16, not stripped
Этот файл для 32-битных систем, для процессора с архитектурой ARM EABI4.
Если вы не знаете, какой битности ваша система, то выполните команду:
uname -m
Для 64-битных систем будет выведено x86_64, а для 32-битных – x86.
О разрядности дистрибутивов Linux и о программ
На компьютер с 32-битным процессором вы можете установить только 32-битную операционную систему и в ней запускать только 32-битные программы.
На компьютер с 64-битным процессором вы можете установить как 64-битную ОС, так и 32-битный Linux. В случае, если вы установили 64-битный дистрибутив Linux, то в нём вы можете запускать и 64-битные программы и 32-битные. А если вы установили 32-битный дистрибутив, то в нём возможно запускать только 32-битные программы.
Итак, если у вас 32-битная система, а файл для 64-битной системы или даже для ARM архитектуры, то у вас следующие варианты:
- скачать файл подходящей для вас битности и архитектуры
- если вы самостоятельно компилировали файл из исходного кода, то заново скомпилируйте для процессора вашей архитектуры
Запуск ARM файлов в Linux
Часто можно запустить исполнимые образы ARM на amd64 системах если установить пакеты binfmt-support, qemu, и qemu-user-static:
sudo apt install binfmt-support qemu qemu-user-static
Заключение
Итак, ошибка формата выполняемого файла с невозможностью запустить бинарный файл возникает из-за несоответствия программы операционной системе или архитектуре процессора. Эта проблема не должна возникать, если вы установили программу из исходных репозиториев (кроме случаев неправильной настройки источников репозитория). При возникновении этой проблемы поищите файл, подходящий для вашей архитектуры или скомпилируйте файл из исходных кодов под архитектуру вашей операционной системы.
Понравиласть статья? Жми лайк или расскажи своим друзьям!
Похожие новости:
Linux (видео уроки) Обзор Linux видео уроки 1. Введение в ОС Linux/Unix Ubuntu. Видео linux уроки 2017 года. gnu linux operating system. Linux администрирование и linux уроки, linux скачать. To linux distros for 2017 and обзор linux mint 18 1.
Linux mint 19.1 (скачать) Развиваемый сообществом дистрибутив Linux mint, основанный на Ubuntu и Debian, который ставит целью предоставить пользователю «современную, элегантную и удобную операционную систему, которая одновременно является мощной и
Стала доступна для скачивания финальная версия Linux Mint 19 сразу со всеми основными вариантами рабочих столов: Cinnamon, MATE и Xfce. Если вы только начинаете знакомиться с удивительным миром Linux, то поясню: Cinnamon – это самый передовой и
Rosa Linux — Linux из России. ROSA Fresh. Сделана для дома. Создана для вас. ROSA Fresh — это современная отечественная операционная система Linux, создаваемая сообществом и легально доступная всем желающим совершенно бесплатно и без регистрации.
Иногда программа не запускается из-за отсутствия библиотеки определённой версии, при этом в системе может присутствовать эта самая библиотека, но другой версии. Чтобы было понятно, после одного из обновлений (в Arch Linux) перестал запускаться
Новая версия Deepin 15 включает в себя новый дизайн Центра Управления и компьютера, он имеет новый размытый и прозрачный стиль, также включены новые взаимодействия для угловой навигации и оконного менеджера наряду с выбором обоев рабочего стола,
Новые возможности в Linux Mint 19.3. Linux Mint 19.3 — это долгосрочный релиз поддержки, который будет поддерживаться до 2023 года. Он поставляется с обновленным программным обеспечением и приносит уточнения и множество новых функций, чтобы сделать
Linux Mint 19 – это релиз с длительной поддержкой до 2023 года. Он поставляется с обновлённым программным обеспечением и приносит усовершенствования и множество новых функций, чтобы сделать ваш рабочий стол более удобным. На момент написания, Linux
Linux Mint 18.1 Serena Cinnamon (Подробный обзор) Подробный обзор Beta версии Linux Mint 18.1 Serena Cinnamon Linux Mint команда объявила о выпуске обновления для 18.x филиала проекта. В новой версии, Linux Mint 18.1, доступен в двух версиях
Linux mint 18.2 Основные новшества Linux Mint 18.2 (MATE, Cinnamon, KDE и Xfce): В состав включены новые версии десктоп-окружений MATE 1.18 и Cinnamon 3.4, оформление и организация работы в которых продолжает развитие идей GNOME 2 — пользователю
Какой линукс выбрать? Какой linux лучше? Сегодня мы разберемся какие дистрибутивы линукс бывают и какой из них самый лучший. Первое что нужно понять: дистрибутивов линуксов очень много, больше 100. Но, как и в любой экосистеме, тут существует
Начало работы с btrfs для Linux. Файловая система B-tree — это файловая система и менеджер томов, объединенные в одно целое. Он предлагает много перспектив для доставки расширенного набора функций файловой системы в Linux.
Команда с гордостью объявляет о выпуске Linux Mint 20” Ulyana » Cinnamon Edition. Linux Mint 20-это долгосрочный релиз поддержки, который будет поддерживаться до 2025 года. Он поставляется с обновленным программным обеспечением и приносит
Linux Mint 20.2 Ума (Uma) Скачать. Самая большая новость в этом месяце-предстоящий выпуск Linux Mint 20.2 “Uma”. Мы надеемся, что БЕТА-версия будет готова к середине июня.
Новости Linux Январь 2017. НОВОСТИ LINUX, UBUNTU 2017 ЯНВАРЬ В Telegram появилась возможность удалить отправленное сообщения В мессенджере Telegram появилась возможность удалить отправленное сообщения. И если раньше оно удалялось только с одной
Обзор Solus 3 с рабочим окружением Budgie Этот релиз включает в себя из-из-коробки поддержка, универсальных программных пакетов для Linux. Поддержка снимков снимает давление со стороны поставщиков программного обеспечения для конкретной платформы,
Все три издания Linux Mint 19 (Cinnamon, MATE, Xfce) в настоящее время доступны для публичного тестирования. Официально новую бета версию планируют представить 4 июня 2018 года. Хотя перед началом публичных тестирования уже отловлено и исправлено
Преимущества и проблемы беспилотных летательных аппаратов БПЛА или беспилотный летательный аппарат представляет собой самолет с дистанционным управлением. Он может работать удаленно в режиме реального времени или запрограммирован для автономного
Новая ICQ (Windows, Linux, Mac, Web) Что нового: Mail Group представила обновленный мессенджер ICQ. Новая версия знаменитой «аськи» стала «умной, быстрой, гибкой». Разработчики добавили несколько интересных функций, которые
RFRemix 26 основанный на Fedora 26 (Russian Fedora) Официально объявили о выходе Fedora 26. Это проект по поддержке пользователей и разработчиков открытого ПО в России. Основная цель проекта — обеспечить, чтобы Fedora полностью отвечала
QEMU and binfmt support light the way
https://github.com/microsoft/wsl/issues/2468#issuecomment-374904520
After reading that the WSLInterop between WSL and Windows processes used binfmt, I was tinkering with QEMU to try some ARM development, and incidentally discovered how to get 32-bit support working.
Edit: requires «Fall Creators Update», 1709, build 16299 or newer
Install qemu and binfmt config:
sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic 'x7fELFx01x01x01x03x00x00x00x00x00x00x00x00x03x00x03x00x01x00x00x00' --mask 'xffxffxffxffxffxffxffxfcxffxffxffxffxffxffxffxffxf8xffxffxffxffxffxffxff'
You’ll need to reactivate binfmt support every time you start WSL:
sudo service binfmt-support start
Enable i386 architecture packages:
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gcc:i386
Try it out:
$ file /usr/bin/gcc-5
/usr/bin/gcc-5: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=2637bb7cb85f8f12b40f03cd015d404930c3c790, stripped
$ /usr/bin/gcc-5 --version
gcc-5 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc helloworld.c -o helloworld
$ ./helloworld
Hello, world!
$ file helloworld
helloworld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=3a0c7be5c6a8d45613e4ef2b7b3474df6224a5da, not stripped
And to prove it really was working, disable i386 support and try again:
$ sudo service binfmt-support stop
* Disabling additional executable binary formats binfmt-support [ OK ]
$ ./helloworld
-bash: ./helloworld: cannot execute binary file: Exec format error
Stuck with an annoying error of “Cannot execute binary file“? Then don’t worry. We will provide you with all the working ways which will help you in fixing the problem.
We will also discuss why did the error occurred and similar queries related to it.
Contents
- 1 What is a Binary file
- 2 How to resolve cannot execute binary file
- 2.1 Install GCC and Gfortran library
- 2.2 Unmatched Architecture
- 2.3 Download WienHQ for Ubuntu / MacOS
- 2.4 Provide the permission
- 2.5 Using dos2unix command
- 2.6 Uncompress the file
- 3 What is cannot execute binary file
- 4 Causes for cannot execute binary file
- 5 Fix: Cygwin cannot execute binary file
- 6 Java- Cannot execute binary file
- 7 FAQs on cannot execute binary file
- 7.1 How to execute a binary file in Powershell?
- 7.2 How to rectify “Cannot execute binary file”?
- 7.3 Fix: Bash cannot execute binary files.
- 7.4 Raspberry Pi cannot execute binary files.
- 8 Winding up
- 9 Trending Right Now
What is a Binary file
Binary means two. The two characters: 1, 0 are repeatedly used to store information and data. The text formats which use this binary format are known are binary format. A format can be changed to decimal, ASCII, BCD, or hexadecimal. We type in the ASCII format, but the computer interprets it in binary format.
A file that is written in binary format is known as a Binary file. The extension is “.bin“. These files can be executed in Linux by the syntax: “./file.bin“
How to resolve cannot execute binary file
Try using one of the following methods and check if the nuisance of binary file unable to execute is rectified or not:
Install GCC and Gfortran library
For Linux Operating Systems, type the below code in the PowerShell:
sudo apt-get install gfortran
For installing g++, GCC, and a few more libraries, use the following code:
sudo apt install build-essential
Check if the error is fixed.
Unmatched Architecture
Open the settings of your computer and check if your system is 32 bit or 64 bit.
Now execute this code to check the architecture format of the specific binary file:
file filename
Try downloading the 32 bt binary file from the internet, if available.
Download WienHQ for Ubuntu / MacOS
If you are trying to execute a binary file made through and for Windows Operating Systems, it may not work directly in your Unix systems. You will have to download a package that can transform an unmodified Windows binary to Unix usable ones.
Use the below link to download the WineHQ
https://wiki.winehq.org/Download
Provide the permission
One more reason for cannot execute a binary file is that the permission is not granted. To fix this, type the below in the PowerShell:
chmod +x filename
./filename
Using the sh command
Try the below syntax:
chmod +x filename.bin
sh filename.bin
Using dos2unix command
In Powershell, use the command:
dos2unix filename.bin
Check if it works out or not.
Uncompress the file
Check if the below line aids in executing the file:
xz -d ./filename
chmod +x ./filename
./filename
If your file is in a zipped format, try unzipping the compressed format and executing it as usual.
Remember to place the path address along with the name of the file.
If you download a binary file from the internet and try to execute it in PowerShell, sometimes you may encounter an error known as “Cannot execute binary file.
The Linux Operating System failed to execute (run or open) the specified file you mentioned in the previous line due to technical issues. A few reasons as to why this error has occurred are provided below.
Causes for cannot execute binary file
There can be broadly two reasons for a binary file to show “Cannot execute binary file” error:
- The file is an exe file and is compile only for Windows.
- The bit architecture of your system and the bin file does not match.
Fix: Cygwin cannot execute binary file
You can use Shell commands in Windows after downloading and installing the Cygwin application.
If you have executed:
C:cygwinbinfilename.exe -h always /bin/bash -l ls
Try this syntax:
C:cygwinbinfilename.exe -h always /bin/bash -l -c ls
If still, it didn’t work, try uninstalling and reinstalling all the necessary files of Cygwin again.
Java- Cannot execute binary file
If the Shell or Cmd Prompt window displays an “Exec format error” error, it wants to say that the current version is not compatible with your system.
If you are using AMD/ Intel processes, install the Linux/x64 build from here.
If you are using ARM type of processors: install the Linux-aarch64 build from here.
FAQs on cannot execute binary file
How to execute a binary file in Powershell?
Open Powershell.
type the below syntax:
./filename
In place of the filename, you have to type the address and path along with the file’s name.
How to rectify “Cannot execute binary file”?
1. Install the latest version of GCC and Gfortran library.
2. Check if the architecture bit is the same or not.
3. Download WienHQ.
4. Uncompress the file.
Fix: Bash cannot execute binary files.
The Bash (Bourne Again Shell) is a SHELL command interpreter. If you try to execute a binary file (.bin) using Bash, which can not be read due to improper settings or unzipped file, it will display an error of Bash cannot execute the binary file.
Raspberry Pi cannot execute binary files.
Make sure that you have downloaded the correct version and file for your OS.
Try uninstalling and reinstalling the software:
Winding up
We hope that the above solutions might have helped rectify your issue, and your file got executed.
You can ping us anytime to ask us any of your doubts using the comment section available at the end of the page.
Trending Right Now
-
Resolve Error Code E4301 Using These 4 Exciting Methods
●October 20, 2022
-
15 Incredible Ways to Fix Paramount Plus Keeps Pausing Error
by Amal Santosh●October 20, 2022
-
5 Strategies to Fix Adobe Short Media Token Validation Error Invalid Signature
by Amal Santosh●October 11, 2022
-
Fix the Apple TV 4K Turns off by Itself with 7 Wonderful Ways
by Amal Santosh●October 11, 2022