Error loading binary file



Cannot Execute Binary File 7 Easy Ways to Fix it

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.

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:

For installing g++, GCC, and a few more libraries, use the following code:

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:

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

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:

Using the sh command

Try the below syntax:

Using dos2unix command

In Powershell, use the command:

Check if it works out or not.

Uncompress the file

Check if the below line aids in executing the file:

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.

What is cannot execute binary 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:

  1. The file is an exe file and is compile only for Windows.
  2. 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:\cygwin\bin\filename.exe -h always /bin/bash -l ls

Try this syntax:
C:\cygwin\bin\filename.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.

Читайте также:  397 error communicating with target host

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.

Источник

Решение проблемы с ошибкой «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

Заключение

Итак, ошибка формата выполняемого файла с невозможностью запустить бинарный файл возникает из-за несоответствия программы операционной системе или архитектуре процессора. Эта проблема не должна возникать, если вы установили программу из исходных репозиториев (кроме случаев неправильной настройки источников репозитория). При возникновении этой проблемы поищите файл, подходящий для вашей архитектуры или скомпилируйте файл из исходных кодов под архитектуру вашей операционной системы.

Источник

Bash: ./filename : Cannot execute binary file

I couldn’t execute a fortran compiled code in ubuntu 11.10 32 bit.

Error message is

I’ve installed the gcc and gfortran libraries too.

Could anyone help?

7 Answers 7

As you can see from the output of file um that you posted in a comment, your binary is a 64-bit binary.

32 bit systems cannot run 64 bit binaries, it only works the other way around.

Another solution for people who are having this problem except the part about unmatched bits is that running the file without the command «bash».

Just use chmod +x ‘path to the file’ and then run ‘the path to the file’ in terminal.This is how I solved my problem.

Читайте также:  Что значит ошибка fatal error failed to connect with local steam client process

For Googlers:

  • 32-bit or 64-bit? Check with file yourbinary
  • Permission to execute? Do chmod +x yourbinary
  • Path correct? Do ./yourbinary

Try making the file executable

Then try running it

But if this is a exe file compiled for Windows, you probably need to install Wine.

Another possible source of this error: trying to run a Linux binary executable on a Mac, or vice versa.

For instance, trying to run the true binary from my Mac on an Ubuntu box that I SCPed it to:

If you’ve downloaded a binary and executing it fails with this error, check if you’ve downloaded the version for the wrong OS.

Источник

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.

Читайте также:  Ошибка exception processing message 0xc0000013 unexpected parameters

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.

Источник

Оцените статью
toolgir.ru
Adblock
detector