linuxbashubuntuelf

bash: No such file or directory (for 32-bit binary on Ubuntu 20.04)


I am trying to run an older, 32-bit binary on Ubuntu 20.04 on an x86_64 machine. Here is the profile of the binary from file:

$ file /usr/local/diamond/3.13/modeltech/linuxloem/vsim
/usr/local/diamond/3.13/modeltech/linuxloem/vsim: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=b8557f9eb74b21146d0eba49769f30f475422d26, stripped

When I execute the binary, I get this error:

$ /usr/local/diamond/3.13/modeltech/linuxloem/vsim
bash: /usr/local/diamond/3.13/modeltech/linuxloem/vsim: No such file or directory

I cannot figure out what the problem is. Permissions on the binary are fine (mwg is my user and group):

$ ls -la /usr/local/diamond/3.13/modeltech/linuxloem/vsim
-rwxr-xr-x 1 mwg mwg 7772676 Jul 18  2023 /usr/local/diamond/3.13/modeltech/linuxloem/vsim

The same problem occurs when trying to run the binary as root (i.e., prefixing the command with sudo).

The only thing I can think of is that this binary is expecting an interpreter at /lib/ld-linux.so.2 (from the file output above), and this path does not exist on my system. This answer gave me the idea that I may need to apt install binutils, but I tried that, and it did not fix the problem.

Does anyone have a suggestion for how I can run this binary? Or how to further diagnose the problem?


Solution

  • On my Ubuntu 22.04.4 system, /lib/ld-linux.so.2 is a symlink to /lib/i386-linux-gnu/ld-linux.so.2. That file is provided by the libc6:i386 package.

    Installing libc6:i386 will likely correct the problem.

    $ ls -l /lib/ld-linux.so.2
    lrwxrwxrwx 1 root root 28 Jan  2 05:22 /lib/ld-linux.so.2 -> i386-linux-gnu/ld-linux.so.2
    $ ls -l /lib/i386-linux-gnu/ld-linux.so.2
    -rwxr-xr-x 1 root root 225864 Jan  2 05:22 /lib/i386-linux-gnu/ld-linux.so.2
    $ dpkg -S /lib/i386-linux-gnu/ld-linux.so.2
    libc6:i386: /lib/i386-linux-gnu/ld-linux.so.2
    $