As a part of installation process of a proprietary system, my team was requested to run a small program that determine a fingerprint of a system as a part software license deployment. The only instruction we received was the script requires korn shell (ksh) to run. Obviously it failed to run
Upon further inspection, the ksh script is a just a wrapper that check operating system type and run the appropriate binary executable.
When I tried to run the binary directly I got this
[surfer@sakurazuka]$ ./genid -bash: ./echoid: No such file or directory
To determine which interpreter is required to run a certain binary executable, we can do :
readelf -a <executable> | grep interpreter
If your system does not have it, you can get it by installing binutils. You can do:
On RHEL and friends:
[surfer@sakurazuka]$sudo yum install binutils
Or, on Ubuntu and clones:
surfer@seishiro:~$ sudo apt install binutils
Running the above command on the binary I was provided gave me this
[surfer@sakurazuka]$readelf -a genid | grep interpreter [Requesting program interpreter: /lib/ld-linux.so.2]
Depends on what distribution in use, we then look for the package(s) that provide the above library,
On RHEL and its derivatives:
[surfer@sakurazuka]$yum provides ld-linux.so.2 Last metadata expiration check: 0:07:25 ago on Wed 07 Sep 2022 09:49:31 AM WIB. glibc-2.28-189.1.el8.i686 : The GNU libc libraries Repo : RHEL8 Matched from: Provide : ld-linux.so.2
Or, in Ubuntu
surfer@seishiro:~$ apt-file find ld-linux.so.2 libc6-i386: /lib/ld-linux.so.2 libc6-i386: /lib32/ld-linux.so.2
if apt-file is not available on your Ubuntu, installation, do this first:
surfer@seishiro:~$ sudo apt install apt-file
The next step to take is to either packages on the corresponding system.
On RHEL
[surfer@sakurazuka home]$ sudo yum install glibc.i686
or, on Ubuntu
surfer@seishiro:~$ sudo apt install libc6-i386
And, we’re done!