No such file or directory

Some time ago,  after installing and old java release on an Ubuntu machine we found this strange error wen I tried to execute it:

root@ubuntu:~# ls -la /usr/lib/jvm/java-6-openjdk-/i386/jre/bin/java
-rwxr-xr-x 1 root root 38576 Aug 26  2016 /usr/lib/jvm/java-6-openjdk-/i386/jre/bin/java
root@ubuntu:~# /usr/lib/jvm/java-6-openjdk-/i386/jre/bin/java -version
-bash: /usr/lib/jvm/java-6-openjdk-/i386/jre/bin/java: No such file or directory


The file had execute permissions, was not corrupted, and the route to the file was correct… but it appears a message like if the file doesn’t exists ¿?

After some debugging we found the clue, the error was due the lack of 32bit architecture support on the operating system (the Ubuntu have only the 64bit support enabled).

oot@ubuntu:~# file /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java
/usr/lib/jvm/java-6-openjdk-i386/jre/bin/java: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/, for GNU/Linux 2.6.24, BuildID[sha1]=90c78793edbc73af380f303d0754ae681117f9f8, stripped
root@ubuntu:~# uname -a
Linux ubuntu 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

The java executable is a 32bit one dynamically linked so it needs some 32bit libraries from the operating system.

To solve the issue, connected as root, we must enable the 32bit architecture:

dpkg --add-architecture i386

And install all the necessary 32bit libraries:

apt-get update
apt-get install libc6:i386 libstdc++6:i386 zlib1g:i386

And after that the 32bit java executes fine….

root@ubuntu:~# /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java -version
java version "1.6.0_40"
OpenJDK Runtime Environment (IcedTea6 1.13.12) (6b40-1.13.12-0ubuntu0.12.04.1)
OpenJDK Server VM (build 23.40-b40, mixed mode, sharing)





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s