Run ELF 64-bit LSB executable on Ubuntu 64 - linux

I am trying to run a package that is precompiled (supposedly for 'linux64') but get the following error message:
t.kuilman#steroid:~/Peeper/bin/netchop-3.1/bin$ ./netChop
-bash: ./netChop: cannot execute binary file: Exec format error
I checked how this file is compiled (see below) and it turns out to be an ELF 64-bit LSB executable.
t.kuilman#steroid:~/Peeper/bin/netchop-3.1/bin$ file ./netChop
./netChop: ELF 64-bit LSB executable, no machine, version 1 (SYSV), statically linked, for GNU/Linux 2.4.1, for SuSE 9.1, stripped
t.kuilman#steroid:~/Peeper/bin/netchop-3.1/bin$ ldd ./netChop
not a dynamic executable
t.kuilman#steroid:~/Peeper/bin/netchop-3.1/bin$ uname -a
Linux steroid 3.13.0-76-generic #120-Ubuntu SMP Mon Jan 18 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
How can I get this file to run on my system (Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-76-generic x86_64))?

This executable is likely either corrupt, or built in some non-standard way:
ELF 64-bit LSB executable, no machine, version 1 (SYSV) ...
A normal statically linked Linux executable should look like this:
ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux)
Note machine ("no machine" vs. "x86-64") and OS ABI ("SYSV" vs. "GNU/Linux") differences.
In any case, there is nothing you can do about it, other than complain to the producer of the package.

Related

Error libc.so.6 version GLIBC_2.33 not found

I'm trying to execute a 32 bits binary, that is my scenario:
Host compiled: Kali (64 bits)
Host executed: Debian 7 (32 bits)
Host compiled is the machine where I'm compiled to 32 bits the .c
Host executed is the machine where I'm executing the 32 bits binary
I have the package gcc-multipart installed and compiled using this command: gcc -m32 binary.c -o program -pthread
File Result:
program: ELF 32 bits LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2
When a try to execute in Debian, this error ocurrs /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.33' not found`
I'm looking for some solutions, try to re-install/upgrade the libc6, but did not work.

How to make the binary file so that the interpreter of this file is /lib/ld-linux-aarch64.so?

I directly use the binary file you released to test on my arm64-based computer. But the test result is not normal operation. The reason is that nw interpreter needs to be /lib/ld-linux-aarch64.so.1 instead of /lib/ld-linux-armhf.so.3 on Linux version 4.19.172 for arm64.
How to compile the binary file so that the interpreter of this file is /lib/ld-linux-aarch64.so?
$ file ./nwjs-chromium-ffmpeg-branding/nwjs-v0.52.3-linux-arm/nw
$ ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[xxHash]=4c8a98c5d541ac00, stripped
But, I want to get a binary executable file like this:
$ file ./nwjs-chromium-ffmpeg-branding/nwjs-v0.52.3-linux-arm/nw
$ ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.2.0, BuildID[xxHash]=4c8a98c5d541ac00, stripped

How to fix exec format error on 64-bit Linux?

I am learning x86_64 assembly. But I have run into the following problem:
I am assembling a program with gcc -g -c exercise1.s -o exercise1.o and linking it with ld -g -o exercise1 exercise1.o -m elf_x86_64
However when I try to run the program I get the following error: bash: ./exercise1: cannot execute binary file: Exec format error
Running uname -a I get Linux lubuntu 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux and arch outputs x86_64.
file outputs exercise1: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), corrupted program header size, with debug_info, not stripped.
To me it seems that I am trying to run a 64-bit program on a 64-bit kernel on a 64-bit CPU. Why is it not working?

Illegal instruction (core dumped) when trying to execute elf file

I am trying to execute a elf file (call it precompiled) and it gives:
Illegal instruction (core dumped)
Compiling from source works fine
gcc source.c
./a.out
Debug info:
file precompiled
precompiled: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=<BUILD ID HERE>, not stripped
file a
a: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=<BUILD ID HERE>, not stripped
What can be causing this error? If it is the different GNU/Linux version, how can I download from the terminal the necessary packages?
It means the compiled binary contains an instruction(possibly more than one instruction) that's not valid on the architecture where you're running it.
You can run your binary under gdb to find out specific instruction:
gdb ./precompiled
(gdb) run
(gdb) bt
(gdb) disassemble
Then type run and then when it fails, run bt (backtrace) to see where it fails. Use disassemble to see the specific instruction that's causing the failure.
There's not much you can do to fix it. You could potentially edit the binary by disassembling it and editing the assembly and again compiling it into a binary. Given that you have the source code, it's simpler to re-compile on your target machine.
You may be able to avoid specific instructions (when compiling on a different machine -- where you compiled precompiled binary) by using compiler switches based on your target architecture.

How to specify GNU / Linux version compiling dropbear

I have a compiled binary of Dropbear. When I do file dbclient I get the following :
dbclient: ELF 32-bit LSB executable, ARM, version 1 (SYSV),
dynamically linked (uses shared libs), stripped
When I am trying to compile it on my own (very beginner) with
./configure --host=arm-linux-gnueabi --prefix=/ --disable-zlib
CC=arm-linux-gnueabi-gcc LD=arm-linux-gnueabi-ld make make install
I get the following after it compiled
dbclient: ELF 32-bit LSB executable, ARM, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.31,
BuildID[sha1]=0x016ac7e729afb02d60248393619b41380379777d, not stripped
For the stripped part, I don't care I could strip it later.
But my question is how to specify the "for GNU/Linux 2.6.31". What does it mean and how do I change it to target Linux 3.10.49 armv5tejl?

Resources