0

I just want to run a binary file, but when i try to do his using my terminal,its acting weird and i can't figure out what's the problem.

rohan@rohan:~$ cd Desktop/
rohan@rohan:~/Desktop$ ls
chal  challenge  __MACOSX
rohan@rohan:~/Desktop$ cd challenge
rohan@rohan:~/Desktop/challenge$ ls
binary1  binary2  binary3
rohan@rohan:~/Desktop/challenge$ ./binary1
bash: ./binary1: Permission denied
rohan@rohan:~/Desktop/challenge$ sudo ./binary1
[sudo] password for rohan: 
sudo: ./binary1: command not found
rohan@rohan:~/Desktop/challenge$ 

I also tried giving it permissions but it still can't execute it. Any help would be appreciated. thank you.

Also , these are the details of the files, My system is a 64-bit, ubuntu 16.04LTS, what would i need to get and how to run this file.

file    /home/rohan/Desktop/challenge/binary1
type    EXEC (Executable file)
pic false
has_va  true
root    elf
class   ELF32
lang    c
arch    x86
bits    32
machine Intel 80386
os  linux
subsys  linux
endian  little
strip   false
static  false
linenum true
lsyms   true
relocs  true
rpath   NONE
TheAmateur
  • 45
  • 12

1 Answers1

0

You can get that behavior from a shell script whose first line says to run a program which is not found at that path:

#!/bin/nosuchprogram
echo xx

also, if the script happens to have carriage-return/line-feed endings, the same result.

If it's a "binary" file, you might start by using the file utility to tell what it might be:

file binary3

and if it happens to be a type which might run on the current system, check with ldd, for missing libraries:

ldd binary3

Likewise, if your Ubuntu system is a 64-bit machine, you may not have libraries to support 32-bit applications. As a quick check (if you do not know what your system is), the arch program tells you what the default architecture is. Some older systems don't have that, but again file is your friend:

$ file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0x55f1e005df252708d4c456dcc2c7dccea1006553, stripped

(It is possible to have both 32- and 64-bit libraries on Ubuntu, but most are one or the other).

How to get 32-bit applications running on a 64-bit Ubuntu changes slightly from one release to the next. You may find these helpful:

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • i tried doing this, this is what shows up, rohan@rohan:~/Desktop/challenge$ file binary1 binary1: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.15, BuildID[sha1]=43af309d3735b17cef57f70cb997eebafd17ebf2, not stripped rohan@rohan:~/Desktop/challenge$ ldd binary1 not a dynamic executable – TheAmateur Jun 11 '16 at 20:33
  • I have a 64bit ubuntu system, on running the file command , i got, rohan@rohan:~/Desktop/challenge$ file binary1 binary1: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.15, BuildID[sha1]=43af309d3735b17cef57f70cb997eebafd17ebf2, not stripped Now, i don't know what need to installed in order to make it run. – TheAmateur Jun 11 '16 at 21:10